util: limit gnu_printf format attribute to gcc >= 4.4.0
PATCH 1/1 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.
--- util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
util.h +3 -3
@@ -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
Signature · 1 line
2.30.0
A message that is not in the archive (sent off-list or not yet received): 20210206100110.75228-1-jsg-pTb1tGJk1dCHXe+LvDLADg@public.gmane.org
David Gibson
AppliedQuoted 9 lines · Jonathan Gray
The
gnu_printfformat 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 <[email protected]>
Applied, thanks.
Quoted 22 lines
--- util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)util.h +3
-3@@ -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
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson