diff --git a/Win32/Win32App.cpp b/Win32/Win32App.cpp index 0c701c59..5234b032 100644 --- a/Win32/Win32App.cpp +++ b/Win32/Win32App.cpp @@ -355,9 +355,7 @@ namespace win32 } } } -#if (__cplusplus >= 201703L) // C++ 17 or higher - [[fallthrough]]; -#endif + [fallthrough]]; } case WM_TRAYICON: { diff --git a/libi2pd/ECIESX25519AEADRatchetSession.cpp b/libi2pd/ECIESX25519AEADRatchetSession.cpp index 9f23482b..138d21e9 100644 --- a/libi2pd/ECIESX25519AEADRatchetSession.cpp +++ b/libi2pd/ECIESX25519AEADRatchetSession.cpp @@ -801,9 +801,7 @@ namespace garlic m_State = eSessionStateEstablished; m_NSRSendTagset = nullptr; m_EphemeralKeys = nullptr; -#if (__cplusplus >= 201703L) // C++ 17 or higher [[fallthrough]]; -#endif case eSessionStateEstablished: if (m_SendReverseKey && receiveTagset->GetTagSetID () == m_NextReceiveRatchet->GetReceiveTagSetID ()) m_SendReverseKey = false; // tag received on new tagset diff --git a/libi2pd/FS.h b/libi2pd/FS.h index 455012ba..8bf8101e 100644 --- a/libi2pd/FS.h +++ b/libi2pd/FS.h @@ -16,8 +16,7 @@ #include #ifndef STD_FILESYSTEM -# if (!TARGET_OS_SIMULATOR && \ - (__cplusplus >= 201703L) && __has_include()) // C++ 17 or higher and supports std::filesystem +# if (!TARGET_OS_SIMULATOR && __has_include()) // supports std::filesystem # define STD_FILESYSTEM 1 # else # define STD_FILESYSTEM 0 diff --git a/libi2pd/Garlic.cpp b/libi2pd/Garlic.cpp index 54fc781e..fb99ce6d 100644 --- a/libi2pd/Garlic.cpp +++ b/libi2pd/Garlic.cpp @@ -1031,9 +1031,7 @@ namespace garlic case eGarlicDeliveryTypeDestination: LogPrint (eLogDebug, "Garlic: Type destination"); buf += 32; // TODO: check destination -#if (__cplusplus >= 201703L) // C++ 17 or higher [[fallthrough]]; -#endif // no break here case eGarlicDeliveryTypeLocal: { diff --git a/libi2pd/Log.h b/libi2pd/Log.h index 0164ea4f..18592c9e 100644 --- a/libi2pd/Log.h +++ b/libi2pd/Log.h @@ -172,16 +172,6 @@ void LogPrint (std::stringstream& s, TValue&& arg) noexcept s << std::forward(arg); } -#if (__cplusplus < 201703L) // below C++ 17 -/** internal usage only -- folding args array to single string */ -template -void LogPrint (std::stringstream& s, TValue&& arg, TArgs&&... args) noexcept -{ - LogPrint (s, std::forward(arg)); - LogPrint (s, std::forward(args)...); -} -#endif - /** * @brief Create log message and send it to queue * @param level Message level (eLogError, eLogInfo, ...) @@ -194,13 +184,7 @@ void LogPrint (LogLevel level, TArgs&&... args) noexcept // fold message to single string std::stringstream ss; - -#if (__cplusplus >= 201703L) // C++ 17 or higher (LogPrint (ss, std::forward(args)), ...); -#else - LogPrint (ss, std::forward(args)...); -#endif - auto msg = std::make_shared(level, std::time(nullptr), std::move(ss).str()); msg->tid = std::this_thread::get_id(); i2p::log::Logger().Append(msg); @@ -217,11 +201,7 @@ void ThrowFatal (TArgs&&... args) noexcept if (!f) return; // fold message to single string std::stringstream ss(""); -#if (__cplusplus >= 201703L) // C++ 17 or higher (LogPrint (ss, std::forward(args)), ...); -#else - LogPrint (ss, std::forward(args)...); -#endif f (ss.str ()); } diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 9bd78776..b222ac88 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -1314,12 +1314,8 @@ namespace data { // update selection m_ExploratorySelection.clear (); -#if (__cplusplus >= 201703L) // C++ 17 or higher std::vector > eligible; - eligible.reserve (m_RouterInfos.size ()); -#else - auto& eligible = m_ExploratorySelection; -#endif + eligible.reserve (m_RouterInfos.size ()); { // collect eligible from current netdb bool checkIsReal = i2p::tunnel::tunnels.GetPreciseTunnelCreationSuccessRate () < NETDB_TUNNEL_CREATION_RATE_THRESHOLD; // too low rate @@ -1329,22 +1325,13 @@ namespace data (!checkIsReal || (it.second->HasProfile () && it.second->GetProfile ()->IsReal ()))) eligible.push_back (it.second); } -#if (__cplusplus >= 201703L) // C++ 17 or higher if (eligible.size () > NETDB_MAX_EXPLORATORY_SELECTION_SIZE) { std::sample (eligible.begin(), eligible.end(), std::back_inserter(m_ExploratorySelection), NETDB_MAX_EXPLORATORY_SELECTION_SIZE, std::mt19937(ts)); } else - std::swap (m_ExploratorySelection, eligible); -#else - if (m_ExploratorySelection.size () > NETDB_MAX_EXPLORATORY_SELECTION_SIZE) - { - // reduce number of eligible to max selection size - std::shuffle (m_ExploratorySelection.begin(), m_ExploratorySelection.end(), std::mt19937(ts)); - m_ExploratorySelection.resize (NETDB_MAX_EXPLORATORY_SELECTION_SIZE); - } -#endif + std::swap (m_ExploratorySelection, eligible); m_LastExploratorySelectionUpdateTime = ts; } diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index 5461cdfd..89c46c45 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -626,9 +626,7 @@ namespace i2p case low : /* not set */; break; case extra : caps |= i2p::data::RouterInfo::eExtraBandwidth; break; // 'P' case unlim : caps |= i2p::data::RouterInfo::eExtraBandwidth; -#if (__cplusplus >= 201703L) // C++ 17 or higher [[fallthrough]]; -#endif // no break here, extra + high means 'X' case high : caps |= i2p::data::RouterInfo::eHighBandwidth; break; } diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp index 92fe2d46..62bbf41f 100644 --- a/libi2pd/SSU2Session.cpp +++ b/libi2pd/SSU2Session.cpp @@ -587,11 +587,7 @@ namespace transport if (!resentPackets.empty ()) { m_LastResendTime = ts; -#if (__cplusplus >= 201703L) // C++ 17 or higher m_SentPackets.merge (resentPackets); -#else - m_SentPackets.insert (resentPackets.begin (), resentPackets.end ()); -#endif m_WindowSize >>= 1; // /2 if (m_WindowSize < SSU2_MIN_WINDOW_SIZE) m_WindowSize = SSU2_MIN_WINDOW_SIZE; return resentPackets.size (); diff --git a/libi2pd_client/SOCKS.cpp b/libi2pd_client/SOCKS.cpp index 3174bdb3..0961690b 100644 --- a/libi2pd_client/SOCKS.cpp +++ b/libi2pd_client/SOCKS.cpp @@ -444,9 +444,7 @@ namespace proxy break; case CMD_UDP: if (m_socksv == SOCKS5) break; -#if (__cplusplus >= 201703L) // C++ 17 or higher [[fallthrough]]; -#endif default: LogPrint(eLogError, "SOCKS: Invalid command: ", ((int)*sock_buff)); SocksRequestFailed(SOCKS5_GEN_FAIL);