From: Ralph Corderoy Date: Sun, 3 Sep 2017 14:41:04 +0000 (+0100) Subject: mh.h: Always define NMH_UNUSED as a cast to void. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/1ae25aae44c548a4013866d1d94476160e7dd983 mh.h: Always define NMH_UNUSED as a cast to void. The not-gcc-or-earlier-than-gcc-2 version was the identity function seems unnecessary as what C99 compiler would complain about a cast to void? --- diff --git a/h/mh.h b/h/mh.h index abec7c88..7673d2a8 100644 --- a/h/mh.h +++ b/h/mh.h @@ -39,7 +39,6 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define NONNULL(...) __attribute__((nonnull(__VA_ARGS__))) #define PURE __attribute__((pure)) #define ENDNULL __attribute__((sentinel)) -#define NMH_UNUSED(i) (void) i #else #define NORETURN #define CHECK_PRINTF(fmt, arg) @@ -49,7 +48,6 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define NONNULL(...) #define PURE #define ENDNULL -#define NMH_UNUSED(i) i #endif #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) @@ -60,6 +58,9 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define CHECK_PRINTF(fmt, arg) #endif +/* Silence the compiler's "unused variable" warning. */ +#define NMH_UNUSED(i) (void)i + /* DIM gives the number of elements in the one-dimensional array a. */ #define DIM(a) (sizeof (a) / sizeof (*(a)))