diff --git a/CMakeLists.txt b/CMakeLists.txt index b1c374a5..e66f12ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) ############################################################################### add_library(cruft) +# Preemptively define an identity panic macro so that TCL doens't fuck us over +# by renaming a commonly used symbol. +target_compile_definitions(cruft PUBLIC "-Dpanic=panic") + ############################################################################### search_libs (BACKTRACE_LIB backtrace execinfo) diff --git a/debug.hpp b/debug.hpp index 2d647c25..c2ed0105 100644 --- a/debug.hpp +++ b/debug.hpp @@ -422,6 +422,19 @@ void breakpoint (void); /////////////////////////////////////////////////////////////////////////////// +// We define an identity macro for panic so that TCL and GCC don't decide to +// fuck us over by redefine the symbol. +// +// Apparently this can't be taken care of via a '-Dpanic=panic' argument, +// because it just ignores it for reasons I can't figure out. +#ifdef panic +#undef panic +#endif + +#define panic panic + + +//----------------------------------------------------------------------------- namespace cruft::debug::detail { void panic [[noreturn]] (const char *msg); @@ -434,7 +447,7 @@ namespace cruft::debug::detail { } - +//----------------------------------------------------------------------------- constexpr void panic [[noreturn]] (const char *msg) { @@ -444,6 +457,7 @@ panic [[noreturn]] (const char *msg) } +//----------------------------------------------------------------------------- inline void panic [[noreturn]] (const std::string &msg) {