From: Richard Kenner Date: Thu, 10 Feb 1994 13:07:10 +0000 (-0500) Subject: If __STDC__, include gstdarg and use ANSI form of varargs. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f90e4a0f7084a911114061d22a7098a295f9bec;p=gcc.git If __STDC__, include gstdarg and use ANSI form of varargs. From-SVN: r6514 --- diff --git a/gcc/bc-emit.c b/gcc/bc-emit.c index 9497c7e5b0f..596209fee6c 100644 --- a/gcc/bc-emit.c +++ b/gcc/bc-emit.c @@ -1,5 +1,5 @@ /* Output bytecodes for GNU C-compiler. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 1994 Free Software Foundation, Inc. This file is part of GNU CC. @@ -19,7 +19,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "config.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif #include "machmode.h" #include "rtl.h" #include "real.h" @@ -906,18 +910,21 @@ bc_emit_bytecode (bytecode) of literal values in the call. First argument is the instruction, the remaining arguments are literals of size HOST_WIDE_INT or smaller. */ void -bc_emit_instruction (va_alist) - va_dcl +bc_emit_instruction VPROTO((enum bytecode_opcode opcode, ...)) { - va_list arguments; +#ifndef __STDC__ enum bytecode_opcode opcode; +#endif + va_list arguments; int nliteral, instruction; + VA_START (arguments, opcode); - va_start (arguments); +#ifndef __STDC__ + opcode = va_arg (arguments, enum bytecode_opcode); +#endif /* Emit instruction bytecode */ - opcode = va_arg (arguments, enum bytecode_opcode); bc_emit_bytecode (opcode); instruction = (int) opcode; diff --git a/gcc/calls.c b/gcc/calls.c index 467f124f4ea..898272db807 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -22,7 +22,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "tree.h" #include "flags.h" #include "expr.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif #include "insn-flags.h" /* Decide whether a function's arguments should be processed @@ -2069,19 +2073,22 @@ expand_call (exp, target, ignore) move memory references across the non-const call. */ void -emit_library_call (va_alist) - va_dcl +emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode, + int nargs, ...)) { +#ifndef __STDC__ + rtx orgfun; + int no_queue; + enum machine_mode outmode; + int nargs; +#endif va_list p; /* Total size in bytes of all the stack-parms scanned so far. */ struct args_size args_size; /* Size of arguments before any adjustments (such as rounding). */ struct args_size original_args_size; register int argnum; - enum machine_mode outmode; - int nargs; rtx fun; - rtx orgfun; int inc; int count; rtx argblock = 0; @@ -2090,16 +2097,20 @@ emit_library_call (va_alist) struct args_size offset; struct args_size size; }; struct arg *argvec; int old_inhibit_defer_pop = inhibit_defer_pop; - int no_queue = 0; rtx use_insns; /* library calls are never indirect calls. */ int current_call_is_indirect = 0; - va_start (p); - orgfun = fun = va_arg (p, rtx); + VA_START (p, nargs); + +#ifndef __STDC__ + orgfun = va_arg (p, rtx); no_queue = va_arg (p, int); outmode = va_arg (p, enum machine_mode); nargs = va_arg (p, int); +#endif + + fun = orgfun; /* Copy all the libcall-arguments out of the varargs data and into a vector ARGVEC. @@ -2338,19 +2349,23 @@ emit_library_call (va_alist) If VALUE is nonzero, VALUE is returned. */ rtx -emit_library_call_value (va_alist) - va_dcl +emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue, + enum machine_mode outmode, int nargs, ...)) { +#ifndef __STDC__ + rtx orgfun; + rtx value; + int no_queue; + enum machine_mode outmode; + int nargs; +#endif va_list p; /* Total size in bytes of all the stack-parms scanned so far. */ struct args_size args_size; /* Size of arguments before any adjustments (such as rounding). */ struct args_size original_args_size; register int argnum; - enum machine_mode outmode; - int nargs; rtx fun; - rtx orgfun; int inc; int count; rtx argblock = 0; @@ -2359,21 +2374,24 @@ emit_library_call_value (va_alist) struct args_size offset; struct args_size size; }; struct arg *argvec; int old_inhibit_defer_pop = inhibit_defer_pop; - int no_queue = 0; rtx use_insns; - rtx value; rtx mem_value = 0; int pcc_struct_value = 0; int struct_value_size = 0; /* library calls are never indirect calls. */ int current_call_is_indirect = 0; - va_start (p); - orgfun = fun = va_arg (p, rtx); + VA_START (p, nargs); + +#ifndef __STDC__ + orgfun = va_arg (p, rtx); value = va_arg (p, rtx); no_queue = va_arg (p, int); outmode = va_arg (p, enum machine_mode); nargs = va_arg (p, int); +#endif + + fun = orgfun; /* If this kind of value comes back in memory, decide where in memory it should come back. */ diff --git a/gcc/combine.c b/gcc/combine.c index 25f02970238..9c411a7a2ee 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -74,7 +74,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ combine anyway. */ #include "config.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif /* Must precede rtl.h for FFS. */ #include @@ -398,7 +402,8 @@ static rtx simplify_shift_const PROTO((rtx, enum rtx_code, enum machine_mode, rtx, int)); static int recog_for_combine PROTO((rtx *, rtx, rtx *)); static rtx gen_lowpart_for_combine PROTO((enum machine_mode, rtx)); -static rtx gen_rtx_combine (); /* This is varargs. */ +static rtx gen_rtx_combine PROTO((enum rtx_code code, enum machine_mode mode, + ...)); static rtx gen_binary PROTO((enum rtx_code, enum machine_mode, rtx, rtx)); static rtx gen_unary PROTO((enum rtx_code, enum machine_mode, rtx)); @@ -8293,21 +8298,26 @@ gen_lowpart_for_combine (mode, x) /*VARARGS2*/ static rtx -gen_rtx_combine (va_alist) - va_dcl +gen_rtx_combine VPROTO((enum rtx_code code, enum machine_mode mode, ...)) { - va_list p; +#ifndef __STDC__ enum rtx_code code; enum machine_mode mode; +#endif + va_list p; int n_args; rtx args[3]; int i, j; char *fmt; rtx rt; - va_start (p); + VA_START (p, mode); + +#ifndef __STDC__ code = va_arg (p, enum rtx_code); mode = va_arg (p, enum machine_mode); +#endif + n_args = GET_RTX_LENGTH (code); fmt = GET_RTX_FORMAT (code); diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 65b45e44e00..382960c0351 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -34,7 +34,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ is the kind of rtx's they make and what arguments they use. */ #include "config.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif #include "rtl.h" #include "tree.h" #include "flags.h" @@ -277,19 +281,23 @@ extern int max_stack_depth; /*VARARGS2*/ rtx -gen_rtx (va_alist) - va_dcl +gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...)) { - va_list p; +#ifndef __STDC__ enum rtx_code code; enum machine_mode mode; +#endif + va_list p; register int i; /* Array indices... */ register char *fmt; /* Current rtx's format... */ register rtx rt_val; /* RTX to return to caller... */ - va_start (p); + VA_START (p, mode); + +#ifndef __STDC__ code = va_arg (p, enum rtx_code); mode = va_arg (p, enum machine_mode); +#endif if (code == CONST_INT) { @@ -397,20 +405,26 @@ gen_rtx (va_alist) /*VARARGS1*/ rtvec -gen_rtvec (va_alist) - va_dcl +gen_rtvec VPROTO((int n, ...)) { - int n, i; +#ifndef __STDC__ + int n; +#endif + int i; va_list p; rtx *vector; - va_start (p); + VA_START (p, n); + +#ifndef __STDC__ n = va_arg (p, int); +#endif if (n == 0) return NULL_RTVEC; /* Don't allocate an empty rtvec... */ vector = (rtx *) alloca (n * sizeof (rtx)); + for (i = 0; i < n; i++) vector[i] = va_arg (p, rtx); va_end (p); diff --git a/gcc/final.c b/gcc/final.c index 76bbc365449..d4b34b2915a 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1,5 +1,5 @@ /* Convert RTL to assembler code and output it, for GNU compiler. - Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 92, 93, 1994 Free Software Foundation, Inc. This file is part of GNU CC. @@ -44,7 +44,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ FUNCTION_EPILOGUE. Those instructions never exist as rtl. */ #include "config.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif #include "tree.h" #include "rtl.h" #include "regs.h" @@ -2679,19 +2683,24 @@ output_addr_const (file, x) We handle alternate assembler dialects here, just like output_asm_insn. */ void -asm_fprintf (va_alist) - va_dcl +asm_fprintf VPROTO((FILE *file, char *p, ...)) { - va_list argptr; +#ifndef __STDC__ FILE *file; + char *p; +#endif + va_list argptr; char buf[10]; - char *p, *q, c; + char *q, c; int i; - va_start (argptr); + VA_START (argptr, p); + +#ifndef __STDC__ + file = va_arg (argptr, FILE*); + p = va_arg (argptr, char*); +#endif - file = va_arg (argptr, FILE *); - p = va_arg (argptr, char *); buf[0] = '%'; while (c = *p++) diff --git a/gcc/gcc.c b/gcc/gcc.c index 101ecf7c022..eef27501a2a 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -38,7 +38,11 @@ compilation is specified by a string called a "spec". */ #include "config.h" #include "obstack.h" +#ifdef __STDC__ +#include "gstdarg.h" +#else #include "gvarargs.h" +#endif #include #ifndef R_OK @@ -4178,14 +4182,19 @@ fancy_abort () /* Output an error message and exit */ static void -fatal (va_alist) - va_dcl +fatal VPROTO((char *format, ...)) { - va_list ap; +#ifndef __STDC__ char *format; +#endif + va_list ap; + + VA_START (ap, format); + +#ifndef __STDC__ + format = va_arg (ap, char*); +#endif - va_start (ap); - format = va_arg (ap, char *); fprintf (stderr, "%s: ", programname); vfprintf (stderr, format, ap); va_end (ap); @@ -4195,14 +4204,19 @@ fatal (va_alist) } static void -error (va_alist) - va_dcl +error VPROTO((char *format, ...)) { - va_list ap; +#ifndef __STDC__ char *format; +#endif + va_list ap; + + VA_START (ap, format); + +#ifndef __STDC__ + format = va_arg (ap, char*); +#endif - va_start (ap); - format = va_arg (ap, char *); fprintf (stderr, "%s: ", programname); vfprintf (stderr, format, ap); va_end (ap);