Better support cross-compiling. Patch #19003.
[pspp-builds.git] / src / language / lexer / q2c.c
index 0b21afbaeed2f208668d4fe345150635c06e2390..f187d2427faa283eef324a2c3ba09159468b0e54 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA. */
 
-#include <config.h>
-
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#include <time.h>
+#include <stdbool.h>
+#include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#include <libpspp/assertion.h>
-#include <libpspp/compiler.h>
-#include <libpspp/str.h>
-#include "exit.h"
 
-     
+/* GNU C allows the programmer to declare that certain functions take
+   printf-like arguments, never return, etc.  Conditionalize these
+   declarations on whether gcc is in use. */
+#if __GNUC__ > 1
+#define ATTRIBUTE(X) __attribute__ (X)
+#else
+#define ATTRIBUTE(X)
+#endif
+
+/* Marks a function argument as possibly not used. */
+#define UNUSED ATTRIBUTE ((unused))
+
+/* Marks a function that will never return. */
+#define NO_RETURN ATTRIBUTE ((noreturn))
+
+/* Mark a function as taking a printf- or scanf-like format
+   string as its FMT'th argument and that the FIRST'th argument
+   is the first one to be checked against the format string. */
+#define PRINTF_FORMAT(FMT, FIRST) ATTRIBUTE ((format (__printf__, FMT, FIRST)))
+
 /* Max length of an input line. */
 #define MAX_LINE_LEN 1024
 
@@ -1321,7 +1335,7 @@ dump_vars_init (int persistent)
                break;
 
              default:
-               NOT_REACHED ();
+               abort ();
              }
          }
       }
@@ -1875,18 +1889,10 @@ dump_parser (int persistent)
 static void
 dump_header (void)
 {
-  time_t curtime;
-  struct tm *loctime;
-  char *timep;
-
   indent = 0;
-  curtime = time (NULL);
-  loctime = localtime (&curtime);
-  timep = asctime (loctime);
-  timep[strlen (timep) - 1] = 0;
   dump (0,   "/* %s\t\t-*- mode: c; buffer-read-only: t -*-", ofn);
   dump (0, nullstr);
-  dump (0, "   Generated by q2c from %s on %s.", ifn, timep);
+  dump (0, "   Generated by q2c from %s.", ifn);
   dump (0, "   Do not modify!");
   dump (0, " */");
 }