From 2e3ed95338363702b40995c96faeed5fe33f5725 Mon Sep 17 00:00:00 2001 From: James R Date: Tue, 14 Feb 2023 04:10:58 -0800 Subject: [PATCH] Add assert command to test whether assertions are enabled at runtime --- src/d_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 38c16bc39..2e3f70980 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1196,6 +1196,15 @@ const char *D_GetFancyBranchName(void) return compbranch; } +static void Command_assert(void) +{ +#if !defined(NDEBUG) || defined(PARANOIA) + CONS_Printf("Yes, assertions are enabled.\n"); +#else + CONS_Printf("No, ssertions are NOT enabled.\n"); +#endif +} + // // D_SRB2Main // @@ -1387,6 +1396,8 @@ void D_SRB2Main(void) // Do this up here so that WADs loaded through the command line can use ExecCfg COM_Init(); + COM_AddCommand("assert", Command_assert); + #ifndef TESTERS // add any files specified on the command line with -file wadfile // to the wad list