diff --git a/CMakeLists.txt b/CMakeLists.txt index c633b9c8f..badf03bc6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,33 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW) message( FATAL_ERROR "shadow-framework is Linux only" ) endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW) +if(NOT DEBIAN AND NOT MSVC_VERSION) + set(OPTIMIZE_FLAGS -O3) + set(DEBUG_FLAGS -O0 -g3) +endif() + +if(ASAN) + set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer) + set(OPTIMIZE_FLAGS "-O0") +endif(ASAN) + +if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") + set(OPTIMIZE_FLAGS "") + add_definitions(-DLOKINET_DEBUG=1) + set(CRYPTO_FLAGS "") + add_compile_options( ${DEBUG_FLAGS} ) + link_libraries( ${DEBUG_FLAGS} ) +endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") + +# Add non-386 target-specific options here +if(NON_PC_TARGET) + add_definitions(-DRPI) + set(WITH_STATIC ON) +endif(NON_PC_TARGET) + +add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS}) + + set(ABSEIL_DIR vendor/abseil-cpp) add_subdirectory(${ABSEIL_DIR}) include_directories(SYSTEM ${ABSEIL_DIR}) @@ -156,36 +183,10 @@ if(TESTNET) add_definitions(-DTESTNET=1) endif(TESTNET) -if(NOT DEBIAN AND NOT MSVC_VERSION) - set(OPTIMIZE_FLAGS -O3) - set(DEBUG_FLAGS -O0 -g3) -endif() - -if(ASAN) - set(DEBUG_FLAGS ${DEBUG_FLAGS} -fsanitize=address -fno-omit-frame-pointer) - set(OPTIMIZE_FLAGS "-O0") -endif(ASAN) - if(SHADOW) include(cmake/shadow.cmake) endif(SHADOW) -if(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") - set(OPTIMIZE_FLAGS "") - add_definitions(-DLOKINET_DEBUG=1) - set(CRYPTO_FLAGS "") - add_compile_options( ${DEBUG_FLAGS} ) - link_libraries( ${DEBUG_FLAGS} ) -endif(CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]") - -# Add non-386 target-specific options here -if(NON_PC_TARGET) - add_definitions(-DRPI) - set(WITH_STATIC ON) -endif(NON_PC_TARGET) - -add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS}) - if(NOT GIT_VERSION) exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP) string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION) diff --git a/llarp/router/router.cpp b/llarp/router/router.cpp index bb8219381..6991a2690 100644 --- a/llarp/router/router.cpp +++ b/llarp/router/router.cpp @@ -325,8 +325,6 @@ namespace llarp } } - constexpr size_t MaxPendingSendQueueSize = 8; - bool Router::SendToOrQueue(const RouterID &remote, const ILinkMessage *msg) { diff --git a/llarp/util/alloc.hpp b/llarp/util/alloc.hpp index ee6797a53..45e1a795a 100644 --- a/llarp/util/alloc.hpp +++ b/llarp/util/alloc.hpp @@ -3,6 +3,8 @@ #include #include +#include + namespace llarp { namespace util @@ -54,7 +56,7 @@ namespace llarp } bool - HasRoomFor(size_t numItems) + HasRoomFor(ABSL_ATTRIBUTE_UNUSED size_t numItems) { return true; /* return mem->hasRoomFor(numItems); */ diff --git a/llarp/util/logger_internal.hpp b/llarp/util/logger_internal.hpp index 8e91d367d..69a0c5487 100644 --- a/llarp/util/logger_internal.hpp +++ b/llarp/util/logger_internal.hpp @@ -46,22 +46,26 @@ namespace llarp { const char* format; - log_timestamp(const char* fmt = "%c %Z") : format(fmt) + log_timestamp() : format("%c %Z") { } - friend std::ostream& - operator<<(std::ostream& out, const log_timestamp& ts) + explicit log_timestamp(const char* fmt) : format(fmt) { + } + }; + + inline std::ostream& + operator<<(std::ostream& out, const log_timestamp& ts) + { #if defined(ANDROID) || defined(RPI) - (void)ts; - return out << time_now_ms(); + (void)ts; + return out << time_now_ms(); #else - return out << absl::FormatTime(ts.format, absl::Now(), - absl::LocalTimeZone()); + absl::TimeZone tz = absl::LocalTimeZone(); + return out << absl::FormatTime(ts.format, absl::Now(), tz); #endif - } - }; + } } // namespace llarp