Daiki Ueno <[email protected]>: 
> Miguel Ángel <[email protected]> writes:
> 
> > Daiki Ueno <[email protected]> writes: 
> >> Please note that some files are shared among gnulib and gettext.  For
> >> maintenance, minimizing the local changes would be more important.
> >
> > You are right, I am reverting it (with GI changed to GT)
> 
> By the way, changes to vas{,n}printf.h seems not needed here because
> they are not public headers exported from libasprintf.

It is not the same patch as gnulib, because I preserved GCC 2.5 and 2.6
compatibility. v*printf changes has been removed.

Best regards,
Miguel

>From 9bed973a4a13d7dcbea05b6849000a290a02f693 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?= <[email protected]>
Date: Sun, 3 Mar 2013 03:19:03 +0100
Subject: [PATCH] Do not define __attribute__ in header files.

Fix Savannah bug #35313.
---
 gettext-runtime/libasprintf/ChangeLog        |    6 ++++++
 gettext-runtime/libasprintf/autosprintf.in.h |   18 ++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/gettext-runtime/libasprintf/ChangeLog b/gettext-runtime/libasprintf/ChangeLog
index 14ae717..faf8d8c 100644
--- a/gettext-runtime/libasprintf/ChangeLog
+++ b/gettext-runtime/libasprintf/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-05  Miguel Angel Arruga Vivas  <[email protected]>  (tiny change)
+
+	Fix '__attribute__' definition.
+	Reported at https://savannah.gnu.org/bugs/?35313
+	* autosprintf.in.h (__attribute__): Enclosed between checking.
+
 2013-03-04  Miguel Angel Arruga Vivas  <[email protected]>  (tiny change)
 
 	Add 'autosprintf::operator='. Needed because destructor
diff --git a/gettext-runtime/libasprintf/autosprintf.in.h b/gettext-runtime/libasprintf/autosprintf.in.h
index 1efd15a..0be942e 100644
--- a/gettext-runtime/libasprintf/autosprintf.in.h
+++ b/gettext-runtime/libasprintf/autosprintf.in.h
@@ -17,17 +17,18 @@
 #ifndef _AUTOSPRINTF_H
 #define _AUTOSPRINTF_H
 
-#ifndef __attribute__
 /* This feature is available in gcc versions 2.5 and later.  */
-# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
-#  define __attribute__(Spec) /* empty */
-# endif
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
+# define _GT_AUTOSPRINTF_FORMAT() /* empty */
+#else
 /* The __-protected variants of 'format' and 'printf' attributes
    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
-#  define __format__ format
-#  define __printf__ printf
-# endif
+#  define _GT_AUTOSPRINTF_FORMAT() \
+  __attribute__ ((__format__ (__printf__, 2, 3))
+# else
+#  define _GT_AUTOSPRINTF_FORMAT() \
+  __attribute__ ((format (printf, 2, 3))
 #endif
 
 #include <string>
@@ -42,7 +43,8 @@ namespace gnu
   public:
     /* Constructor: takes a format string and the printf arguments.  */
     autosprintf (const char *format, ...)
-                __attribute__ ((__format__ (__printf__, 2, 3)));
+                 _GT_ATTRIBUTE_FORMAT();
+
     /* Copy constructor.  */
     autosprintf (const autosprintf& src);
     autosprintf& operator = (autosprintf copy);
-- 
1.7.10.4

Reply via email to