f/ansify.c uses ANSI features

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


> I have enclosed an untested patch for discussion/review.

This is better.  It squelches a couple of warnings when compiled with
`-Wstrict-prototypes -Wmissing-prototypes'.

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): Prototype and don't use ANSI declaration style.

--- ansify.c.orig	Tue Aug 29 17:39:48 2000
+++ ansify.c	Thu Apr  5 16:30:43 2001
@@ -22,6 +22,7 @@
 #include "hconfig.h"
 #include "system.h"
 
+#ifdef HAVE_STRINGIZE
 #define die_unless(c) \
   do if (!(c)) \
     { \
@@ -29,15 +30,30 @@
       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 PARAMS ((void));
 
 static void ATTRIBUTE_NORETURN
-die (void)
+die ()
 {
   exit (1);
 }
 
+extern int main PARAMS ((int, const char *const *));
+
 int
-main(int argc, char **argv)
+main (argc, argv)
+     int argc;
+     const char *const *argv;
 {
   int c;
   static unsigned long lineno = 1;



More information about the Gcc-bugs mailing list