]> diplodocus.org Git - nmh/commitdiff
mh.h: Always define NMH_UNUSED as a cast to void.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 3 Sep 2017 14:41:04 +0000 (15:41 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sun, 3 Sep 2017 14:41:04 +0000 (15:41 +0100)
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?

h/mh.h

diff --git a/h/mh.h b/h/mh.h
index abec7c8..7673d2a 100644 (file)
--- 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 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)
 #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 NONNULL(...)
 #define PURE
 #define ENDNULL
-#define NMH_UNUSED(i) i
 #endif
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
 #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
 
 #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)))
 
 /* DIM gives the number of elements in the one-dimensional array a. */
 #define DIM(a) (sizeof (a) / sizeof (*(a)))