genattr.c: Include stdarg.h/varargs.h.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Mon, 11 May 1998 06:50:51 +0000 (06:50 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Mon, 11 May 1998 06:50:51 +0000 (06:50 +0000)
        * genattr.c: Include stdarg.h/varargs.h.  Change function
        `fatal' to use variable arguments instead of faking it with
        integer parameters.  Provide a prototype which also
        checks the format specifiers using ATTRIBUTE_PRINTF_1.
        * genattrtab.c: Likewise.
        * gencodes.c: Likewise.
        * genconfig.c: Likewise.
        * genemit.c: Likewise.
        * genextract.c: Likewise.
        * genflags.c: Likewise.
        * genopinit.c: Likewise.
        * genpeep.c: Likewise.
        * genrecog.c: Likewise.
        * genoutput.c: Likewise.  Similarly for function `error'.

From-SVN: r19661

12 files changed:
gcc/ChangeLog
gcc/genattr.c
gcc/genattrtab.c
gcc/gencodes.c
gcc/genconfig.c
gcc/genemit.c
gcc/genextract.c
gcc/genflags.c
gcc/genopinit.c
gcc/genoutput.c
gcc/genpeep.c
gcc/genrecog.c

index 3c0e208..99d6cc9 100644 (file)
@@ -1,3 +1,21 @@
+Mon May 11 09:33:10 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+        * genattr.c: Include stdarg.h/varargs.h.  Change function
+       `fatal' to use variable arguments instead of faking it with
+       integer parameters.  Provide a prototype which also
+        checks the format specifiers using ATTRIBUTE_PRINTF_1.
+
+        * genattrtab.c: Likewise.
+        * gencodes.c: Likewise.
+        * genconfig.c: Likewise.
+        * genemit.c: Likewise.
+        * genextract.c: Likewise.
+        * genflags.c: Likewise.
+        * genopinit.c: Likewise.
+        * genpeep.c: Likewise.
+        * genrecog.c: Likewise.
+        * genoutput.c: Likewise.  Similarly for function `error'.
+
 Sun May 10 02:27:03 1998  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * acconfig.h (HAVE_VOLATILE): Insert stub for autoconf.
index 58e9930..c50e0fd 100644 (file)
@@ -21,6 +21,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -32,7 +37,7 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
@@ -221,11 +226,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genattr: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index a1538f2..5b73f95 100644 (file)
@@ -96,7 +96,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
-/* varargs must always be included after *config.h.  */
+/* varargs must always be included after *config.h, but before stdio.h.  */
 #ifdef __STDC__
 #include <stdarg.h>
 #else
@@ -125,7 +125,7 @@ struct obstack *temp_obstack = &obstack2;
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* enough space to reserve for printing out ints */
@@ -5769,12 +5769,22 @@ copy_rtx_unchanging (orig)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
-     char *a1, *a2;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genattrtab: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index c74ae0a..a3aa1fe 100644 (file)
@@ -23,6 +23,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -34,7 +39,7 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
@@ -79,11 +84,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "gencodes: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index ce85c7a..b01a24b 100644 (file)
@@ -21,6 +21,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -50,7 +55,7 @@ static int clobbers_seen_this_insn;
 static int dup_operands_seen_this_insn;
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 static void walk_insn_part PROTO((rtx, int, int));
@@ -268,11 +273,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genconfig: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index d389471..86d7a42 100644 (file)
@@ -20,6 +20,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -31,7 +36,7 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
@@ -702,11 +707,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genemit: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index 574a8f3..288b32b 100644 (file)
@@ -20,6 +20,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -100,7 +105,7 @@ static void walk_rtx PROTO ((rtx, char *));
 static void print_path PROTO ((char *));
 char *xmalloc PROTO ((unsigned));
 char *xrealloc PROTO ((char *, unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 static char *copystr PROTO ((char *));
 static void mybzero ();
 void fancy_abort PROTO ((void));
@@ -362,11 +367,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genextract: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index 9a21ef0..d389a73 100644 (file)
@@ -23,6 +23,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -34,7 +39,7 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* Names for patterns.  Need to allow linking with print-rtl.  */
@@ -199,11 +204,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genflags: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index fad3695..a31a444 100644 (file)
@@ -20,6 +20,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -31,7 +36,7 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 /* Many parts of GCC use arrays that are indexed by machine mode and
@@ -304,11 +309,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genopinit: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index 490ecb4..9f40c85 100644 (file)
@@ -91,6 +91,11 @@ It would not make an case in output_insn_hairy because the template
 given in the entry is a constant (it does not start with `*').  */
 \f
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -108,9 +113,9 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_free free
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
-static void error ();
+static void error PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 static void mybcopy ();
 static void mybzero ();
 static int n_occurrences PROTO((int, char *));
@@ -922,11 +927,22 @@ mybcopy (b1, b2, length)
 }
 
 static void
-fatal (s, a1, a2, a3, a4)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genoutput: ");
-  fprintf (stderr, s, a1, a2, a3, a4);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
@@ -941,11 +957,22 @@ fancy_abort ()
 }
 
 static void
-error (s, a1, a2)
-     char *s;
+error VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genoutput: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
 
   have_error = 1;
index 805e9ef..fd39398 100644 (file)
@@ -20,6 +20,11 @@ Boston, MA 02111-1307, USA.  */
 
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -47,7 +52,7 @@ struct link
 };
 
 char *xmalloc PROTO((unsigned));
-static void fatal ();
+static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1;
 void fancy_abort PROTO((void));
 
 static int max_opno;
@@ -407,11 +412,22 @@ xrealloc (ptr, size)
 }
 
 static void
-fatal (s, a1, a2)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genpeep: ");
-  fprintf (stderr, s, a1, a2);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   exit (FATAL_EXIT_CODE);
 }
index 21a5abd..5fc90f3 100644 (file)
@@ -47,6 +47,11 @@ Boston, MA 02111-1307, USA.  */
    it returns the split rtl in a SEQUENCE.  */
 
 #include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
@@ -191,7 +196,7 @@ static void change_state    PROTO((char *, char *, int));
 static char *copystr           PROTO((char *));
 static void mybzero            PROTO((char *, unsigned));
 static void mybcopy            PROTO((char *, char *, unsigned));
-static void fatal              PROTO((char *));
+static void fatal              PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
 char *xrealloc                 PROTO((char *, unsigned));
 char *xmalloc                  PROTO((unsigned));
 void fancy_abort               PROTO((void));
@@ -1669,11 +1674,22 @@ xmalloc (size)
 }
 
 static void
-fatal (s)
-     char *s;
+fatal VPROTO ((char *format, ...))
 {
+#ifndef __STDC__
+  char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef __STDC__
+  format = va_arg (ap, char *);
+#endif
+
   fprintf (stderr, "genrecog: ");
-  fprintf (stderr, s);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
   fprintf (stderr, "\n");
   fprintf (stderr, "after %d definitions\n", next_index);
   exit (FATAL_EXIT_CODE);