debug: defend against renaming of panic using macros
This commit is contained in:
parent
676154d652
commit
c5ed42ccbf
@ -32,6 +32,10 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
add_library(cruft)
|
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)
|
search_libs (BACKTRACE_LIB backtrace execinfo)
|
||||||
|
16
debug.hpp
16
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 {
|
namespace cruft::debug::detail {
|
||||||
void
|
void
|
||||||
panic [[noreturn]] (const char *msg);
|
panic [[noreturn]] (const char *msg);
|
||||||
@ -434,7 +447,7 @@ namespace cruft::debug::detail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
constexpr void
|
constexpr void
|
||||||
panic [[noreturn]] (const char *msg)
|
panic [[noreturn]] (const char *msg)
|
||||||
{
|
{
|
||||||
@ -444,6 +457,7 @@ panic [[noreturn]] (const char *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
inline void
|
inline void
|
||||||
panic [[noreturn]] (const std::string &msg)
|
panic [[noreturn]] (const std::string &msg)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user