diff options
| -rw-r--r-- | include/al/array_typed.h | 4 | ||||
| -rw-r--r-- | include/al/lib.h | 11 |
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)) |