If __STDC__, include gstdarg and use ANSI form of varargs.

From-SVN: r6514
This commit is contained in:
Richard Kenner 1994-02-10 08:07:10 -05:00
parent 6c1e249352
commit 4f90e4a0f7
6 changed files with 126 additions and 54 deletions

View File

@ -1,5 +1,5 @@
/* Output bytecodes for GNU C-compiler. /* 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. 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" #include "config.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
#include "machmode.h" #include "machmode.h"
#include "rtl.h" #include "rtl.h"
#include "real.h" #include "real.h"
@ -906,18 +910,21 @@ bc_emit_bytecode (bytecode)
of literal values in the call. First argument is the instruction, the of literal values in the call. First argument is the instruction, the
remaining arguments are literals of size HOST_WIDE_INT or smaller. */ remaining arguments are literals of size HOST_WIDE_INT or smaller. */
void void
bc_emit_instruction (va_alist) bc_emit_instruction VPROTO((enum bytecode_opcode opcode, ...))
va_dcl
{ {
va_list arguments; #ifndef __STDC__
enum bytecode_opcode opcode; enum bytecode_opcode opcode;
#endif
va_list arguments;
int nliteral, instruction; int nliteral, instruction;
VA_START (arguments, opcode);
va_start (arguments); #ifndef __STDC__
opcode = va_arg (arguments, enum bytecode_opcode);
#endif
/* Emit instruction bytecode */ /* Emit instruction bytecode */
opcode = va_arg (arguments, enum bytecode_opcode);
bc_emit_bytecode (opcode); bc_emit_bytecode (opcode);
instruction = (int) opcode; instruction = (int) opcode;

View File

@ -22,7 +22,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "tree.h" #include "tree.h"
#include "flags.h" #include "flags.h"
#include "expr.h" #include "expr.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
#include "insn-flags.h" #include "insn-flags.h"
/* Decide whether a function's arguments should be processed /* 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. */ move memory references across the non-const call. */
void void
emit_library_call (va_alist) emit_library_call VPROTO((rtx orgfun, int no_queue, enum machine_mode outmode,
va_dcl int nargs, ...))
{ {
#ifndef __STDC__
rtx orgfun;
int no_queue;
enum machine_mode outmode;
int nargs;
#endif
va_list p; va_list p;
/* Total size in bytes of all the stack-parms scanned so far. */ /* Total size in bytes of all the stack-parms scanned so far. */
struct args_size args_size; struct args_size args_size;
/* Size of arguments before any adjustments (such as rounding). */ /* Size of arguments before any adjustments (such as rounding). */
struct args_size original_args_size; struct args_size original_args_size;
register int argnum; register int argnum;
enum machine_mode outmode;
int nargs;
rtx fun; rtx fun;
rtx orgfun;
int inc; int inc;
int count; int count;
rtx argblock = 0; rtx argblock = 0;
@ -2090,16 +2097,20 @@ emit_library_call (va_alist)
struct args_size offset; struct args_size size; }; struct args_size offset; struct args_size size; };
struct arg *argvec; struct arg *argvec;
int old_inhibit_defer_pop = inhibit_defer_pop; int old_inhibit_defer_pop = inhibit_defer_pop;
int no_queue = 0;
rtx use_insns; rtx use_insns;
/* library calls are never indirect calls. */ /* library calls are never indirect calls. */
int current_call_is_indirect = 0; int current_call_is_indirect = 0;
va_start (p); VA_START (p, nargs);
orgfun = fun = va_arg (p, rtx);
#ifndef __STDC__
orgfun = va_arg (p, rtx);
no_queue = va_arg (p, int); no_queue = va_arg (p, int);
outmode = va_arg (p, enum machine_mode); outmode = va_arg (p, enum machine_mode);
nargs = va_arg (p, int); nargs = va_arg (p, int);
#endif
fun = orgfun;
/* Copy all the libcall-arguments out of the varargs data /* Copy all the libcall-arguments out of the varargs data
and into a vector ARGVEC. and into a vector ARGVEC.
@ -2338,19 +2349,23 @@ emit_library_call (va_alist)
If VALUE is nonzero, VALUE is returned. */ If VALUE is nonzero, VALUE is returned. */
rtx rtx
emit_library_call_value (va_alist) emit_library_call_value VPROTO((rtx orgfun, rtx value, int no_queue,
va_dcl 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; va_list p;
/* Total size in bytes of all the stack-parms scanned so far. */ /* Total size in bytes of all the stack-parms scanned so far. */
struct args_size args_size; struct args_size args_size;
/* Size of arguments before any adjustments (such as rounding). */ /* Size of arguments before any adjustments (such as rounding). */
struct args_size original_args_size; struct args_size original_args_size;
register int argnum; register int argnum;
enum machine_mode outmode;
int nargs;
rtx fun; rtx fun;
rtx orgfun;
int inc; int inc;
int count; int count;
rtx argblock = 0; rtx argblock = 0;
@ -2359,21 +2374,24 @@ emit_library_call_value (va_alist)
struct args_size offset; struct args_size size; }; struct args_size offset; struct args_size size; };
struct arg *argvec; struct arg *argvec;
int old_inhibit_defer_pop = inhibit_defer_pop; int old_inhibit_defer_pop = inhibit_defer_pop;
int no_queue = 0;
rtx use_insns; rtx use_insns;
rtx value;
rtx mem_value = 0; rtx mem_value = 0;
int pcc_struct_value = 0; int pcc_struct_value = 0;
int struct_value_size = 0; int struct_value_size = 0;
/* library calls are never indirect calls. */ /* library calls are never indirect calls. */
int current_call_is_indirect = 0; int current_call_is_indirect = 0;
va_start (p); VA_START (p, nargs);
orgfun = fun = va_arg (p, rtx);
#ifndef __STDC__
orgfun = va_arg (p, rtx);
value = va_arg (p, rtx); value = va_arg (p, rtx);
no_queue = va_arg (p, int); no_queue = va_arg (p, int);
outmode = va_arg (p, enum machine_mode); outmode = va_arg (p, enum machine_mode);
nargs = va_arg (p, int); nargs = va_arg (p, int);
#endif
fun = orgfun;
/* If this kind of value comes back in memory, /* If this kind of value comes back in memory,
decide where in memory it should come back. */ decide where in memory it should come back. */

View File

@ -74,7 +74,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
combine anyway. */ combine anyway. */
#include "config.h" #include "config.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
/* Must precede rtl.h for FFS. */ /* Must precede rtl.h for FFS. */
#include <stdio.h> #include <stdio.h>
@ -398,7 +402,8 @@ static rtx simplify_shift_const PROTO((rtx, enum rtx_code, enum machine_mode,
rtx, int)); rtx, int));
static int recog_for_combine PROTO((rtx *, rtx, rtx *)); static int recog_for_combine PROTO((rtx *, rtx, rtx *));
static rtx gen_lowpart_for_combine PROTO((enum machine_mode, 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, static rtx gen_binary PROTO((enum rtx_code, enum machine_mode,
rtx, rtx)); rtx, rtx));
static rtx gen_unary PROTO((enum rtx_code, enum machine_mode, rtx)); static rtx gen_unary PROTO((enum rtx_code, enum machine_mode, rtx));
@ -8293,21 +8298,26 @@ gen_lowpart_for_combine (mode, x)
/*VARARGS2*/ /*VARARGS2*/
static rtx static rtx
gen_rtx_combine (va_alist) gen_rtx_combine VPROTO((enum rtx_code code, enum machine_mode mode, ...))
va_dcl
{ {
va_list p; #ifndef __STDC__
enum rtx_code code; enum rtx_code code;
enum machine_mode mode; enum machine_mode mode;
#endif
va_list p;
int n_args; int n_args;
rtx args[3]; rtx args[3];
int i, j; int i, j;
char *fmt; char *fmt;
rtx rt; rtx rt;
va_start (p); VA_START (p, mode);
#ifndef __STDC__
code = va_arg (p, enum rtx_code); code = va_arg (p, enum rtx_code);
mode = va_arg (p, enum machine_mode); mode = va_arg (p, enum machine_mode);
#endif
n_args = GET_RTX_LENGTH (code); n_args = GET_RTX_LENGTH (code);
fmt = GET_RTX_FORMAT (code); fmt = GET_RTX_FORMAT (code);

View File

@ -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. */ is the kind of rtx's they make and what arguments they use. */
#include "config.h" #include "config.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
#include "rtl.h" #include "rtl.h"
#include "tree.h" #include "tree.h"
#include "flags.h" #include "flags.h"
@ -277,19 +281,23 @@ extern int max_stack_depth;
/*VARARGS2*/ /*VARARGS2*/
rtx rtx
gen_rtx (va_alist) gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...))
va_dcl
{ {
va_list p; #ifndef __STDC__
enum rtx_code code; enum rtx_code code;
enum machine_mode mode; enum machine_mode mode;
#endif
va_list p;
register int i; /* Array indices... */ register int i; /* Array indices... */
register char *fmt; /* Current rtx's format... */ register char *fmt; /* Current rtx's format... */
register rtx rt_val; /* RTX to return to caller... */ 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); code = va_arg (p, enum rtx_code);
mode = va_arg (p, enum machine_mode); mode = va_arg (p, enum machine_mode);
#endif
if (code == CONST_INT) if (code == CONST_INT)
{ {
@ -397,20 +405,26 @@ gen_rtx (va_alist)
/*VARARGS1*/ /*VARARGS1*/
rtvec rtvec
gen_rtvec (va_alist) gen_rtvec VPROTO((int n, ...))
va_dcl
{ {
int n, i; #ifndef __STDC__
int n;
#endif
int i;
va_list p; va_list p;
rtx *vector; rtx *vector;
va_start (p); VA_START (p, n);
#ifndef __STDC__
n = va_arg (p, int); n = va_arg (p, int);
#endif
if (n == 0) if (n == 0)
return NULL_RTVEC; /* Don't allocate an empty rtvec... */ return NULL_RTVEC; /* Don't allocate an empty rtvec... */
vector = (rtx *) alloca (n * sizeof (rtx)); vector = (rtx *) alloca (n * sizeof (rtx));
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
vector[i] = va_arg (p, rtx); vector[i] = va_arg (p, rtx);
va_end (p); va_end (p);

View File

@ -1,5 +1,5 @@
/* Convert RTL to assembler code and output it, for GNU compiler. /* 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. 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. */ FUNCTION_EPILOGUE. Those instructions never exist as rtl. */
#include "config.h" #include "config.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
#include "tree.h" #include "tree.h"
#include "rtl.h" #include "rtl.h"
#include "regs.h" #include "regs.h"
@ -2679,19 +2683,24 @@ output_addr_const (file, x)
We handle alternate assembler dialects here, just like output_asm_insn. */ We handle alternate assembler dialects here, just like output_asm_insn. */
void void
asm_fprintf (va_alist) asm_fprintf VPROTO((FILE *file, char *p, ...))
va_dcl
{ {
va_list argptr; #ifndef __STDC__
FILE *file; FILE *file;
char *p;
#endif
va_list argptr;
char buf[10]; char buf[10];
char *p, *q, c; char *q, c;
int i; int i;
va_start (argptr); VA_START (argptr, p);
#ifndef __STDC__
file = va_arg (argptr, FILE*); file = va_arg (argptr, FILE*);
p = va_arg (argptr, char*); p = va_arg (argptr, char*);
#endif
buf[0] = '%'; buf[0] = '%';
while (c = *p++) while (c = *p++)

View File

@ -38,7 +38,11 @@ compilation is specified by a string called a "spec". */
#include "config.h" #include "config.h"
#include "obstack.h" #include "obstack.h"
#ifdef __STDC__
#include "gstdarg.h"
#else
#include "gvarargs.h" #include "gvarargs.h"
#endif
#include <stdio.h> #include <stdio.h>
#ifndef R_OK #ifndef R_OK
@ -4178,14 +4182,19 @@ fancy_abort ()
/* Output an error message and exit */ /* Output an error message and exit */
static void static void
fatal (va_alist) fatal VPROTO((char *format, ...))
va_dcl
{ {
va_list ap; #ifndef __STDC__
char *format; char *format;
#endif
va_list ap;
va_start (ap); VA_START (ap, format);
#ifndef __STDC__
format = va_arg (ap, char*); format = va_arg (ap, char*);
#endif
fprintf (stderr, "%s: ", programname); fprintf (stderr, "%s: ", programname);
vfprintf (stderr, format, ap); vfprintf (stderr, format, ap);
va_end (ap); va_end (ap);
@ -4195,14 +4204,19 @@ fatal (va_alist)
} }
static void static void
error (va_alist) error VPROTO((char *format, ...))
va_dcl
{ {
va_list ap; #ifndef __STDC__
char *format; char *format;
#endif
va_list ap;
va_start (ap); VA_START (ap, format);
#ifndef __STDC__
format = va_arg (ap, char*); format = va_arg (ap, char*);
#endif
fprintf (stderr, "%s: ", programname); fprintf (stderr, "%s: ", programname);
vfprintf (stderr, format, ap); vfprintf (stderr, format, ap);
va_end (ap); va_end (ap);