]> Dogcows Code - chaz/tar/commitdiff
tar: port wordsplit attribute to Sun C
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Jan 2015 04:07:34 +0000 (20:07 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Jan 2015 04:09:09 +0000 (20:09 -0800)
Reported by Ted Carr in:
http://lists.gnu.org/archive/html/bug-tar/2015-01/msg00002.html
* lib/wordsplit.h (__WORDSPLIT_ATTRIBUTE_FORMAT):
New macro, taken from Gnulib.
(struct wordsplit): Use it.
* lib/wordsplit.c (_wsplt_error): Use it.

lib/wordsplit.c
lib/wordsplit.h

index 21807cdb8df3cfa5a15ce0d661143fdb9476e4c6..bda64d31f9bdca8dd3b2e35916d9b997caba9960 100644 (file)
@@ -61,7 +61,7 @@ _wsplt_alloc_die (struct wordsplit *wsp)
   abort ();
 }
 
-static void __attribute__ ((__format__ (__printf__, 1, 2)))
+static void __WORDSPLIT_ATTRIBUTE_FORMAT ((__printf__, 1, 2))
 _wsplt_error (const char *fmt, ...)
 {
   va_list ap;
index d64cf2f7719bc91b20f25795c04295cb74a4a260..25d556d98c3499c05e40268ed0bf6fcf2e26bd85 100644 (file)
 
 #include <stddef.h>
 
+#if 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define __WORDSPLIT_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define __WORDSPLIT_ATTRIBUTE_FORMAT(spec) /* empty */
+#endif
+
 struct wordsplit
 {
   size_t ws_wordc;
@@ -34,9 +40,9 @@ struct wordsplit
   const char *ws_escape;
   void (*ws_alloc_die) (struct wordsplit * wsp);
   void (*ws_error) (const char *, ...)
-                   __attribute__ ((__format__ (__printf__, 1, 2)));
+    __WORDSPLIT_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
   void (*ws_debug) (const char *, ...)
-                   __attribute__ ((__format__ (__printf__, 1, 2)));
+    __WORDSPLIT_ATTRIBUTE_FORMAT ((__printf__, 1, 2));
 
   const char **ws_env;
   const char *(*ws_getvar) (const char *, size_t, void *);
This page took 0.022373 seconds and 4 git commands to generate.