From 8482682061ea09b3900d9e0d6adda8bba1deb543 Mon Sep 17 00:00:00 2001 From: Arthur Williams Date: Sat, 23 Jul 2022 15:03:21 -0700 Subject: [PATCH] Define __TCC_BACKTRACE_ENABLED__ if backtrace is enabled If the `-btN` was specified, then the __TCC_BACKTRACE_ENABLED__ macro will be defined. This provides a way for user code to tell if tcc_backtrace is defined or not. --- tccpp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tccpp.c b/tccpp.c index 6a86f097..31c3a2b3 100644 --- a/tccpp.c +++ b/tccpp.c @@ -3756,6 +3756,10 @@ static void tcc_predefs(TCCState *s1, CString *cs, int is_asm) #ifdef CONFIG_TCC_BCHECK if (s1->do_bounds_check) putdef(cs, "__BOUNDS_CHECKING_ON"); +#endif +#ifdef CONFIG_TCC_BACKTRACE + if (s1->do_backtrace) + putdef(cs, "__TCC_BACKTRACE_ENABLED__"); #endif cstr_printf(cs, "#define __SIZEOF_POINTER__ %d\n", PTR_SIZE); cstr_printf(cs, "#define __SIZEOF_LONG__ %d\n", LONG_SIZE);