Fix ASAN build

pull/608/head
Michael 5 years ago
parent 5f823f8ba3
commit 19578fa8fc
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -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)

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

@ -3,6 +3,8 @@
#include <bitset>
#include <array>
#include <absl/base/attributes.h>
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); */

@ -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

Loading…
Cancel
Save