Protoize.
[gnulib.git] / lib / getdate.y
index 44f2e19..86a3d46 100644 (file)
@@ -5,8 +5,6 @@
 **  a couple of people on Usenet.  Completely overhauled by Rich $alz
 **  <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990.
 **
-**  This grammar has 13 shift/reduce conflicts.
-**
 **  This code is in the public domain and has no copyright.
 */
 
    host does not conform to Posix.  */
 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
 
-#include "getdate.h"
-
 #if defined (STDC_HEADERS) || defined (USG)
 # include <string.h>
 #endif
 
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
+# define __attribute__(x)
+#endif
+
+#ifndef ATTRIBUTE_UNUSED
+# define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+#endif
+
 /* Some old versions of bison generate parsers that use bcopy.
    That loses on systems that don't provide the function, so we have
    to redefine it here.  */
 # define bcopy(from, to, len) memcpy ((to), (from), (len))
 #endif
 
-extern struct tm       *gmtime ();
-extern struct tm       *localtime ();
-extern time_t          mktime ();
-
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
    as well as gratuitiously global symbol names, so we can have multiple
    yacc generated parsers in the same program.  Note that these are only
@@ -172,6 +172,9 @@ static int  yyRelYear;
 
 %}
 
+/* This grammar has 13 shift/reduce conflicts. */
+%expect 13
+
 %union {
     int                        Number;
     enum _MERIDIAN     Meridian;
@@ -441,6 +444,15 @@ o_merid    : /* NULL */
 
 %%
 
+/* Include this file down here because bison inserts code above which
+   may define-away `const'.  We want the prototype for get_date to have
+   the same signature as the function definition does. */
+#include "getdate.h"
+
+extern struct tm       *gmtime ();
+extern struct tm       *localtime ();
+extern time_t          mktime ();
+
 /* Month and day table. */
 static TABLE const MonthDayTable[] = {
     { "january",       tMONTH,  1 },
@@ -467,7 +479,7 @@ static TABLE const MonthDayTable[] = {
     { "thurs",         tDAY, 4 },
     { "friday",                tDAY, 5 },
     { "saturday",      tDAY, 6 },
-    { NULL }
+    { NULL, 0, 0 }
 };
 
 /* Time units table. */
@@ -482,7 +494,7 @@ static TABLE const UnitsTable[] = {
     { "min",           tMINUTE_UNIT,   1 },
     { "second",                tSEC_UNIT,      1 },
     { "sec",           tSEC_UNIT,      1 },
-    { NULL }
+    { NULL, 0, 0 }
 };
 
 /* Assorted relative-time words. */
@@ -507,7 +519,7 @@ static TABLE const OtherTable[] = {
     { "eleventh",      tUNUMBER,       11 },
     { "twelfth",       tUNUMBER,       12 },
     { "ago",           tAGO,   1 },
-    { NULL }
+    { NULL, 0, 0 }
 };
 
 /* The timezone table. */
@@ -592,7 +604,7 @@ static TABLE const TimezoneTable[] = {
     { "nzst",  tZONE,     -HOUR (12) },        /* New Zealand Standard */
     { "nzdt",  tDAYZONE,  -HOUR (12) },        /* New Zealand Daylight */
     { "idle",  tZONE,     -HOUR (12) },        /* International Date Line East */
-    {  NULL  }
+    {  NULL, 0, 0  }
 };
 
 /* Military timezone table. */
@@ -622,7 +634,7 @@ static TABLE const MilitaryTable[] = {
     { "x",     tZONE,  HOUR (-11) },
     { "y",     tZONE,  HOUR (-12) },
     { "z",     tZONE,  HOUR (  0) },
-    { NULL }
+    { NULL, 0, 0 }
 };
 
 \f
@@ -631,7 +643,7 @@ static TABLE const MilitaryTable[] = {
 /* ARGSUSED */
 static int
 yyerror (s)
-     char *s;
+     char *s ATTRIBUTE_UNUSED;
 {
   return 0;
 }
@@ -886,9 +898,7 @@ difftm (a, b)
 }
 
 time_t
-get_date (p, now)
-     const char *p;
-     const time_t *now;
+get_date (const char *p, const time_t *now)
 {
   struct tm tm, tm0, *tmp;
   time_t Start;