summaryrefslogtreecommitdiff
path: root/include/al
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-12-24 16:47:35 -0500
committerAndrew Opalach <andrew@akon.city> 2024-12-24 16:47:35 -0500
commitbb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21 (patch)
tree48a0c9e4a9fd5b650d0b6c38d811a9cd8fad3a5b /include/al
parente4703b59fe99e57186b8993f46e85295b317d771 (diff)
downloadlibalabaster-bb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21.tar.gz
libalabaster-bb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21.tar.bz2
libalabaster-bb4d5418f2173bf9a2fa1c0be31c3eb9f2025a21.zip
lib: Attempt fix for al_assert_and_return()
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'include/al')
-rw-r--r--include/al/array_typed.h4
-rw-r--r--include/al/lib.h11
2 files changed, 11 insertions, 4 deletions
diff --git a/include/al/array_typed.h b/include/al/array_typed.h
index 2904b33..5c77507 100644
--- a/include/al/array_typed.h
+++ b/include/al/array_typed.h
@@ -7,10 +7,10 @@
#include "macros.h"
-#define AL_EMPTY_DEFAULT_0(FUNC, T, S, ...) FUNC(T, S)
-#define AL_EMPTY_DEFAULT(...) AL_EMPTY_DEFAULT_0(__VA_ARGS__, , )
#define AL_PASTER_EVALUATOR(X, Y) X##_##Y
#define AL_PASTER(X, Y) AL_PASTER_EVALUATOR(X, Y)
+#define AL_EMPTY_DEFAULT_1(FUNC, T, S, ...) FUNC(T, S)
+#define AL_EMPTY_DEFAULT(...) AL_EMPTY_DEFAULT_1(__VA_ARGS__, , )
#define _array(N, ...) AL_PASTER(array, AL_PASTER(N, __VA_ARGS__))
#define _al_array_init(N, ...) AL_PASTER(_array_init, AL_PASTER(N, __VA_ARGS__))
diff --git a/include/al/lib.h b/include/al/lib.h
index 6b72ff9..de5008c 100644
--- a/include/al/lib.h
+++ b/include/al/lib.h
@@ -13,9 +13,16 @@
_Pragma("GCC diagnostic ignored \"-Wunused-function\"")
#define AL_UNUSED_FUNCTION_POP \
_Pragma("GCC diagnostic pop")
+#define AL_UNUSED_VARIABLE_PUSH \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
+#define AL_UNUSED_VARIABLE_POP \
+ _Pragma("GCC diagnostic pop")
#else
#define AL_UNUSED_FUNCTION_PUSH
#define AL_UNUSED_FUNCTION_POP
+#define AL_UNUSED_VARIABLE_PUSH
+#define AL_UNUSED_VARIABLE_POP
#endif
#ifdef AL_USE_STDLIB
@@ -72,11 +79,11 @@ void al_malloc_stats(size_t *current, size_t *peak, size_t *total);
#define al_assert(expr) do { (void)sizeof(expr); } while (0) // NOLINT(bugprone-sizeof-expression)
#endif
-#define al_assert_and_return(expr) \
+#define al_assert_and_return(...) \
AL_MACRO_WRAP \
({ \
al_assert(false); \
- return expr; \
+ return __VA_ARGS__; \
})
#define al_alloc_object(type) (type *)al_calloc(1, sizeof(type))