Use real line numbers for asserts

Redefine the macros to use __LINE__
This commit is contained in:
PJB3005
2026-02-24 23:15:01 +01:00
parent 0e7339f36b
commit 807ea3e006
2 changed files with 59 additions and 4 deletions
+21
View File
@@ -306,6 +306,8 @@ extern int __OSInIPL;
#endif
#if DEBUG
#if __MWERKS__
#define ASSERTLINE(line, cond) \
((cond) || (OSPanic(__FILE__, line, "Failed assertion " #cond), 0))
@@ -321,6 +323,25 @@ extern int __OSInIPL;
#define ASSERTMSGLINEV(line, cond, ...) \
((cond) || (OSPanic(__FILE__, line, __VA_ARGS__), 0))
#else
#define ASSERTLINE(line, cond) \
((cond) || (OSPanic(__FILE__, __LINE__, "Failed assertion " #cond), 0))
#define ASSERTMSGLINE(line, cond, msg) \
((cond) || (OSPanic(__FILE__, __LINE__, msg), 0))
// This is dumb but we dont have a Metrowerks way to do variadic macros in the macro to make this done in a not scrubby way.
#define ASSERTMSG1LINE(line, cond, msg, arg1) \
((cond) || (OSPanic(__FILE__, __LINE__, msg, arg1), 0))
#define ASSERTMSG2LINE(line, cond, msg, arg1, arg2) \
((cond) || (OSPanic(__FILE__, __LINE__, msg, arg1, arg2), 0))
#define ASSERTMSGLINEV(line, cond, ...) \
((cond) || (OSPanic(__FILE__, __LINE__, __VA_ARGS__), 0))
#endif
#else
#define ASSERTLINE(line, cond) (void)0
#define ASSERTMSGLINE(line, cond, msg) (void)0