Skip to content

Commit 61b7ee3

Browse files
committed
main: make ASSERT_FUNCTION available always
1 parent acbd555 commit 61b7ee3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

main/debug.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
* Macros
2525
*/
2626

27+
#if defined _MSC_VER
28+
/* See https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros */
29+
# define ASSERT_FUNCTION __FUNCTION__
30+
#elif defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
31+
# define ASSERT_FUNCTION __func__
32+
#else
33+
# define ASSERT_FUNCTION ((const char*)0)
34+
#endif
35+
2736
#ifdef DEBUG
2837
# define debug(level) ((ctags_debugLevel & (long)(level)) != 0)
2938
# define DebugStatement(x) x
@@ -33,11 +42,6 @@
3342
# define AssertNotReached() do {} while(0)
3443
# else
3544
/* We expect cc supports c99 standard. */
36-
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
37-
# define ASSERT_FUNCTION __func__
38-
# else
39-
# define ASSERT_FUNCTION ((const char*)0)
40-
# endif
4145
# define Assert(c) ((c) ? ((void)0) : debugAssert(#c, __FILE__, __LINE__, ASSERT_FUNCTION))
4246
# define AssertNotReached() Assert(!"The control reaches unexpected place")
4347
# endif

0 commit comments

Comments
 (0)