diff options
author | Jonathan Gray <jsg@jsg.id.au> | 2021-02-06 21:01:10 +1100 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2021-02-07 14:22:39 +1100 |
commit | f527c867a8c6db6d787a0fc30c00415d9c59131e (patch) | |
tree | 64470e5fe2f3dfb11585ea26ef37ba85813cf327 /util.h | |
parent | 183df9e9c2b9e49f14f130fd7a4c0eae8f44288d (diff) | |
download | dtc-f527c867a8c6db6d787a0fc30c00415d9c59131e.zip dtc-f527c867a8c6db6d787a0fc30c00415d9c59131e.tar.gz dtc-f527c867a8c6db6d787a0fc30c00415d9c59131e.tar.bz2 |
util: limit gnu_printf format attribute to gcc >= 4.4.0
The gnu_printf format attribute was introduced in gcc 4.4.0
https://gcc.gnu.org/legacy-ml/gcc-help/2012-02/msg00225.html.
Use the printf format attribute on earlier versions of gcc and clang
(which claims to be gcc 4.2.1 in builtin defines) to fix the build with
gcc 4.2.1.
Fixes: 588a29f ("util: use gnu_printf format attribute")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Message-Id: <20210206100110.75228-1-jsg@jsg.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'util.h')
-rw-r--r-- | util.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -13,10 +13,10 @@ */ #ifdef __GNUC__ -#ifdef __clang__ -#define PRINTF(i, j) __attribute__((format (printf, i, j))) -#else +#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) #define PRINTF(i, j) __attribute__((format (gnu_printf, i, j))) +#else +#define PRINTF(i, j) __attribute__((format (printf, i, j))) #endif #define NORETURN __attribute__((noreturn)) #else |