f/ansify.c uses ANSI features

John David Anglin dave@hiauly1.hia.nrc.ca
Thu Apr 5 13:09:00 GMT 2001


This problem was noted when I attempted to do a full build
under vax ultrix starting with the native compiler.  The file
f/ansify.c contains a number of ANSI features (function declaration
style and stringization of macro tokens).  The file is built with
HOST_CC and thus it must be buildable with non-ANSI compilers.

I have enclosed an untested patch for discussion/review.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-04-05  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* ansify.c (die_unless): Provide definition suitable for cpp that
	doesn't have ANSI # stringizing operator.
	(die, main): Don't use ANSI declaration style.

--- ansify.c.orig	Tue Aug 29 17:39:48 2000
+++ ansify.c	Thu Apr  5 15:41:02 2001
@@ -22,6 +22,7 @@
 #include "hconfig.h"
 #include "system.h"
 
+#ifdef HAVE_STRINGIZE
 #define die_unless(c) \
   do if (!(c)) \
     { \
@@ -29,15 +30,26 @@
       die (); \
     } \
   while(0)
+#else
+#define die_unless(c) \
+  do if (!(c)) \
+    { \
+      fprintf (stderr, "%s:%lu: %s\n", argv[1], lineno, "c"); \
+      die (); \
+    } \
+  while(0)
+#endif
 
 static void ATTRIBUTE_NORETURN
-die (void)
+die ()
 {
   exit (1);
 }
 
 int
-main(int argc, char **argv)
+main (argc, argv)
+     int argc;
+     char **argv;
 {
   int c;
   static unsigned long lineno = 1;



More information about the Gcc-bugs mailing list