Bugzilla – Bug 2554
Value is never read in wifi-80211p-helper
Last modified: 2017-04-07 00:54:55 UTC
Created attachment 2674 [details] patch I should state that I don't understand why the static analyzer says that. Anyway, in the function Install of wifi-80211p-helper, we have the following: 76 NetDeviceContainer 77 Wifi80211pHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const 78 { 79 bool isWaveMacHelper = false; 80 try 81 { 82 const QosWaveMacHelper& qosMac = dynamic_cast<const QosWaveMacHelper&> (macHelper); 83 isWaveMacHelper = true; // Value stored to 'isWaveMacHelper' is never read 84 NS_UNUSED (qosMac); 85 } 86 catch (const std::bad_cast &) 87 { 88 89 } 90 91 try 92 { 93 const NqosWaveMacHelper& nqosMac = dynamic_cast<const NqosWaveMacHelper&> (macHelper); 94 isWaveMacHelper = true; 95 NS_UNUSED (nqosMac); 96 } 97 catch (const std::bad_cast &) 98 { 99 100 } 101 102 if (!isWaveMacHelper) 103 { 104 NS_FATAL_ERROR ("the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper" 105 ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"); 106 } 107 108 return WifiHelper::Install (phyHelper, macHelper, c); 109 } At line 83, the value is never read. Anyway, there is a less expensive way to check if a dynamic cast has been done, and is through pointers. The patch does exactly that, using pointers. The warning goes away.
pushed in changeset 12809:c7f9d1aa7d9a