summaryrefslogtreecommitdiff
path: root/src/include/aplwc_macros.h
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-20 20:54:43 +0000
committerpeter <peter@pmikkelsen.com>2026-08-20 20:54:43 +0000
commit86feda786f115cb4468957f00b8968b986ed7c54 (patch)
tree31228cf73674178764cd6376d483e76212181707 /src/include/aplwc_macros.h
parentf5d445afa10ed7ba03b0ea9a5274f11904220700 (diff)
Get full coverage of aplwc-repl.
This required wrapping malloc so that it can fail under our control. FossilOrigin-Name: a27ccb5f02994393a518419bae15fd26ff0016c734d96350ae2137a1d3c0937c
Diffstat (limited to 'src/include/aplwc_macros.h')
-rw-r--r--src/include/aplwc_macros.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/aplwc_macros.h b/src/include/aplwc_macros.h
new file mode 100644
index 0000000..cf05803
--- /dev/null
+++ b/src/include/aplwc_macros.h
@@ -0,0 +1,20 @@
+#ifndef APLWC_MACROS_H
+#define APLWC_MACROS_H
+
+#define UNUSED_PARAMETER(arg) ((void)arg)
+
+#define NELEM(x) (sizeof(x)/sizeof(x[0]))
+
+#if APLWC_BUILD_TYPE_DEBUG
+ #define ALWAYS(x) ((x) ? 1 : (assert(0), 0))
+ #define NEVER(x) ((x) ? (assert(0), 1) : 0)
+#elif APLWC_BUILD_TYPE_RELEASE
+ #define ALWAYS(x) (X)
+ #define NEVER(X) (X)
+#elif APLWC_BUILD_TYPE_COVERAGE
+ #define ALWAYS(x) (1)
+ #define NEVER(x) (0)
+#endif
+
+
+#endif /* APLWC_MACROS_H */