From: Ralph Corderoy Date: Sun, 3 Sep 2017 14:38:44 +0000 (+0100) Subject: mh.h: Move the gcc-4.3-conditional macro definitions. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/3e7c0fe01050063cd415e667e7b99f537d41f689?ds=sidebyside mh.h: Move the gcc-4.3-conditional macro definitions. Having them outside of the gcc-2 ones makes the logic easier to follow as there's no nesting. --- diff --git a/h/mh.h b/h/mh.h index 6d6bc40c..abec7c88 100644 --- a/h/mh.h +++ b/h/mh.h @@ -33,13 +33,6 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ /* If we're using gcc then tell it extra information so it can do more * compile-time checks. */ #if __GNUC__ > 2 -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) -#define ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__))) -#define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) -#else /* gcc < 4.3.0 */ -#define ALLOC_SIZE(...) -#define CHECK_PRINTF(fmt, arg) -#endif /* gcc < 4.3.0 */ #define NORETURN __attribute__((__noreturn__)) #define CONST __attribute__((const)) #define MALLOC __attribute__((malloc)) @@ -59,6 +52,14 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ #define NMH_UNUSED(i) i #endif +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) +#define ALLOC_SIZE(...) __attribute__((alloc_size(__VA_ARGS__))) +#define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) +#else +#define ALLOC_SIZE(...) +#define CHECK_PRINTF(fmt, arg) +#endif + /* DIM gives the number of elements in the one-dimensional array a. */ #define DIM(a) (sizeof (a) / sizeof (*(a)))