Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b18e9a1eb9 |
@ -34,12 +34,20 @@ endif()
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
if(CMAKE_GENERATOR STREQUAL "Ninja")
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||
include(CheckCXXCompilerFlag)
|
||||
check_cxx_compiler_flag(-fdiagnostics-color=always HAS_CXX_FDIAGNOSTICS_COLOR)
|
||||
if(HAS_CXX_FDIAGNOSTICS_COLOR)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always")
|
||||
endif()
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
|
||||
endif()
|
||||
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
include(CheckCCompilerFlag)
|
||||
check_c_compiler_flag(-fdiagnostics-color=always HAS_C_FDIAGNOSTICS_COLOR)
|
||||
if(HAS_C_FDIAGNOSTICS_COLOR)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdiagnostics-color=always")
|
||||
endif()
|
||||
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
|
||||
endif()
|
||||
@ -176,6 +184,11 @@ target_compile_options(
|
||||
${warning_options}
|
||||
)
|
||||
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
|
||||
# https://godbolt.org/z/qYh89E6rq
|
||||
target_compile_options(${target_name} PRIVATE -Wno-missing-field-initializers)
|
||||
endif()
|
||||
|
||||
set(CPPTRACE_VERSION_MAJOR ${CMAKE_PROJECT_VERSION_MAJOR})
|
||||
set(CPPTRACE_VERSION_MINOR ${CMAKE_PROJECT_VERSION_MINOR})
|
||||
set(CPPTRACE_VERSION_PATCH ${CMAKE_PROJECT_VERSION_PATCH})
|
||||
|
||||
@ -424,7 +424,7 @@ namespace detail {
|
||||
static std::unordered_map<std::string, Result<elf, internal_error>> cache;
|
||||
auto it = cache.find(object_path);
|
||||
if(it == cache.end()) {
|
||||
auto res = cache.insert({ object_path, elf::open_elf(object_path) });
|
||||
auto res = cache.emplace(object_path, elf::open_elf(object_path));
|
||||
VERIFY(res.second);
|
||||
it = res.first;
|
||||
}
|
||||
|
||||
@ -272,7 +272,8 @@ namespace cpptrace {
|
||||
memcpy(new_vtable_page, type_info_vtable_pointer, vtable_size * sizeof(void*));
|
||||
// ninja in the custom __do_catch interceptor
|
||||
auto new_vtable = static_cast<void**>(new_vtable_page);
|
||||
new_vtable[6] = reinterpret_cast<void*>(do_catch_function);
|
||||
// double cast is done here because older (and some newer gcc versions) warned about it under -Wpedantic
|
||||
new_vtable[6] = reinterpret_cast<void*>(reinterpret_cast<std::uintptr_t>(do_catch_function));
|
||||
// make the page read-only
|
||||
mprotect_page(new_vtable_page, page_size, memory_readonly);
|
||||
|
||||
|
||||
@ -324,7 +324,7 @@ namespace libdwarf {
|
||||
char** dw_srcfiles;
|
||||
Dwarf_Signed dw_filecount;
|
||||
VERIFY(wrap(dwarf_srcfiles, cu_die.get(), &dw_srcfiles, &dw_filecount) == DW_DLV_OK);
|
||||
it = srcfiles_cache.insert(it, {off, srcfiles{cu_die.dbg, dw_srcfiles, dw_filecount}});
|
||||
it = srcfiles_cache.emplace_hint(it, off, srcfiles{cu_die.dbg, dw_srcfiles, dw_filecount});
|
||||
}
|
||||
if(file_i < it->second.count()) {
|
||||
// dwarf is using 1-indexing
|
||||
|
||||
@ -67,7 +67,14 @@ namespace libdwarf {
|
||||
// sorted range entries for dies
|
||||
template<
|
||||
typename T,
|
||||
typename std::enable_if<std::is_trivially_copyable<T>::value && sizeof(T) <= 16, int>::type = 0
|
||||
typename std::enable_if<
|
||||
// old gcc doesn't support this trait https://godbolt.org/z/fKWT9jTK7
|
||||
#if !(defined(__GNUC__) && (__GNUC__ < 5))
|
||||
std::is_trivially_copyable<T>::value &&
|
||||
#endif
|
||||
sizeof(T) <= 16,
|
||||
int
|
||||
>::type = 0
|
||||
>
|
||||
class die_cache {
|
||||
public:
|
||||
|
||||
@ -24,6 +24,13 @@
|
||||
#define NODISCARD
|
||||
#endif
|
||||
|
||||
// workaround a bizarre gcc bug https://godbolt.org/z/s78vnf7jv
|
||||
// https://github.com/jeremy-rifkin/cpptrace/issues/220
|
||||
#if defined(__GNUC__) && (__GNUC__ < 7)
|
||||
#undef NODISCARD
|
||||
#define NODISCARD
|
||||
#endif
|
||||
|
||||
#if IS_MSVC
|
||||
#define MSVC_CDECL __cdecl
|
||||
#else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user