]> Savannah Git Hosting - gnulib.git/commitdiff
stdio: limit __gnu_printf__ witness to gcc 4.4+
authorEric Blake <eblake@redhat.com>
Wed, 27 May 2015 03:27:44 +0000 (21:27 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 27 May 2015 03:27:44 +0000 (21:27 -0600)
If we start adding more places that need to conditionally label
functions with __gnu_printf__, it will be nicer if the logic for
determining that gcc even supports that attribute is done once
up front rather than in each caller.

* lib/error.h (_GL_ATTRIBUTE_SPEC_PRINTF): Move gcc version probe...
* m4/stdio_h.m4 (gl_STDIO_H): ...here.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/error.h
m4/stdio_h.m4

index 6ac962272d1415e33a8f11d1777e2be92d66ac0b..a5f6bd07298a028be5a900fef8a14b7e167df775 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2015-05-26  Eric Blake  <eblake@redhat.com>
 
+       stdio: limit __gnu_printf__ witness to gcc 4.4+
+       * lib/error.h (_GL_ATTRIBUTE_SPEC_PRINTF): Move gcc version probe...
+       * m4/stdio_h.m4 (gl_STDIO_H): ...here.
+
        error: use correct printf attributes on mingw
        * lib/stdio.in.h (_GL_ATTRIBUTE_SPEC_PRINTF): New define.
 
index 9e594ced93543295a56b814457ebe2e9c8c33623..eb4fb701753f6d687405d4563ec6b481e5511179 100644 (file)
@@ -34,8 +34,7 @@
 /* On mingw, the flavor of printf depends on whether the extensions module
  * is in use; the check for <stdio.h> determines the witness macro.  */
 #ifndef _GL_ATTRIBUTE_SPEC_PRINTF
-# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU && \
-  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
+# if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
 #  define _GL_ATTRIBUTE_SPEC_PRINTF __gnu_printf__
 # else
 #  define _GL_ATTRIBUTE_SPEC_PRINTF __printf__
index ffaf10c3971ea68ebfb3daecef7dee9525ebb0d8..f60cc2156e00cccbbc135fd4cc3e1d4b63be3fba 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 45
+# stdio_h.m4 serial 46
 dnl Copyright (C) 2007-2015 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -24,7 +24,8 @@ AC_DEFUN([gl_STDIO_H],
        /* For non-mingw systems, compilation will trivially succeed.
           For mingw, compilation will succeed for older mingw (system
           printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */
-       #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+       #if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) && \
+         (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
        extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1];
        #endif
       ]])], [gl_cv_func_printf_attribute_flavor=system],