X-Git-Url: http://git.efficios.com/?p=argpar.git;a=blobdiff_plain;f=argpar%2Fargpar.c;h=82b561ceaae707002f36754c55e828d35b882206;hp=10f6ee8d42e93a780a65ad4c5cf66347d667c42d;hb=143cec42e14e050571be640cb2dfa5c5e0198d59;hpb=1c88181255c1d2516b035f678ae7e6929cb9bf76 diff --git a/argpar/argpar.c b/argpar/argpar.c index 10f6ee8..82b561c 100644 --- a/argpar/argpar.c +++ b/argpar/argpar.c @@ -5,7 +5,6 @@ * Copyright (c) 2020-2021 Simon Marchi */ -#include #include #include #include @@ -22,7 +21,16 @@ #define ARGPAR_ZALLOC(_type) ARGPAR_CALLOC(_type, 1) -#define ARGPAR_ASSERT(_cond) assert(_cond) +#ifdef NDEBUG +/* + * Force usage of the assertion condition to prevent unused variable warnings + * when `assert()` are disabled by the `NDEBUG` definition. + */ +# define ARGPAR_ASSERT(_cond) ((void) sizeof((void) (_cond), 0)) +#else +# include +# define ARGPAR_ASSERT(_cond) assert(_cond) +#endif /* * An argpar iterator.