]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Enable the format_arg attribute also on clang on Mac OS X.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Jul 2018 21:17:37 +0000 (23:17 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Jul 2018 21:17:37 +0000 (23:17 +0200)
Reported by Tom Tromey <tom@tromey.com>
in <https://lists.gnu.org/archive/html/bug-gettext/2018-07/msg00000.html>.

* gettext-runtime/intl/libgnuintl.in.h (_INTL_MAY_RETURN_STRING_ARG): On macOS,
use attribute __format_arg__ if the compiler is based on clang >= 3.0.

gettext-runtime/intl/libgnuintl.in.h

index 019c6e115ec2f1d75324b5c7b1fb01af9ab2751d..5637fda02de6b5c9a130c78216abc2e9bc5de6a5 100644 (file)
@@ -111,7 +111,7 @@ extern int libintl_version;
 /* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
    its n-th argument literally.  This enables GCC to warn for example about
    printf (gettext ("foo %y")).  */
-#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
+#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && !(defined __clang__ && __clang__ && __clang_major__ >= 3) && defined __cplusplus)
 # define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
 #else
 # define _INTL_MAY_RETURN_STRING_ARG(n)