Discussion:
[PATCH] parse-datetime: make it standalone
(too old to reply)
Paul Eggert
2017-04-25 18:59:06 UTC
Permalink
Raw Message
* 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.
---
ChangeLog | 7 +++++++
lib/parse-datetime.y | 13 +++++++++++++
2 files changed, 20 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 27cfacb..8010a24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-04-25 Paul 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 <***@clisp.org>

nap.h: Port to native Windows.
diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y
index 7161416..598e385 100644
--- a/lib/parse-datetime.y
+++ b/lib/parse-datetime.y
@@ -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
--
2.9.3
Loading...