summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-09-08 12:06:30 -0400
committerAndrew Opalach <andrew@akon.city> 2025-09-08 12:06:30 -0400
commited6fc176a1ef6afd43eaa198c43eb813c3a81d99 (patch)
tree9ffa752b3780c6c5a73b88ab9cace15846b792c1 /include
parenta36cb2f6f9df8e501baf614f8aca9b4bd28e4268 (diff)
downloadlibalabaster-ed6fc176a1ef6afd43eaa198c43eb813c3a81d99.tar.gz
libalabaster-ed6fc176a1ef6afd43eaa198c43eb813c3a81d99.tar.bz2
libalabaster-ed6fc176a1ef6afd43eaa198c43eb813c3a81d99.zip
build: Option for asserts in release builds
- Define NDEBUG in release builds. - loccount -> sloccount. Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include')
-rw-r--r--include/al/lib.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/al/lib.h b/include/al/lib.h
index 73861a8..5e65149 100644
--- a/include/al/lib.h
+++ b/include/al/lib.h
@@ -43,7 +43,13 @@
#include <wchar.h>
#include <stdio.h>
#include <stdarg.h>
+#if !defined AL_DEBUG && defined AL_RELEASE_ASSERTS
+#undef NDEBUG
#include <assert.h>
+#define NDEBUG
+#else
+#include <assert.h>
+#endif
#include <ctype.h>
#ifdef AL_MEMORY_TRACKING
@@ -94,7 +100,7 @@ static inline void *al_realloc(void *ptr, size_t n) { return ptr ? realloc(ptr,
#define al_snprintf snprintf
#define al_vsnprintf vsnprintf
#define al_fflush fflush
-#ifdef AL_DEBUG
+#if defined AL_DEBUG || defined AL_RELEASE_ASSERTS
#define al_assert assert
#else
#define al_assert(expr) do { (void)sizeof(expr); } while (0) // NOLINT(bugprone-sizeof-expression)