Endgame-Analyzer/include/myassert.h

23 lines
580 B
C
Raw Permalink Normal View History

2023-08-06 22:08:34 +02:00
#ifndef DYNAMIC_PROGRAM_MYASSERT_H
#define DYNAMIC_PROGRAM_MYASSERT_H
2023-11-16 16:29:41 +01:00
/**
* @file myassert.h
* This is essentially like the default assert header, but we additionally
* dummy-use the expression in case NDEBUG is defined.
* This ensures that we do not get compiler warnings for variables that are solely
* used in assertions.
* If there are such variables, they will be optimized out in opt-mode anyway.
*/
2023-08-06 22:08:34 +02:00
#ifdef NDEBUG
#define ASSERT(x) do { (void)sizeof(x);} while (0)
#else
2023-11-16 16:20:04 +01:00
2023-08-06 22:08:34 +02:00
#include <assert.h>
2023-11-16 16:20:04 +01:00
2023-08-06 22:08:34 +02:00
#define ASSERT(x) assert(x)
#endif
#endif //DYNAMIC_PROGRAM_MYASSERT_H