From: Paul Eggert Date: Tue, 25 Apr 2017 18:58:30 +0000 (-0700) Subject: parse-datetime: make it standalone X-Git-Tag: v1.0~6242 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=3c53173eda1fd3ae8e974deb494ecc1b355806bf;p=gnulib.git parse-datetime: make it standalone * lib/parse-datetime.y: Include , for va_start etc. (_GL_ATTRIBUTE_FORMAT): New macro. These are needed to get './gnulib-tool --test parse-datetime' to work. --- diff --git a/ChangeLog b/ChangeLog index 27cfacb864..8010a24505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2017-04-25 Paul Eggert + + parse-datetime: make it standalone + * lib/parse-datetime.y: Include , 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 nap.h: Port to native Windows. diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index 7161416c66..598e385cb0 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include @@ -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