changeset 38496:472fdb13142f

parse-datetime: make it standalone * lib/parse-datetime.y: Include <stdarg.h>, for va_start etc. (_GL_ATTRIBUTE_FORMAT): New macro. These are needed to get './gnulib-tool --test parse-datetime' to work.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 25 Apr 2017 11:58:30 -0700
parents 0a8461cb40bb
children 69320c65ae46
files ChangeLog lib/parse-datetime.y
diffstat 2 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 23 19:19:35 2017 +0200
+++ b/ChangeLog	Tue Apr 25 11:58:30 2017 -0700
@@ -1,3 +1,10 @@
+2017-04-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+	parse-datetime: make it standalone
+	* lib/parse-datetime.y: Include <stdarg.h>, for va_start etc.
+	(_GL_ATTRIBUTE_FORMAT): New macro.
+	These are needed to get './gnulib-tool --test parse-datetime' to work.
+
 2017-04-23  Bruno Haible  <bruno@clisp.org>
 
 	nap.h: Port to native Windows.
--- a/lib/parse-datetime.y	Sun Apr 23 19:19:35 2017 +0200
+++ b/lib/parse-datetime.y	Tue Apr 25 11:58:30 2017 -0700
@@ -64,6 +64,7 @@
 #include <inttypes.h>
 #include <c-ctype.h>
 #include <limits.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -81,6 +82,18 @@
 # define _STDLIB_H 1
 #endif
 
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The __-protected variants of the attributes 'format' and 'printf' are
+   accepted by gcc versions 2.6.4 (effectively 2.7) and later.
+   Enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because
+   gnulib and libintl do '#define printf __printf__' when they override
+   the 'printf' function.  */
+#if 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */
+#endif
+
 /* Shift A right by B bits portably, by dividing A by 2**B and
    truncating towards minus infinity.  A and B should be free of side
    effects, and B should be in the range 0 <= B <= INT_BITS - 2, where