[common] crash: fix Linux compilation with -DENABLE_BACKTRACE=NO

Essentially, debug.h defines printTrace as an empty macro when the macro
ENABLE_BACKTRACE is not defined, breaking the compilation of crash.c.

Fixed by defining a private macro for debug.h only to avoid clashing.
This commit is contained in:
Quantum 2021-02-28 19:14:17 -05:00 committed by Geoffrey McRae
parent f2c0b8c0b4
commit b00c25a822

View file

@ -31,8 +31,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#ifdef ENABLE_BACKTRACE #ifdef ENABLE_BACKTRACE
void printBacktrace(void); void printBacktrace(void);
#define DEBUG_PRINT_BACKTRACE() printBacktrace()
#else #else
#define printBacktrace #define DEBUG_PRINT_BACKTRACE()
#endif #endif
#if defined(_WIN32) && !defined(__GNUC__) #if defined(_WIN32) && !defined(__GNUC__)
@ -76,7 +77,7 @@ void printBacktrace(void);
#define DEBUG_FATAL(fmt, ...) do { \ #define DEBUG_FATAL(fmt, ...) do { \
DEBUG_BREAK(); \ DEBUG_BREAK(); \
DEBUG_PRINT("[!]", fmt, ##__VA_ARGS__); \ DEBUG_PRINT("[!]", fmt, ##__VA_ARGS__); \
printBacktrace(); \ DEBUG_PRINT_BACKTRACE(); \
abort(); \ abort(); \
} while(0) } while(0)