Merge pull request #608 from michael-loki/fix_asan_build

Fix ASAN build
This commit is contained in:
Jeff 2019-05-19 17:15:57 -04:00 committed by GitHub
commit a8941afbf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 39 deletions

View File

@ -70,6 +70,33 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
message( FATAL_ERROR "shadow-framework is Linux only" ) message( FATAL_ERROR "shadow-framework is Linux only" )
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW) 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) set(ABSEIL_DIR vendor/abseil-cpp)
add_subdirectory(${ABSEIL_DIR}) add_subdirectory(${ABSEIL_DIR})
include_directories(SYSTEM ${ABSEIL_DIR}) include_directories(SYSTEM ${ABSEIL_DIR})
@ -156,36 +183,10 @@ if(TESTNET)
add_definitions(-DTESTNET=1) add_definitions(-DTESTNET=1)
endif(TESTNET) 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) if(SHADOW)
include(cmake/shadow.cmake) include(cmake/shadow.cmake)
endif(SHADOW) 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) if(NOT GIT_VERSION)
exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP) exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "rev-parse --short HEAD" OUTPUT_VARIABLE GIT_VERSION_UNSTRIP)
string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION) string(STRIP "${GIT_VERSION_UNSTRIP}" GIT_VERSION)

View File

@ -325,8 +325,6 @@ namespace llarp
} }
} }
constexpr size_t MaxPendingSendQueueSize = 8;
bool bool
Router::SendToOrQueue(const RouterID &remote, const ILinkMessage *msg) Router::SendToOrQueue(const RouterID &remote, const ILinkMessage *msg)
{ {

View File

@ -3,6 +3,8 @@
#include <bitset> #include <bitset>
#include <array> #include <array>
#include <absl/base/attributes.h>
namespace llarp namespace llarp
{ {
namespace util namespace util
@ -54,7 +56,7 @@ namespace llarp
} }
bool bool
HasRoomFor(size_t numItems) HasRoomFor(ABSL_ATTRIBUTE_UNUSED size_t numItems)
{ {
return true; return true;
/* return mem->hasRoomFor(numItems); */ /* return mem->hasRoomFor(numItems); */

View File

@ -46,23 +46,27 @@ namespace llarp
{ {
const char* format; const char* format;
log_timestamp(const char* fmt = "%c %Z") : format(fmt) log_timestamp() : format("%c %Z")
{ {
} }
friend std::ostream& explicit log_timestamp(const char* fmt) : format(fmt)
operator<<(std::ostream& out, const log_timestamp& ts)
{ {
#if defined(ANDROID) || defined(RPI)
(void)ts;
return out << time_now_ms();
#else
return out << absl::FormatTime(ts.format, absl::Now(),
absl::LocalTimeZone());
#endif
} }
}; };
inline std::ostream&
operator<<(std::ostream& out, const log_timestamp& ts)
{
#if defined(ANDROID) || defined(RPI)
(void)ts;
return out << time_now_ms();
#else
absl::TimeZone tz = absl::LocalTimeZone();
return out << absl::FormatTime(ts.format, absl::Now(), tz);
#endif
}
} // namespace llarp } // namespace llarp
#endif #endif