From 9fbb26f04fdf19bbb6da890e8b486f4cc52ddb77 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Sat, 14 May 2022 21:45:22 -0700 Subject: [PATCH] Silence additional compiler warnings about lack of return value --- src/fd-net-device/helper/emu-fd-net-device-helper.cc | 2 ++ src/fd-net-device/helper/tap-fd-net-device-helper.cc | 3 ++- src/internet/model/tcp-tx-buffer.cc | 1 + src/lte/helper/lte-stats-calculator.cc | 3 +++ src/wifi/model/phy-entity.cc | 1 + src/wifi/model/qos-utils.cc | 1 + 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fd-net-device/helper/emu-fd-net-device-helper.cc b/src/fd-net-device/helper/emu-fd-net-device-helper.cc index 0a3ff25df..905f5dafd 100644 --- a/src/fd-net-device/helper/emu-fd-net-device-helper.cc +++ b/src/fd-net-device/helper/emu-fd-net-device-helper.cc @@ -430,6 +430,8 @@ EmuFdNetDeviceHelper::CreateFileDescriptor (void) const } NS_FATAL_ERROR ("Did not get the raw socket from the socket creator"); } + NS_FATAL_ERROR ("Should be unreachable"); + return 0; // Silence compiler warning about lack of return value } } // namespace ns3 diff --git a/src/fd-net-device/helper/tap-fd-net-device-helper.cc b/src/fd-net-device/helper/tap-fd-net-device-helper.cc index ca48767b0..da4f54681 100644 --- a/src/fd-net-device/helper/tap-fd-net-device-helper.cc +++ b/src/fd-net-device/helper/tap-fd-net-device-helper.cc @@ -399,7 +399,8 @@ TapFdNetDeviceHelper::CreateFileDescriptor (void) const } NS_FATAL_ERROR ("Did not get the raw socket from the socket creator"); } - + NS_FATAL_ERROR ("Should be unreachable"); + return 0; // Silence compiler warning about lack of return value } } // namespace ns3 diff --git a/src/internet/model/tcp-tx-buffer.cc b/src/internet/model/tcp-tx-buffer.cc index 6ecbc19fe..0041b4ae5 100644 --- a/src/internet/model/tcp-tx-buffer.cc +++ b/src/internet/model/tcp-tx-buffer.cc @@ -580,6 +580,7 @@ TcpTxBuffer::GetPacketFromList (PacketList &list, const SequenceNumber32 &listSt } NS_FATAL_ERROR ("This point is not reachable"); + return nullptr; // Silence compiler warning about lack of return value } void diff --git a/src/lte/helper/lte-stats-calculator.cc b/src/lte/helper/lte-stats-calculator.cc index f0da73b04..a9a138a72 100644 --- a/src/lte/helper/lte-stats-calculator.cc +++ b/src/lte/helper/lte-stats-calculator.cc @@ -158,6 +158,7 @@ LteStatsCalculator::FindImsiFromEnbRlcPath (std::string path) { NS_FATAL_ERROR ("Lookup " << ueMapPath << " got no matches"); } + return 0; // Silence compiler warning about lack of return value } uint64_t @@ -205,6 +206,7 @@ LteStatsCalculator::FindImsiFromLteNetDevice (std::string path) { NS_FATAL_ERROR ("Lookup " << path << " got no matches"); } + return 0; // Silence compiler warning about lack of return value } uint16_t @@ -227,6 +229,7 @@ LteStatsCalculator::FindCellIdFromEnbRlcPath (std::string path) { NS_FATAL_ERROR ("Lookup " << enbNetDevicePath << " got no matches"); } + return 0; // Silence compiler warning about lack of return value } uint64_t diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 01e3659f9..91e66372e 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -171,6 +171,7 @@ PhyEntity::GetNextField (WifiPpduField currentField, WifiPreamble preamble) cons { NS_FATAL_ERROR ("Unsupported preamble " << preamble << " for the provided PPDU formats"); } + return WifiPpduField::WIFI_PPDU_FIELD_PREAMBLE; // Silence compiler warning } Time diff --git a/src/wifi/model/qos-utils.cc b/src/wifi/model/qos-utils.cc index 69bcaa158..f2c6fff61 100644 --- a/src/wifi/model/qos-utils.cc +++ b/src/wifi/model/qos-utils.cc @@ -246,6 +246,7 @@ GetTid (Ptr packet, const WifiMacHeader hdr) { NS_FATAL_ERROR ("Packet has no Traffic ID"); } + return 0; // Silence compiler warning about lack of return value } uint8_t