Bug Summary

File:/tmp/asd-nat/home/nat/Work/ns-3-dev-git/build/../src/wave/helper/wifi-80211p-helper.cc
Location:line 83, column 7
Description:Value stored to 'isWaveMacHelper' is never read

Annotated Source Code

1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008 INRIA
4 * Copyright (c) 2009 MIRKO BANCHI
5 * Copyright (c) 2013 Dalian University of Technology
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation;
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21 * Author: Mirko Banchi <mk.banchi@gmail.com>
22 * Author: Junling Bu <linlinjavaer@gmail.com>
23 */
24#include "ns3/string.h"
25#include "ns3/log.h"
26#include <typeinfo>
27#include "wave-mac-helper.h"
28#include "wifi-80211p-helper.h"
29#include "ns3/unused.h"
30
31namespace ns3 {
32
33Wifi80211pHelper::Wifi80211pHelper ()
34{
35}
36
37Wifi80211pHelper::~Wifi80211pHelper ()
38{
39}
40
41Wifi80211pHelper
42Wifi80211pHelper::Default (void)
43{
44 Wifi80211pHelper helper;
45 helper.SetStandard (WIFI_PHY_STANDARD_80211_10MHZ);
46 helper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
47 "DataMode", StringValue ("OfdmRate6MbpsBW10MHz"),
48 "ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"),
49 "NonUnicastMode", StringValue ("OfdmRate6MbpsBW10MHz"));
50 return helper;
51}
52
53void
54Wifi80211pHelper::SetStandard (enum WifiPhyStandard standard)
55{
56 if ((standard == WIFI_PHY_STANDARD_80211a) || (standard == WIFI_PHY_STANDARD_80211_10MHZ))
57 {
58 WifiHelper::SetStandard (standard);
59 }
60 else
61 {
62 NS_FATAL_ERROR ("802.11p only use 802.11 standard with 10MHz or 20MHz")do { std::cerr << "msg=\"" << "802.11p only use 802.11 standard with 10MHz or 20MHz"
<< "\", "; do { std::cerr << "file=" << "../src/wave/helper/wifi-80211p-helper.cc"
<< ", line=" << 62 << std::endl; ::ns3::FatalImpl
::FlushStreams (); if (true) std::terminate (); } while (false
); } while (false)
;
63 }
64}
65
66
67void
68Wifi80211pHelper::EnableLogComponents (void)
69{
70 WifiHelper::EnableLogComponents ();
71
72 LogComponentEnable ("OcbWifiMac", LOG_LEVEL_ALL);
73 LogComponentEnable ("VendorSpecificAction", LOG_LEVEL_ALL);
74}
75
76NetDeviceContainer
77Wifi80211pHelper::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)((void)(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)((void)(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"do { std::cerr << "msg=\"" << "the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper"
", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"
<< "\", "; do { std::cerr << "file=" << "../src/wave/helper/wifi-80211p-helper.cc"
<< ", line=" << 105 << std::endl; ::ns3::FatalImpl
::FlushStreams (); if (true) std::terminate (); } while (false
); } while (false)
105 ", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper")do { std::cerr << "msg=\"" << "the macHelper should be either QosWaveMacHelper or NqosWaveMacHelper"
", or should be the subclass of QosWaveMacHelper or NqosWaveMacHelper"
<< "\", "; do { std::cerr << "file=" << "../src/wave/helper/wifi-80211p-helper.cc"
<< ", line=" << 105 << std::endl; ::ns3::FatalImpl
::FlushStreams (); if (true) std::terminate (); } while (false
); } while (false)
;
106 }
107
108 return WifiHelper::Install (phyHelper, macHelper, c);
109}
110
111} // namespace ns3