From 100f3380c4dfb1e89da3305e3753f6937a292116 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Tue, 14 Nov 2017 08:38:45 +0300 Subject: [PATCH] fix upnp definitions and make cmake silent (#999) --- build/CMakeLists.txt | 4 ++-- daemon/UPnP.cpp | 4 ++-- libi2pd/Log.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 1f18beb7..c01e0ba2 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -150,7 +150,7 @@ else() if (MSYS OR MINGW) add_definitions( -DWIN32_LEAN_AND_MEAN ) endif () - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Winvalid-pch -Wno-unused-parameter" ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic" ) # TODO: The following is incompatible with static build and enabled hardening for OpenWRT. # Multiple definitions of __stack_chk_fail (libssp & libc) @@ -180,7 +180,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # more tweaks if (NOT (MSVC OR MSYS OR APPLE)) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++" ) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-const-variable -Wno-overloaded-virtual -Wno-c99-extensions -stdlib=libstdc++" ) endif() endif () diff --git a/daemon/UPnP.cpp b/daemon/UPnP.cpp index 167638e2..ba7b408c 100644 --- a/daemon/UPnP.cpp +++ b/daemon/UPnP.cpp @@ -82,7 +82,7 @@ namespace transport #if MINIUPNPC_API_VERSION >= 14 int nerror = 0; m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, 2, &nerror); -#elif MINIUPNPC_API_VERSION >= 8 +#elif ( MINIUPNPC_API_VERSION >= 8 || defined(UPNPDISCOVER_SUCCESS) ) int nerror = 0; m_Devlist = upnpDiscover (2000, m_MulticastIf, m_Minissdpdpath, 0, 0, &nerror); #else @@ -158,7 +158,7 @@ namespace transport std::string strType (GetProto (address)), strPort (std::to_string (address->port)); int r; std::string strDesc; i2p::config::GetOption("upnp.name", strDesc); -#if MINIUPNPC_API_VERSION >= 8 +#ifdef UPNPDISCOVER_SUCCESS r = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0, "0"); #else r = UPNP_AddPortMapping (m_upnpUrls.controlURL, m_upnpData.first.servicetype, strPort.c_str (), strPort.c_str (), m_NetworkAddr, strDesc.c_str (), strType.c_str (), 0); diff --git a/libi2pd/Log.cpp b/libi2pd/Log.cpp index 8ae417c2..5df8a9fd 100644 --- a/libi2pd/Log.cpp +++ b/libi2pd/Log.cpp @@ -165,7 +165,7 @@ namespace log { while (m_IsRunning) { std::shared_ptr msg; - while (msg = m_Queue.Get ()) + while ((msg = m_Queue.Get ())) Process (msg); if (m_LogStream) m_LogStream->flush(); if (m_IsRunning)