diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-16 02:16:47 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-07-16 02:16:47 +0000 |
commit | 7ccc713a1f28ef9a1206745ceba153374cdd6f7a (patch) | |
tree | 01f97dd69fbdd80f44d832c9dc5b8a6a0aa6c26d | |
parent | 44e8a86043be6633df299e293ea58fabd33fe37e (diff) | |
download | ppe42-gcc-7ccc713a1f28ef9a1206745ceba153374cdd6f7a.tar.gz ppe42-gcc-7ccc713a1f28ef9a1206745ceba153374cdd6f7a.zip |
* ginclude/varargs.h: Replace with stub which issues #error.
* ginclude/stdarg.h: __builtin_stdarg_start is renamed
__builtin_va_start.
* builtins.def (BUILT_IN_VARARGS_START): Delete.
(BUILT_IN_VA_START): New.
* builtins.c (expand_builtin_va_start): Eliminate first
argument and code to implement pre-ISO varargs.
(std_expand_builtin_va_start): Ignore first argument; it is
always 1.
(expand_builtin): Handle BUILT_IN_VA_START and
BUILT_IN_STDARG_START identically. Delete
BUILT_IN_VARARGS_START case.
* function.c (assign_parms): Delete hide_last_arg and all
its uses.
(mark_varargs): Delete function.
* function.h (struct function): Delete 'varargs' bit.
(current_function_varargs): Delete macro.
* tree.h: Don't declare mark_varargs.
* c-decl.c (c_function_varargs, c_mark_varargs): Delete.
(c_expand_body): Don't call mark_varargs.
* c-objc-common.c: Handle BUILT_IN_VA_START and
BUILT_IN_STDARG_START identically. Delete
BUILT_IN_VARARGS_START case.
* c-tree.h: Don't declare c_mark_varargs.
* c-parse.in: Remove grammar rules for '&...' (which has been
commented out since before 2.7.2) and for '...' in K+R
argument declarations.
* builtins.c, function.c, integrate.c, sibcall.c,
config/alpha/unicosmk.h, config/arc/arc.c, config/arc/arc.h,
config/avr/avr.c, config/cris/cris.c, config/fr30/fr30.c,
config/i960/i960.c, config/i960/i960.md, config/m32r/m32r.c,
config/m32r/m32r.h, config/m88k/m88k.c, config/m88k/m88k.h,
config/mips/mips.c, config/mmix/mmix.c, config/mmix/mmix.h,
config/mn10300/mn10300.c, config/pa/som.h, config/s390/s390.c,
config/sh/sh.c, config/sh/sh.h, config/sparc/sparc.h,
config/stormy16/stormy16.c: Delete all references to
current_function_varargs, and code predicated on that flag.
* config/alpha/alpha.c (alpha_va_start),
config/arc/arc.c (arc_va_start),
config/i386/i386.c (ix86_va_start),
config/mips/mips.c (mips_va_start),
config/mn10300/mn10300.c (mn10300_va_start),
config/rs6000/rs6000.c (rs6000_va_start),
config/s390/s390.c (s390_va_start),
config/sh/sh.c (sh_va_start),
Ignore first argument; it is always 1.
* config/c4x/c4x-protos.h, config/c4x/c4x.c: Delete c4x_va_start.
* config/ia64/ia64-protos.h, config/ia64/ia64.c: Delete ia64_va_start.
* config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c:
Delete m68hc11_va_start.
* config/c4x/c4x.h, config/ia64/ia64.h, config/m68hc11/m68hc11.h:
No need to define EXPAND_BUILTIN_VA_START.
* doc/invoke.texi, doc/sourcebuild.texi, doc/tm.texi,
doc/trouble.texi: Remove references to GCC-provided <varargs.h>.
testsuite:
* c-torture/execute/991216-3.c, c-torture/execute/strct-varg-1.c,
c-torture/execute/va-arg-7.c, c-torture/execute/va-arg-8.c,
c-torture/execute/va-arg-15.c, c-torture/execute/va-arg-16.c,
c-torture/execute/va-arg-17.c, c-torture/execute/va-arg-19.c:
Convert to use <stdarg.h>.
* c-torture/execute/va-arg-3.c, c-torture/execute/va-arg-3.x:
Delete.
* gcc.dg/va-arg-2.c: New.
* lib/gcc.exp, lib/objc.exp: Remove code to set -DNO_VARARGS.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55472 138bc75d-0d04-0410-961f-82ee72b054a4
66 files changed, 272 insertions, 1061 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c659805be5..c71815c9779 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,67 @@ +2002-07-15 Zack Weinberg <zack@codesourcery.com> + + * ginclude/varargs.h: Replace with stub which issues #error. + * ginclude/stdarg.h: __builtin_stdarg_start is renamed + __builtin_va_start. + + * builtins.def (BUILT_IN_VARARGS_START): Delete. + (BUILT_IN_VA_START): New. + * builtins.c (expand_builtin_va_start): Eliminate first + argument and code to implement pre-ISO varargs. + (std_expand_builtin_va_start): Ignore first argument; it is + always 1. + (expand_builtin): Handle BUILT_IN_VA_START and + BUILT_IN_STDARG_START identically. Delete + BUILT_IN_VARARGS_START case. + + * function.c (assign_parms): Delete hide_last_arg and all + its uses. + (mark_varargs): Delete function. + * function.h (struct function): Delete 'varargs' bit. + (current_function_varargs): Delete macro. + * tree.h: Don't declare mark_varargs. + + * c-decl.c (c_function_varargs, c_mark_varargs): Delete. + (c_expand_body): Don't call mark_varargs. + * c-objc-common.c: Handle BUILT_IN_VA_START and + BUILT_IN_STDARG_START identically. Delete + BUILT_IN_VARARGS_START case. + * c-tree.h: Don't declare c_mark_varargs. + * c-parse.in: Remove grammar rules for '&...' (which has been + commented out since before 2.7.2) and for '...' in K+R + argument declarations. + + * builtins.c, function.c, integrate.c, sibcall.c, + config/alpha/unicosmk.h, config/arc/arc.c, config/arc/arc.h, + config/avr/avr.c, config/cris/cris.c, config/fr30/fr30.c, + config/i960/i960.c, config/i960/i960.md, config/m32r/m32r.c, + config/m32r/m32r.h, config/m88k/m88k.c, config/m88k/m88k.h, + config/mips/mips.c, config/mmix/mmix.c, config/mmix/mmix.h, + config/mn10300/mn10300.c, config/pa/som.h, config/s390/s390.c, + config/sh/sh.c, config/sh/sh.h, config/sparc/sparc.h, + config/stormy16/stormy16.c: Delete all references to + current_function_varargs, and code predicated on that flag. + + * config/alpha/alpha.c (alpha_va_start), + config/arc/arc.c (arc_va_start), + config/i386/i386.c (ix86_va_start), + config/mips/mips.c (mips_va_start), + config/mn10300/mn10300.c (mn10300_va_start), + config/rs6000/rs6000.c (rs6000_va_start), + config/s390/s390.c (s390_va_start), + config/sh/sh.c (sh_va_start), + Ignore first argument; it is always 1. + + * config/c4x/c4x-protos.h, config/c4x/c4x.c: Delete c4x_va_start. + * config/ia64/ia64-protos.h, config/ia64/ia64.c: Delete ia64_va_start. + * config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c: + Delete m68hc11_va_start. + * config/c4x/c4x.h, config/ia64/ia64.h, config/m68hc11/m68hc11.h: + No need to define EXPAND_BUILTIN_VA_START. + + * doc/invoke.texi, doc/sourcebuild.texi, doc/tm.texi, + doc/trouble.texi: Remove references to GCC-provided <varargs.h>. + 2002-07-15 Eric Botcazou <ebotcazou@multimania.com> PR optimization/7153 @@ -9,7 +73,7 @@ * config/sparc/netbsd-elf.h (TRANSFER_FROM_TRAMPOLINE): Remove. 2002-07-15 Michael Matz <matz@suse.de>, - Daniel Berlin <dberlin@dberlin.org>, + Daniel Berlin <dberlin@dberlin.org>, Denis Chertykov <denisc@overta.ru> Add a new register allocator. @@ -298,10 +362,10 @@ Thu Jul 11 11:31:12 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-07-10 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.c (emit_frame_save): New. - (rs6000_frame_related): Replace reg2 before reg. - (rs6000_emit_prologue): Use emit_frame_save for saving gprs, fprs, - and eh_return registers. + * config/rs6000/rs6000.c (emit_frame_save): New. + (rs6000_frame_related): Replace reg2 before reg. + (rs6000_emit_prologue): Use emit_frame_save for saving gprs, fprs, + and eh_return registers. 2002-07-10 Toon Moene <toon@moene.indiv.nluug.nl> @@ -351,8 +415,8 @@ Wed Jul 10 18:48:55 CEST 2002 Jan Hubicka <jh@suse.cz> * mn10200.c (expand_prologue): Create REG_MAYBE_DEAD notes as appropriate. - * mn10200.c (expand_epilogue): Fix test to determine which scratch - register to use. + * mn10200.c (expand_epilogue): Fix test to determine which scratch + register to use. Wed Jul 10 16:06:00 2002 J"orn Rennecke <joern.rennecke@superh.com> @@ -412,7 +476,7 @@ Wed Jul 10 16:06:00 2002 J"orn Rennecke <joern.rennecke@superh.com> * doc/cpp.texi: Update. Tue Jul 9 22:37:44 2002 Stephen Clarke <stephen.clarke@superh.com> - J"orn Rennecke <joern.rennecke@superh.com> + J"orn Rennecke <joern.rennecke@superh.com> * sh.c (sh_adjust_cost): Special handling of SHMEDIA code. * sh.md (attribute issues): Replace with: @@ -971,8 +1035,8 @@ Mon Jul 1 19:55:17 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-07-01 Aldy Hernandez <aldyh@redhat.com> - * tree.c (build_function_type_list): Update function comment. - Rename first argument to return_type. + * tree.c (build_function_type_list): Update function comment. + Rename first argument to return_type. 2002-07-01 Neil Booth <neil@daikokuya.co.uk> @@ -994,7 +1058,7 @@ Mon Jul 1 19:55:17 2002 J"orn Rennecke <joern.rennecke@superh.com> Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> Frank Ch. Eigler <fche@redhat.com> - Matthew Green <mrg@redhat.com> + Matthew Green <mrg@redhat.com> Richard Henderson <rtl@redhat.com> Dave Hudson <dave.hudson@ubicom.com> Jeff Johnston <jjohnstn@redhat.com> @@ -1037,7 +1101,7 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-30 Aldy Hernandez <aldyh@redhat.com> - * config/i386/i386.c (ix86_init_mmx_sse_builtins): Fix typos. + * config/i386/i386.c (ix86_init_mmx_sse_builtins): Fix typos. 2002-06-30 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -1055,20 +1119,20 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-29 Aldy Hernandez <aldyh@redhat.com> - * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use - build_function_type_list instead of build_function_type. + * config/i386/i386.c (ix86_init_mmx_sse_builtins): Use + build_function_type_list instead of build_function_type. - * config/ia64/ia64.c (ia64_init_builtins): Same. + * config/ia64/ia64.c (ia64_init_builtins): Same. - * config/alpha/alpha.c (alpha_init_builtins): Same. + * config/alpha/alpha.c (alpha_init_builtins): Same. - * config/rs6000/rs6000.c (altivec_init_builtins): Same. + * config/rs6000/rs6000.c (altivec_init_builtins): Same. - * config/arm/arm.c (arm_init_builtins): Same. + * config/arm/arm.c (arm_init_builtins): Same. - * tree.h: Add build_function_type_list prototype. + * tree.h: Add build_function_type_list prototype. - * tree.c (build_function_type_list): New. + * tree.c (build_function_type_list): New. 2002-06-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -1076,7 +1140,7 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-28 Aaron Lehmann <aaronl@vitelus.com> - * fold-cont.c: Remove unused CHARMASK. + * fold-cont.c: Remove unused CHARMASK. 2002-06-29 Neil Booth <neil@daikokuya.co.uk> @@ -1098,7 +1162,7 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-29 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl> - * c4x.h: (TARGET_CPU_CPP_BUILTINS): Check flag_inline_functions and + * c4x.h: (TARGET_CPU_CPP_BUILTINS): Check flag_inline_functions and flag_inline_trees to enable inlining. 2002-06-28 Phil Edwards <pme@gcc.gnu.org> @@ -1155,22 +1219,22 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-28 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.c: Remove unusued variables from last - patch. + * config/rs6000/rs6000.c: Remove unusued variables from last + patch. 2002-06-27 Aldy Hernandez <aldyh@redhat.com> Revert: - * config/rs6000/rs6000.c (rs6000_override_options): Move - *SUBTARGET_OVERRIDE_OPTIONS before the -m options. + * config/rs6000/rs6000.c (rs6000_override_options): Move + *SUBTARGET_OVERRIDE_OPTIONS before the -m options. 2002-06-27 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.c (altivec_expand_builtin): Move - lvx/stv/dst builtins... - (altivec_expand_ld_builtin): ...to here. - (altivec_expand_st_builtin): ...here. - (altivec_expand_dst_builtin): ...and here (respectively). + * config/rs6000/rs6000.c (altivec_expand_builtin): Move + lvx/stv/dst builtins... + (altivec_expand_ld_builtin): ...to here. + (altivec_expand_st_builtin): ...here. + (altivec_expand_dst_builtin): ...and here (respectively). 2002-06-28 Bob Wilson <bob.wilson@acm.org> @@ -1192,8 +1256,8 @@ Fri Jun 28 17:22:37 2002 Denis Chertykov <denisc@overta.ru> 2002-06-27 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.c (rs6000_override_options): Move - *SUBTARGET_OVERRIDE_OPTIONS before the -m options. + * config/rs6000/rs6000.c (rs6000_override_options): Move + *SUBTARGET_OVERRIDE_OPTIONS before the -m options. 2002-06-27 Bob Wilson <bob.wilson@acm.org> @@ -1268,8 +1332,8 @@ Wed Jun 26 16:32:57 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-06-26 Aldy Hernandez <aldyh@redhat.com> - * config/rs6000/rs6000.h (ALTIVEC_VECTOR_MODE): Revert change to - check for TARGET_ALTIVEC. + * config/rs6000/rs6000.h (ALTIVEC_VECTOR_MODE): Revert change to + check for TARGET_ALTIVEC. 2002-06-26 Nathanael Nerode <neroden@gcc.gnu.org> @@ -1290,8 +1354,8 @@ Wed Jun 26 16:32:57 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-06-25 Aldy Hernandez <aldyh@redhat.com> - * doc/extend.texi (PowerPC AltiVec Built-in Functions): Document - discrepancies from motorola's documentation. + * doc/extend.texi (PowerPC AltiVec Built-in Functions): Document + discrepancies from motorola's documentation. Tue Jun 25 21:51:13 2002 J"orn Rennecke <joern.rennecke@superh.com> @@ -1768,7 +1832,7 @@ Thu Jun 20 12:14:01 CEST 2002 Jan Hubicka <jh@suse.cz> 2002-06-19 Chris Demetriou <cgd@broadcom.com> - * config/mips/mips.c (mips_emit_prefetch): Use hints which + * config/mips/mips.c (mips_emit_prefetch): Use hints which match desired locality. 2002-06-19 Dhananjay R. Deshpande <dhananjayd@kpit.com> diff --git a/gcc/builtins.c b/gcc/builtins.c index 4b66369d786..60ff19cc71d 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -98,7 +98,7 @@ static rtx expand_builtin_mathfn PARAMS ((tree, rtx, rtx)); static rtx expand_builtin_constant_p PARAMS ((tree)); static rtx expand_builtin_args_info PARAMS ((tree)); static rtx expand_builtin_next_arg PARAMS ((tree)); -static rtx expand_builtin_va_start PARAMS ((int, tree)); +static rtx expand_builtin_va_start PARAMS ((tree)); static rtx expand_builtin_va_end PARAMS ((tree)); static rtx expand_builtin_va_copy PARAMS ((tree)); static rtx expand_builtin_memcmp PARAMS ((tree, tree, rtx, @@ -2900,10 +2900,9 @@ expand_builtin_next_arg (arglist) { tree fntype = TREE_TYPE (current_function_decl); - if ((TYPE_ARG_TYPES (fntype) == 0 - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - == void_type_node)) - && ! current_function_varargs) + if (TYPE_ARG_TYPES (fntype) == 0 + || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) + == void_type_node)) { error ("`va_start' used in function with fixed args"); return const0_rtx; @@ -2926,7 +2925,7 @@ expand_builtin_next_arg (arglist) if (arg != last_parm) warning ("second parameter of `va_start' not last named argument"); } - else if (! current_function_varargs) + else /* Evidently an out of date version of <stdarg.h>; can't validate va_start's second argument, but can still work as intended. */ warning ("`__builtin_next_arg' called without an argument"); @@ -2991,24 +2990,12 @@ stabilize_va_list (valist, needs_lvalue) void std_expand_builtin_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { tree t; - if (! stdarg_p) - { - /* The dummy named parameter is declared as a 'word' sized - object, but if a 'word' is smaller than an 'int', it would - have been promoted to int when it was added to the arglist. */ - int align = PARM_BOUNDARY / BITS_PER_UNIT; - int size = MAX (UNITS_PER_WORD, - GET_MODE_SIZE (TYPE_MODE (integer_type_node))); - int offset = ((size + align - 1) / align) * align; - nextarg = plus_constant (nextarg, -offset); - } - t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, make_tree (ptr_type_node, nextarg)); TREE_SIDE_EFFECTS (t) = 1; @@ -3016,31 +3003,27 @@ std_expand_builtin_va_start (stdarg_p, valist, nextarg) expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); } -/* Expand ARGLIST, which from a call to __builtin_stdarg_va_start or - __builtin_varargs_va_start, depending on STDARG_P. */ +/* Expand ARGLIST, from a call to __builtin_va_start. */ static rtx -expand_builtin_va_start (stdarg_p, arglist) - int stdarg_p; +expand_builtin_va_start (arglist) tree arglist; { rtx nextarg; - tree chain = arglist, valist; + tree chain, valist; - if (stdarg_p) - nextarg = expand_builtin_next_arg (chain = TREE_CHAIN (arglist)); - else - nextarg = expand_builtin_next_arg (NULL_TREE); + chain = TREE_CHAIN (arglist); if (TREE_CHAIN (chain)) error ("too many arguments to function `va_start'"); + nextarg = expand_builtin_next_arg (chain); valist = stabilize_va_list (TREE_VALUE (arglist), 1); #ifdef EXPAND_BUILTIN_VA_START - EXPAND_BUILTIN_VA_START (stdarg_p, valist, nextarg); + EXPAND_BUILTIN_VA_START (1, valist, nextarg); #else - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); #endif return const0_rtx; @@ -4030,10 +4013,9 @@ expand_builtin (exp, target, subtarget, mode, ignore) case BUILT_IN_EH_RETURN_DATA_REGNO: return expand_builtin_eh_return_data_regno (arglist); #endif - case BUILT_IN_VARARGS_START: - return expand_builtin_va_start (0, arglist); + case BUILT_IN_VA_START: case BUILT_IN_STDARG_START: - return expand_builtin_va_start (1, arglist); + return expand_builtin_va_start (arglist); case BUILT_IN_VA_END: return expand_builtin_va_end (arglist); case BUILT_IN_VA_COPY: diff --git a/gcc/builtins.def b/gcc/builtins.def index 58f7c4915f6..40f5ccd86df 100644 --- a/gcc/builtins.def +++ b/gcc/builtins.def @@ -523,10 +523,11 @@ DEF_GCC_BUILTIN(BUILT_IN_EH_RETURN_DATA_REGNO, "__builtin_eh_return_data_regno", BT_FN_INT_INT) -DEF_GCC_BUILTIN(BUILT_IN_VARARGS_START, - "__builtin_varargs_start", - BT_FN_VOID_VALIST_REF) -DEF_GCC_BUILTIN(BUILT_IN_STDARG_START, +/* Variable argument list (stdarg.h) support */ +DEF_GCC_BUILTIN(BUILT_IN_VA_START, + "__builtin_va_start", + BT_FN_VOID_VALIST_REF_VAR) +DEF_GCC_BUILTIN(BUILT_IN_STDARG_START, /* backward compat */ "__builtin_stdarg_start", BT_FN_VOID_VALIST_REF_VAR) DEF_GCC_BUILTIN(BUILT_IN_VA_END, @@ -535,6 +536,7 @@ DEF_GCC_BUILTIN(BUILT_IN_VA_END, DEF_GCC_BUILTIN(BUILT_IN_VA_COPY, "__builtin_va_copy", BT_FN_VOID_VALIST_REF_VALIST_ARG) + DEF_GCC_BUILTIN(BUILT_IN_EXPECT, "__builtin_expect", BT_FN_LONG_LONG_LONG) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8551ba55dc4..bce03a9b91a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -119,11 +119,6 @@ static GTY(()) tree named_labels; static GTY(()) tree shadowed_labels; -/* Nonzero when store_parm_decls is called indicates a varargs function. - Value not meaningful after store_parm_decls. */ - -static int c_function_varargs; - /* Set to 0 at beginning of a function definition, set to 1 if a return statement that specifies a return value is seen. */ @@ -6027,7 +6022,6 @@ start_function (declspecs, declarator, attributes) current_function_returns_abnormally = 0; warn_about_return_type = 0; current_extern_inline = 0; - c_function_varargs = 0; named_labels = 0; shadowed_labels = 0; @@ -6246,16 +6240,6 @@ start_function (declspecs, declarator, attributes) return 1; } - -/* Record that this function is going to be a varargs function. - This is called before store_parm_decls, which is too early - to call mark_varargs directly. */ - -void -c_mark_varargs () -{ - c_function_varargs = 1; -} /* Store the parameter declarations into the current function declaration. This is called after parsing the parameter declarations, before @@ -6858,10 +6842,6 @@ c_expand_body (fndecl, nested_p, can_defer_p) immediate_size_expand = 0; cfun->x_dont_save_pending_sizes_p = 1; - /* If this is a varargs function, inform function.c. */ - if (c_function_varargs) - mark_varargs (); - /* Set up parameters and prepare for return, for the function. */ expand_function_start (fndecl, 0); diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index f5e9579312e..939c5345a78 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -91,7 +91,7 @@ inline_forbidden_p (nodep, walk_subtrees, fn) { /* We cannot inline functions that take a variable number of arguments. */ - case BUILT_IN_VARARGS_START: + case BUILT_IN_VA_START: case BUILT_IN_STDARG_START: #if 0 /* Functions that need information about the address of the diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 9299c6835a6..70d95f115da 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -533,21 +533,6 @@ unary_expr: /* Refer to the address of a label as a pointer. */ | ANDAND identifier { $$ = finish_label_address_expr ($2); } -/* This seems to be impossible on some machines, so let's turn it off. - You can use __builtin_next_arg to find the anonymous stack args. - | '&' ELLIPSIS - { tree types = TYPE_ARG_TYPES (TREE_TYPE (current_function_decl)); - $$ = error_mark_node; - if (TREE_VALUE (tree_last (types)) == void_type_node) - error ("`&...' used in function with fixed number of arguments"); - else - { - if (pedantic) - pedwarn ("ISO C forbids `&...'"); - $$ = tree_last (DECL_ARGUMENTS (current_function_decl)); - $$ = build_unary_op (ADDR_EXPR, $$, 0); - } } -*/ | sizeof unary_expr %prec UNARY { skip_evaluation--; if (TREE_CODE ($2) == COMPONENT_REF @@ -809,11 +794,6 @@ old_style_parm_decls_1: parsing_iso_function_signature = false; /* Reset after warning. */ } | datadecls - | datadecls ELLIPSIS - /* ... is used here to indicate a varargs function. */ - { c_mark_varargs (); - if (pedantic) - pedwarn ("ISO C does not permit use of `varargs.h'"); } ; /* The following are analogous to lineno_decl, decls and decl diff --git a/gcc/c-tree.h b/gcc/c-tree.h index aff8800d2a5..64eb2e14135 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -196,7 +196,6 @@ extern void c_print_identifier PARAMS ((FILE *, tree, int)); extern tree build_array_declarator PARAMS ((tree, tree, int, int)); extern tree build_enumerator PARAMS ((tree, tree)); extern int c_decode_option PARAMS ((int, char **)); -extern void c_mark_varargs PARAMS ((void)); extern void check_for_loop_decls PARAMS ((void)); extern void clear_parm_order PARAMS ((void)); extern int complete_array_type PARAMS ((tree, tree, int)); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index 9e240058e24..0b6aee09ec6 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -6163,7 +6163,7 @@ alpha_build_va_list () void alpha_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg ATTRIBUTE_UNUSED; { @@ -6174,7 +6174,7 @@ alpha_va_start (stdarg_p, valist, nextarg) return; if (TARGET_ABI_UNICOSMK) - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); /* For Unix, SETUP_INCOMING_VARARGS moves the starting address base up by 48, storing fp arg registers in the first 48 bytes, and the @@ -6185,7 +6185,7 @@ alpha_va_start (stdarg_p, valist, nextarg) in order to account for the integer arg registers which are counted in argsize above, but which are not actually stored on the stack. */ - if (NUM_ARGS <= 5 + stdarg_p) + if (NUM_ARGS <= 6) offset = TARGET_ABI_OPEN_VMS ? UNITS_PER_WORD : 6 * UNITS_PER_WORD; else offset = -6 * UNITS_PER_WORD; @@ -6732,7 +6732,7 @@ alpha_sa_size () alpha_procedure_type = (sa_size || get_frame_size() != 0 - || current_function_outgoing_args_size || current_function_varargs + || current_function_outgoing_args_size || current_function_stdarg || current_function_calls_alloca || frame_pointer_needed) ? PT_STACK : PT_REGISTER; diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h index cd9308c027e..457cfbad737 100644 --- a/gcc/config/alpha/unicosmk.h +++ b/gcc/config/alpha/unicosmk.h @@ -237,10 +237,7 @@ do { \ On Unicos/Mk, the standard subroutine __T3E_MISMATCH stores all register arguments on the stack. Unfortunately, it doesn't always store the first one (i.e. the one that arrives in $16 or $f16). This is not a problem - with stdargs as we always have at least one named argument there. This is - not always the case when varargs.h is used, however. In such cases, we - have to store the first argument ourselves. We use the information from - the CIW to determine whether the first argument arrives in $16 or $f16. */ + with stdargs as we always have at least one named argument there. */ #undef SETUP_INCOMING_VARARGS #define SETUP_INCOMING_VARARGS(CUM,MODE,TYPE,PRETEND_SIZE,NO_RTL) \ @@ -248,36 +245,9 @@ do { \ { \ if (! (NO_RTL)) \ { \ - int start; \ - \ - start = (CUM).num_reg_words; \ - if (!current_function_varargs || start == 0) \ - ++start; \ + int start = (CUM).num_reg_words + 1; \ \ emit_insn (gen_umk_mismatch_args (GEN_INT (start))); \ - if (current_function_varargs && (CUM).num_reg_words == 0) \ - { \ - rtx tmp; \ - rtx int_label, end_label; \ - \ - tmp = gen_reg_rtx (DImode); \ - emit_move_insn (tmp, \ - gen_rtx_ZERO_EXTRACT (DImode, \ - gen_rtx_REG (DImode, 2),\ - (GEN_INT (1)), \ - (GEN_INT (7)))); \ - int_label = gen_label_rtx (); \ - end_label = gen_label_rtx (); \ - emit_insn (gen_cmpdi (tmp, GEN_INT (0))); \ - emit_jump_insn (gen_beq (int_label)); \ - emit_move_insn (gen_rtx_MEM (DFmode, virtual_incoming_args_rtx),\ - gen_rtx_REG (DFmode, 48)); \ - emit_jump (end_label); \ - emit_label (int_label); \ - emit_move_insn (gen_rtx_MEM (DImode, virtual_incoming_args_rtx),\ - gen_rtx_REG (DImode, 16)); \ - emit_label (end_label); \ - } \ emit_insn (gen_arg_home_umk ()); \ } \ \ diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 9ea6df7a027..63767dd5f16 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -802,12 +802,8 @@ arc_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl) if (mode == BLKmode) abort (); - /* We must treat `__builtin_va_alist' as an anonymous arg. */ - if (current_function_varargs) - first_anon_arg = *cum; - else - first_anon_arg = *cum + ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) - / UNITS_PER_WORD); + first_anon_arg = *cum + ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) + / UNITS_PER_WORD); if (first_anon_arg < MAX_ARC_PARM_REGS && !no_rtl) { @@ -2266,7 +2262,7 @@ arc_ccfsm_record_branch_deleted () void arc_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { @@ -2275,7 +2271,7 @@ arc_va_start (stdarg_p, valist, nextarg) && (current_function_args_info & 1)) nextarg = plus_constant (nextarg, UNITS_PER_WORD); - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); } rtx diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 1390d6bc2a1..db8b8d452fd 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -665,15 +665,9 @@ extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER]; a reg. This includes arguments that have to be passed by reference as the pointer to them is passed in a reg if one is available (and that is what we're given). - When passing arguments NAMED is always 1. When receiving arguments NAMED - is 1 for each argument except the last in a stdarg/varargs function. In - a stdarg function we want to treat the last named arg as named. In a - varargs function we want to treat the last named arg (which is - `__builtin_va_alist') as unnamed. This macro is only used in this file. */ -#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \ -((!current_function_varargs || (NAMED)) \ - && (CUM) < MAX_ARC_PARM_REGS \ +#define PASS_IN_REG_P(CUM, MODE, TYPE) \ +((CUM) < MAX_ARC_PARM_REGS \ && ((ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) \ + ROUND_ADVANCE_ARG ((MODE), (TYPE)) \ <= MAX_ARC_PARM_REGS))) @@ -693,7 +687,7 @@ extern enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER]; /* On the ARC the first MAX_ARC_PARM_REGS args are normally in registers and the rest are pushed. */ #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ -(PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \ +(PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \ ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \ : 0) diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 3cc366667e1..e5e7258a847 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -2787,7 +2787,6 @@ frame_pointer_required_p () { return (current_function_calls_alloca || current_function_args_info.nregs == 0 - || current_function_varargs || get_frame_size () > 0); } diff --git a/gcc/config/c4x/c4x-protos.h b/gcc/config/c4x/c4x-protos.h index 8176d4d3723..7bdc1bd8746 100644 --- a/gcc/config/c4x/c4x-protos.h +++ b/gcc/config/c4x/c4x-protos.h @@ -59,8 +59,6 @@ extern struct rtx_def *c4x_function_arg PARAMS ((CUMULATIVE_ARGS *, #if defined(RTX_CODE) && defined(TREE_CODE) extern void c4x_init_cumulative_args PARAMS ((CUMULATIVE_ARGS *c, tree, rtx)); -extern void c4x_va_start PARAMS ((int, tree, rtx)); - extern struct rtx_def *c4x_va_arg PARAMS ((tree, tree)); extern rtx c4x_expand_builtin PARAMS ((tree, rtx, rtx, diff --git a/gcc/config/c4x/c4x.c b/gcc/config/c4x/c4x.c index 1e8814cb584..44c916f78d9 100644 --- a/gcc/config/c4x/c4x.c +++ b/gcc/config/c4x/c4x.c @@ -702,19 +702,6 @@ c4x_function_arg (cum, mode, type, named) return NULL_RTX; } - -void -c4x_va_start (stdarg_p, valist, nextarg) - int stdarg_p; - tree valist; - rtx nextarg; -{ - nextarg = plus_constant (nextarg, stdarg_p ? 0 : UNITS_PER_WORD * 2); - - std_expand_builtin_va_start (stdarg_p, valist, nextarg); -} - - /* C[34]x arguments grow in weird ways (downwards) that the standard varargs stuff can't handle.. */ rtx diff --git a/gcc/config/c4x/c4x.h b/gcc/config/c4x/c4x.h index 66ea582f651..3115677acd2 100644 --- a/gcc/config/c4x/c4x.h +++ b/gcc/config/c4x/c4x.h @@ -1166,9 +1166,6 @@ CUMULATIVE_ARGS; /* Varargs handling. */ -#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \ - c4x_va_start (stdarg, valist, nextarg) - #define EXPAND_BUILTIN_VA_ARG(valist, type) \ c4x_va_arg (valist, type) diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 66b01ee657f..6228c313000 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -1044,8 +1044,7 @@ struct cum_args {int regs;}; if (TARGET_PDEBUG) \ { \ fprintf (asm_out_file, \ - "\n; VA:: %s: %d args before, anon @ #%d, %dtime\n", \ - current_function_varargs ? "OLD" : "ANSI", \ + "\n; VA:: ANSI: %d args before, anon @ #%d, %dtime\n", \ (ARGSSF).regs, PRETEND, SECOND); \ } \ } \ diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c index f807756bfea..f217534a308 100644 --- a/gcc/config/fr30/fr30.c +++ b/gcc/config/fr30/fr30.c @@ -419,11 +419,9 @@ fr30_setup_incoming_varargs (arg_regs_used_so_far, int_mode, type, pretend_size) abort (); #if STRICT_ARGUMENT_NAMING - /* We must treat `__builtin_va_alist' as an anonymous arg. - But otherwise if STRICT_ARGUMENT_NAMING is true then the - last named arg must not be treated as an anonymous arg. */ - if (! current_function_varargs) - arg_regs_used_so_far += fr30_num_arg_regs (int_mode, type); + /* If STRICT_ARGUMENT_NAMING is true then the last named + arg must not be treated as an anonymous arg. */ + arg_regs_used_so_far += fr30_num_arg_regs (int_mode, type); #endif size = FR30_NUM_ARG_REGS - arg_regs_used_so_far; diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 4800949d3ad..0911b4aa966 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -2447,7 +2447,7 @@ ix86_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl) void ix86_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { @@ -2458,7 +2458,7 @@ ix86_va_start (stdarg_p, valist, nextarg) /* Only 64bit target needs something special. */ if (!TARGET_64BIT) { - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); return; } diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 85893de63ff..fab5f58819c 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -85,9 +85,9 @@ static int ret_label = 0; This is used to help identify functions that use an argument block. */ #define VARARGS_STDARG_FUNCTION(FNDECL) \ -((TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0 \ - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL)))) != void_type_node)) \ - || current_function_varargs) +(TYPE_ARG_TYPES (TREE_TYPE (FNDECL)) != 0 \ + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (TREE_TYPE (FNDECL))))) \ + != void_type_node) /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_SI_OP @@ -518,7 +518,7 @@ emit_move_sequence (operands, mode) if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) != REG && (operands[1] != const0_rtx || current_function_args_size - || current_function_varargs || current_function_stdarg + || current_function_stdarg || rtx_equal_function_value_matters)) /* Here we use the same test as movsi+1 pattern -- see i960.md. */ operands[1] = force_reg (mode, operands[1]); diff --git a/gcc/config/i960/i960.md b/gcc/config/i960/i960.md index 5755598345f..91fb78b5604 100644 --- a/gcc/config/i960/i960.md +++ b/gcc/config/i960/i960.md @@ -594,7 +594,7 @@ ;; the calling convention is defined so that the arg pointer when it is not ;; overwise being used is zero. Thus, we can handle store zero to memory ;; by storing an unused arg pointer. The arg pointer will be unused if -;; current_function_args_size is zero and this is not a stdarg/varargs +;; current_function_args_size is zero and this is not a stdarg ;; function. This value of the former variable is not valid until after ;; all rtl generation is complete, including function inlining (because a ;; function that doesn't need an arg pointer may be inlined into a function @@ -605,7 +605,6 @@ [(set (match_operand:SI 0 "general_operand" "=d,d,d,m") (match_operand:SI 1 "general_operand" "dI,i,m,dJ"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], SImode) @@ -643,7 +642,6 @@ [(set (match_operand:SI 0 "general_operand" "=d,d,d,m") (match_operand:SI 1 "general_operand" "dI,i,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], SImode) @@ -692,7 +690,6 @@ [(set (match_operand:HI 0 "general_operand" "=d,d,d,m") (match_operand:HI 1 "general_operand" "dI,i,m,dJ"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], HImode) @@ -731,7 +728,6 @@ [(set (match_operand:HI 0 "general_operand" "=d,d,d,m") (match_operand:HI 1 "general_operand" "dI,i,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], HImode) @@ -777,7 +773,6 @@ [(set (match_operand:QI 0 "general_operand" "=d,d,d,m") (match_operand:QI 1 "general_operand" "dI,i,m,dJ"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], QImode) @@ -816,7 +811,6 @@ [(set (match_operand:QI 0 "general_operand" "=d,d,d,m") (match_operand:QI 1 "general_operand" "dI,i,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], QImode) @@ -862,7 +856,6 @@ [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,m,o") (match_operand:DI 1 "general_operand" "d,I,i,m,d,J"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], DImode) @@ -892,7 +885,6 @@ [(set (match_operand:DI 0 "general_operand" "=d,d,d,d,m") (match_operand:DI 1 "general_operand" "d,I,i,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], DImode) @@ -945,7 +937,6 @@ [(set (match_operand:TI 0 "general_operand" "=d,d,d,d,m,o") (match_operand:TI 1 "general_operand" "d,I,i,m,d,J"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], TImode) @@ -975,7 +966,6 @@ [(set (match_operand:TI 0 "general_operand" "=d,d,d,d,m") (match_operand:TI 1 "general_operand" "d,I,i,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], TImode) @@ -1079,7 +1069,6 @@ [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m,o") (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d,G"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], DFmode) @@ -1115,7 +1104,6 @@ [(set (match_operand:DF 0 "general_operand" "=r,*f,d,d,m") (match_operand:DF 1 "fpmove_src_operand" "r,GH,F,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], DFmode) @@ -1157,7 +1145,6 @@ [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m") (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,dG"))] "(current_function_args_size == 0 - && current_function_varargs == 0 && current_function_stdarg == 0 && rtx_equal_function_value_matters == 0) && (register_operand (operands[0], SFmode) @@ -1192,7 +1179,6 @@ [(set (match_operand:SF 0 "general_operand" "=r,*f,d,d,m") (match_operand:SF 1 "fpmove_src_operand" "r,GH,F,m,d"))] "(current_function_args_size != 0 - || current_function_varargs != 0 || current_function_stdarg != 0 || rtx_equal_function_value_matters != 0) && (register_operand (operands[0], SFmode) diff --git a/gcc/config/ia64/ia64-protos.h b/gcc/config/ia64/ia64-protos.h index 2b10ef512ae..0244b511c9d 100644 --- a/gcc/config/ia64/ia64-protos.h +++ b/gcc/config/ia64/ia64-protos.h @@ -104,7 +104,6 @@ extern rtx ia64_function_arg PARAMS((CUMULATIVE_ARGS *, enum machine_mode, tree, int, int)); extern rtx ia64_expand_builtin PARAMS((tree, rtx, rtx, enum machine_mode, int)); -extern void ia64_va_start PARAMS((int, tree, rtx)); extern rtx ia64_va_arg PARAMS((tree, tree)); extern rtx ia64_function_value PARAMS((tree, tree)); #endif /* RTX_CODE */ diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index be83a4d26c8..ca9d158a03a 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -3050,9 +3050,8 @@ ia64_setup_incoming_varargs (cum, int_mode, type, pretend_size, second_time) int * pretend_size; int second_time ATTRIBUTE_UNUSED; { - /* If this is a stdarg function, then skip the current argument. */ - if (! current_function_varargs) - ia64_function_arg_advance (&cum, int_mode, type, 1); + /* Skip the current argument. */ + ia64_function_arg_advance (&cum, int_mode, type, 1); if (cum.words < MAX_ARGUMENT_SLOTS) { @@ -3453,27 +3452,6 @@ ia64_function_arg_pass_by_reference (cum, mode, type, named) return type && TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST; } -/* Implement va_start. */ - -void -ia64_va_start (stdarg_p, valist, nextarg) - int stdarg_p; - tree valist; - rtx nextarg; -{ - int arg_words; - int ofs; - - arg_words = current_function_args_info.words; - - if (stdarg_p) - ofs = 0; - else - ofs = (arg_words >= MAX_ARGUMENT_SLOTS ? -UNITS_PER_WORD : 0); - - nextarg = plus_constant (nextarg, ofs); - std_expand_builtin_va_start (1, valist, nextarg); -} /* Implement va_arg. */ diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index 8aa8140d53b..6f6d80edd1e 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -1339,10 +1339,6 @@ do { \ (((REGNO) >= GR_ARG_FIRST && (REGNO) < (GR_ARG_FIRST + MAX_ARGUMENT_SLOTS)) \ || ((REGNO) >= FR_ARG_FIRST && (REGNO) < (FR_ARG_FIRST + MAX_ARGUMENT_SLOTS))) -/* Implement `va_start' for varargs and stdarg. */ -#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \ - ia64_va_start (stdarg, valist, nextarg) - /* Implement `va_arg'. */ #define EXPAND_BUILTIN_VA_ARG(valist, type) \ ia64_va_arg (valist, type) diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 5948039b559..df100dfd98e 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -1446,12 +1446,8 @@ m32r_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl) if (mode == BLKmode) abort (); - /* We must treat `__builtin_va_alist' as an anonymous arg. */ - if (current_function_varargs) - first_anon_arg = *cum; - else - first_anon_arg = (ROUND_ADVANCE_CUM (*cum, mode, type) - + ROUND_ADVANCE_ARG (mode, type)); + first_anon_arg = (ROUND_ADVANCE_CUM (*cum, mode, type) + + ROUND_ADVANCE_ARG (mode, type)); if (first_anon_arg < M32R_MAX_PARM_REGS) { diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 12f330d9cc1..2d978300d02 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -1084,7 +1084,7 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size) pointer to them is passed in a reg if one is available (and that is what we're given). This macro is only used in this file. */ -#define PASS_IN_REG_P(CUM, MODE, TYPE, NAMED) \ +#define PASS_IN_REG_P(CUM, MODE, TYPE) \ (ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE)) < M32R_MAX_PARM_REGS) /* Determine where to put an argument to a function. @@ -1102,14 +1102,7 @@ M32R_STACK_ALIGN (current_function_outgoing_args_size) /* On the M32R the first M32R_MAX_PARM_REGS args are normally in registers and the rest are pushed. */ #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ - (PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED)) \ - ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \ - : 0) - -/* ??? Quick hack to try to get varargs working the normal way. */ -#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \ - (((! current_function_varargs || (NAMED)) \ - && PASS_IN_REG_P ((CUM), (MODE), (TYPE), (NAMED))) \ + (PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \ ? gen_rtx_REG ((MODE), ROUND_ADVANCE_CUM ((CUM), (MODE), (TYPE))) \ : 0) diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 20bc83e152e..c4a3fef0429 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -152,10 +152,7 @@ extern int m68hc11_function_arg_pass_by_reference PARAMS((const CUMULATIVE_ARGS* int)); extern int m68hc11_function_arg_padding PARAMS((enum machine_mode, tree)); -extern void m68hc11_expand_builtin_va_start PARAMS((int, tree, rtx)); - extern rtx m68hc11_va_arg PARAMS((tree,tree)); -extern void m68hc11_expand_builtin_va_start PARAMS((int,tree,rtx)); extern void m68hc11_function_epilogue PARAMS((FILE*,int)); diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index be7b24b084a..18d7d40e225 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1455,29 +1455,6 @@ m68hc11_function_arg (cum, mode, type, named) return NULL_RTX; } -/* The "standard" implementation of va_start: just assign `nextarg' to - the variable. */ -void -m68hc11_expand_builtin_va_start (stdarg_p, valist, nextarg) - int stdarg_p ATTRIBUTE_UNUSED; - tree valist; - rtx nextarg; -{ - tree t; - - /* SCz: the default implementation in builtins.c adjust the - nextarg using UNITS_PER_WORD. This works only with -mshort - and fails when integers are 32-bit. Here is the correct way. */ - if (!stdarg_p) - nextarg = plus_constant (nextarg, -INT_TYPE_SIZE / 8); - - t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, - make_tree (ptr_type_node, nextarg)); - TREE_SIDE_EFFECTS (t) = 1; - - expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); -} - rtx m68hc11_va_arg (valist, type) tree valist; diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 467862f3655..18a5ae51ea6 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1074,9 +1074,6 @@ typedef struct m68hc11_args #define CALLER_SAVE_PROFITABLE(REFS,CALLS) 0 /* Implement `va_arg'. */ -#define EXPAND_BUILTIN_VA_START(stdarg, valist, nextarg) \ - m68hc11_expand_builtin_va_start (stdarg, valist, nextarg) - #define EXPAND_BUILTIN_VA_ARG(valist, type) \ m68hc11_va_arg (valist, type) diff --git a/gcc/config/m88k/m88k.c b/gcc/config/m88k/m88k.c index 7e3c96f689c..2f83e549119 100644 --- a/gcc/config/m88k/m88k.c +++ b/gcc/config/m88k/m88k.c @@ -1947,7 +1947,6 @@ uses_arg_area_p () register tree parm; if (current_function_decl == 0 - || current_function_varargs || variable_args_p) return 1; diff --git a/gcc/config/m88k/m88k.h b/gcc/config/m88k/m88k.h index 1678b6bcf7e..475f23b696a 100644 --- a/gcc/config/m88k/m88k.h +++ b/gcc/config/m88k/m88k.h @@ -1052,8 +1052,7 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS, may be accessed via the stack pointer) in functions that seem suitable. This is computed in `reload', in reload1.c. */ #define FRAME_POINTER_REQUIRED \ -(current_function_varargs \ - || (TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ()) \ +((TARGET_OMIT_LEAF_FRAME_POINTER && !leaf_function_p ()) \ || (write_symbols != NO_DEBUG && !TARGET_OCS_FRAME_POSITION)) /* Definitions for register eliminations. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index a42c54420d8..e3a64d34a3b 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -4485,15 +4485,10 @@ mips_setup_incoming_varargs (cum, mode, type, no_rtl) /* The caller has advanced CUM up to, but not beyond, the last named argument. Advance a local copy of CUM past the last "real" named - argument, to find out how many registers are left over. + argument, to find out how many registers are left over. */ - For K&R varargs, the last named argument is a dummy word-sized one, - so CUM already contains the information we need. For stdarg, it is - a real argument (such as the format in printf()) and we need to - step over it. */ local_cum = *cum; - if (!current_function_varargs) - FUNCTION_ARG_ADVANCE (local_cum, mode, type, 1); + FUNCTION_ARG_ADVANCE (local_cum, mode, type, 1); /* Found out how many registers we need to save. */ gp_saved = MAX_ARGS_IN_REGISTERS - local_cum.num_gprs; @@ -4611,14 +4606,11 @@ mips_build_va_list () return ptr_type_node; } -/* Implement va_start. stdarg_p is 0 if implementing - __builtin_varargs_va_start, 1 if implementing __builtin_stdarg_va_start. - Note that this routine isn't called when compiling e.g. "_vfprintf_r". - (It doesn't have "...", so it inherits the pointers of its caller.) */ +/* Implement va_start. stdarg_p is always 1. */ void mips_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { @@ -4696,39 +4688,12 @@ mips_va_start (stdarg_p, valist, nextarg) { /* Everything is in the GPR save area, or in the overflow area which is contiguous with it. */ - - int offset = -gpr_save_area_size; - if (gpr_save_area_size == 0) - offset = (stdarg_p ? 0 : -UNITS_PER_WORD); - nextarg = plus_constant (nextarg, offset); + nextarg = plus_constant (nextarg, -gpr_save_area_size); std_expand_builtin_va_start (1, valist, nextarg); } } else - { - /* not EABI */ - int ofs; - - if (stdarg_p) - ofs = 0; - else - { - /* ??? This had been conditional on - _MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32 - and both iris5.h and iris6.h define _MIPS_SIM. */ - if (mips_abi == ABI_N32 - || mips_abi == ABI_64 - || mips_abi == ABI_MEABI) - ofs = (cum->num_gprs < MAX_ARGS_IN_REGISTERS - ? 0 - : -UNITS_PER_WORD); - else - ofs = -UNITS_PER_WORD; - } - - nextarg = plus_constant (nextarg, ofs); - std_expand_builtin_va_start (1, valist, nextarg); - } + std_expand_builtin_va_start (1, valist, nextarg); } /* Implement va_arg. */ @@ -7241,7 +7206,7 @@ mips_output_function_prologue (file, size) /* If this is a varargs function, we need to save all the registers onto the stack anyhow. */ - if (current_function_stdarg || current_function_varargs) + if (current_function_stdarg) savearg = GP_REG_FIRST + 7; fprintf (file, "\tentry\t"); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index c3c4d985c05..f166804d271 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -546,14 +546,6 @@ mmix_function_arg (argsp, mode, type, named, incoming) int named ATTRIBUTE_UNUSED; int incoming; { - /* Handling of the positional dummy parameter for varargs gets nasty. - Check execute/991216-3 and function.c:assign_params. We have to say - that the dummy parameter goes on stack in order to get the correct - offset when va_start and va_arg is applied. FIXME: Should do TRT by - itself in the gcc core. */ - if ((! named && incoming && current_function_varargs) || argsp->now_varargs) - return NULL_RTX; - /* Last-argument marker. */ if (type == void_type_node) return (argsp->regs < MMIX_MAX_ARGS_IN_REGS) @@ -828,31 +820,10 @@ mmix_setup_incoming_varargs (args_so_farp, mode, vartype, pretend_sizep, int * pretend_sizep; int second_time ATTRIBUTE_UNUSED; { - /* For stdarg, the last named variable has been handled, but - args_so_farp has not been advanced for it. For varargs, the current - argument is to be counted to the anonymous ones. */ - if (current_function_stdarg) - { - if (args_so_farp->regs + 1 < MMIX_MAX_ARGS_IN_REGS) - *pretend_sizep - = (MMIX_MAX_ARGS_IN_REGS - (args_so_farp->regs + 1)) * 8; - } - else if (current_function_varargs) - { - if (args_so_farp->regs < MMIX_MAX_ARGS_IN_REGS) - *pretend_sizep - = (MMIX_MAX_ARGS_IN_REGS - args_so_farp->regs) * 8; - - /* For varargs, we get here when we see the last named parameter, - which will actually be passed on stack. So make the next call - (there will be one) to FUNCTION_ARG return 0, to count it on - stack, so va_arg for it will get right. FIXME: The GCC core - should provide TRT. */ - args_so_farp->now_varargs = 1; - } - else - internal_error ("neither varargs or stdarg in mmix_setup_incoming_varargs"); - + /* The last named variable has been handled, but + args_so_farp has not been advanced for it. */ + if (args_so_farp->regs + 1 < MMIX_MAX_ARGS_IN_REGS) + *pretend_sizep = (MMIX_MAX_ARGS_IN_REGS - (args_so_farp->regs + 1)) * 8; /* We assume that one argument takes up one register here. That should be true until we start messing with multi-reg parameters. */ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index d3dad13fe9e..6eb4fafda71 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -738,10 +738,10 @@ enum reg_class replace with a big comment. */ #define FUNCTION_ARG_CALLEE_COPIES(CUM, MODE, TYPE, NAMED) 1 -typedef struct { int regs; int lib; int now_varargs; } CUMULATIVE_ARGS; +typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT) \ - ((CUM).regs = 0, (CUM).lib = ((LIBNAME) != 0), (CUM).now_varargs = 0) + ((CUM).regs = 0, (CUM).lib = ((LIBNAME) != 0)) #define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED) \ ((CUM).regs \ diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 54bf0409262..e47c8c1f69b 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -525,18 +525,6 @@ expand_prologue () size = get_frame_size () + current_function_outgoing_args_size; size += (current_function_outgoing_args_size ? 4 : 0); - /* If this is an old-style varargs function, then its arguments - need to be flushed back to the stack. */ - if (current_function_varargs) - { - emit_move_insn (gen_rtx_MEM (SImode, - plus_constant (stack_pointer_rtx, 4)), - gen_rtx_REG (SImode, 0)); - emit_move_insn (gen_rtx_MEM (SImode, - plus_constant (stack_pointer_rtx, 8)), - gen_rtx_REG (SImode, 1)); - } - /* If we use any of the callee-saved registers, save them now. */ mn10300_gen_multiple_store (mn10300_get_live_callee_saved_regs ()); @@ -887,13 +875,11 @@ mn10300_builtin_saveregs () void mn10300_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { - if (stdarg_p) - nextarg = expand_builtin_saveregs (); - + nextarg = expand_builtin_saveregs (); std_expand_builtin_va_start (stdarg_p, valist, nextarg); } diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index 9f0a964f32d..644c85900b7 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -198,10 +198,9 @@ do { \ } \ } \ /* anonymous args */ \ - if ((TYPE_ARG_TYPES (tree_type) != 0 \ - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\ - != void_type_node)) \ - || current_function_varargs) \ + if (TYPE_ARG_TYPES (tree_type) != 0 \ + && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\ + != void_type_node)) \ { \ for (; i < 4; i++) \ fprintf (FILE, ",ARGW%d=GR", i); \ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d230ba88b8f..fef0e172fa3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -3099,7 +3099,7 @@ rs6000_build_va_list () void rs6000_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { @@ -3110,7 +3110,7 @@ rs6000_va_start (stdarg_p, valist, nextarg) /* Only SVR4 needs something special. */ if (DEFAULT_ABI != ABI_V4) { - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); return; } diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 3c200b0972d..cf1edd2ba53 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3201,8 +3201,7 @@ s390_frame_info (frame) if (! current_function_is_leaf || frame->frame_size > 0 || current_function_calls_alloca - || current_function_stdarg - || current_function_varargs) + || current_function_stdarg) frame->frame_size += STARTING_FRAME_OFFSET; /* If we need to allocate a frame, the stack pointer is changed. */ @@ -3260,7 +3259,7 @@ s390_frame_info (frame) frame->return_reg_saved_p = (j >= RETURN_REGNUM && i <= RETURN_REGNUM); } - if (current_function_stdarg || current_function_varargs) + if (current_function_stdarg) { /* Varargs function need to save from gpr 2 to gpr 15. */ frame->first_save_gpr = 2; @@ -3435,7 +3434,7 @@ s390_emit_prologue () /* Save fprs for variable args. */ - if (current_function_stdarg || current_function_varargs) + if (current_function_stdarg) { /* Save fpr 0 and 2. */ @@ -3950,9 +3949,8 @@ s390_build_va_list () } /* Implement va_start by filling the va_list structure VALIST. - STDARG_P is true if implementing __builtin_stdarg_va_start, - false if implementing __builtin_varargs_va_start. NEXTARG - points to the first anonymous stack argument. + STDARG_P is always true, and ignored. + NEXTARG points to the first anonymous stack argument. The following global variables are used to initialize the va_list structure: @@ -3965,7 +3963,7 @@ s390_build_va_list () void s390_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg ATTRIBUTE_UNUSED; { @@ -4003,8 +4001,6 @@ s390_va_start (stdarg_p, valist, nextarg) off = INTVAL (current_function_arg_offset_rtx); off = off < 0 ? 0 : off; - if (! stdarg_p) - off = off > 0 ? off - UNITS_PER_WORD : off; if (TARGET_DEBUG_ARG) fprintf (stderr, "va_start: n_gpr = %d, n_fpr = %d off %d\n", (int)n_gpr, (int)n_fpr, off); diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index a7eabba3090..8fe71140bee 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -4567,7 +4567,7 @@ sh_expand_prologue () } /* Emit the code for SETUP_VARARGS. */ - if (current_function_varargs || current_function_stdarg) + if (current_function_stdarg) { /* This is not used by the SH3E calling convention */ if (TARGET_SH1 && ! TARGET_SH3E && ! TARGET_SH5 && ! TARGET_HITACHI) @@ -5261,7 +5261,7 @@ sh_build_va_list () void sh_va_start (stdarg_p, valist, nextarg) - int stdarg_p; + int stdarg_p ATTRIBUTE_UNUSED; tree valist; rtx nextarg; { @@ -5273,20 +5273,13 @@ sh_va_start (stdarg_p, valist, nextarg) if (TARGET_SH5) { expand_builtin_saveregs (); - /* When the varargs dummy argument is ``passed'' on a register, - we don't want std_expand_builtin_va_start() to apply any - correction for it, so set stdarg_p so as to pretend there's - no such dummy argument. */ - if (current_function_args_info.arg_count[(int) SH_ARG_INT] - < NPARM_REGS (SImode)) - stdarg_p = 1; - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); return; } if ((! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI) { - std_expand_builtin_va_start (stdarg_p, valist, nextarg); + std_expand_builtin_va_start (1, valist, nextarg); return; } @@ -5338,11 +5331,6 @@ sh_va_start (stdarg_p, valist, nextarg) expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); u = make_tree (ptr_type_node, nextarg); - if (! stdarg_p && (nint == 0 || nfp == 0)) - { - u = fold (build (PLUS_EXPR, ptr_type_node, u, - build_int_2 (-UNITS_PER_WORD, -1))); - } t = build (MODIFY_EXPR, ptr_type_node, next_stack, u); TREE_SIDE_EFFECTS (t) = 1; expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL); diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 3d65d7b054c..c30c5f64fea 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -1846,8 +1846,7 @@ struct sh_args { #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ ((! TARGET_SH5 \ && PASS_IN_REG_P ((CUM), (MODE), (TYPE)) \ - && ((NAMED) \ - || (! TARGET_HITACHI && (TARGET_SH3E || ! current_function_varargs)))) \ + && ((NAMED) || !TARGET_HITACHI)) \ ? gen_rtx_REG ((MODE), \ ((BASE_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE))) \ ^ ((MODE) == SFmode && TARGET_SH4 \ @@ -2010,7 +2009,7 @@ struct sh_args { later. Fortunately, we already have two flags that are part of struct function that tell if a function uses varargs or stdarg. */ #define SETUP_INCOMING_VARARGS(ASF, MODE, TYPE, PAS, ST) do \ - if (! current_function_varargs && ! current_function_stdarg) \ + if (! current_function_stdarg) \ abort (); \ while (0) diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 97f1a2d2606..c3c16e2515f 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -1097,7 +1097,6 @@ extern int sparc_mode_class[]; #define FRAME_POINTER_REQUIRED \ (TARGET_FLAT \ ? (current_function_calls_alloca \ - || current_function_varargs \ || !leaf_function_p ()) \ : ! (leaf_function_p () && only_leaf_regs_used ())) diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 69e42bb901c..019e18a8c1f 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -874,7 +874,7 @@ xstormy16_compute_stack_layout () if (REG_NEEDS_SAVE (regno, ifun)) layout.register_save_size += UNITS_PER_WORD; - if (current_function_varargs || current_function_stdarg) + if (current_function_stdarg) layout.stdarg_save_size = NUM_ARGUMENT_REGISTERS * UNITS_PER_WORD; else layout.stdarg_save_size = 0; diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index ecf87f470ed..eae04a40e1f 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6923,14 +6923,13 @@ Do not include extra scratch space in floating point data blocks. This results in smaller code, but slower execution, since scratch space must be allocated dynamically. -@cindex @file{varargs.h} and RT PC @cindex @file{stdarg.h} and RT PC @item -mfp-arg-in-fpregs @opindex mfp-arg-in-fpregs Use a calling sequence incompatible with the IBM calling convention in which floating point arguments are passed in floating point registers. -Note that @code{varargs.h} and @code{stdarg.h} will not work with -floating point operands if this option is specified. +Note that @code{stdarg.h} will not work with floating point operands +if this option is specified. @item -mfp-arg-in-gregs @opindex mfp-arg-in-gregs diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 9904b52fae9..ac64d8dc17e 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -246,8 +246,8 @@ libraries are also installed by GCC; these are not documented here. Several of the headers GCC installs are in the @file{ginclude} directory. These headers, @file{iso646.h}, -@file{stdarg.h}, @file{stdbool.h}, @file{stddef.h} and -@file{varargs.h}, are installed in @file{@var{libsubdir}/include}, +@file{stdarg.h}, @file{stdbool.h}, and @file{stddef.h}, +are installed in @file{@var{libsubdir}/include}, unless the target Makefile fragment (@pxref{Target Fragment}) overrides this by setting @code{USER_H}. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 813482edc52..d60f43848a0 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -4006,7 +4006,7 @@ arguments. But usually, on such machines, nothing else has been pushed yet, because the function prologue itself does all the pushing.) This region is used on machines where an argument may be passed partly in registers and partly in memory, and, in some cases to support the -features in @code{<varargs.h>} and @code{<stdarg.h>}. +features in @code{<stdarg.h>}. @item An area of memory used to save certain registers used by the function. diff --git a/gcc/doc/trouble.texi b/gcc/doc/trouble.texi index 7cc7e8a53c9..e23cb6b0dfa 100644 --- a/gcc/doc/trouble.texi +++ b/gcc/doc/trouble.texi @@ -892,24 +892,6 @@ You can partially avoid this problem by using the @option{-ffloat-store} option (@pxref{Optimize Options}). @item -On the MIPS, variable argument functions using @file{varargs.h} -cannot have a floating point value for the first argument. The -reason for this is that in the absence of a prototype in scope, -if the first argument is a floating point, it is passed in a -floating point register, rather than an integer register. - -If the code is rewritten to use the ISO standard @file{stdarg.h} -method of variable arguments, and the prototype is in scope at -the time of the call, everything will work fine. - -@item -On the H8/300 and H8/300H, variable argument functions must be -implemented using the ISO standard @file{stdarg.h} method of -variable arguments. Furthermore, calls to functions using @file{stdarg.h} -variable arguments must have a prototype for the called function -in scope at the time of the call. - -@item On AIX and other platforms without weak symbol support, templates need to be instantiated explicitly and symbols for static members of templates will not be generated. diff --git a/gcc/function.c b/gcc/function.c index b2008b184f5..cd25804fb30 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4290,17 +4290,6 @@ assign_parms (fndecl) rtx conversion_insns = 0; struct args_size alignment_pad; - /* Nonzero if the last arg is named `__builtin_va_alist', - which is used on some machines for old-fashioned non-ANSI varargs.h; - this should be stuck onto the stack as if it had arrived there. */ - int hide_last_arg - = (current_function_varargs - && fnargs - && (parm = tree_last (fnargs)) != 0 - && DECL_NAME (parm) - && (! strcmp (IDENTIFIER_POINTER (DECL_NAME (parm)), - "__builtin_va_alist"))); - /* Nonzero if function takes extra anonymous args. This means the last named arg must be on the stack right before the anonymous ones. */ @@ -4369,7 +4358,7 @@ assign_parms (fndecl) /* Set LAST_NAMED if this is last named arg before last anonymous args. */ - if (stdarg || current_function_varargs) + if (stdarg) { tree tem; @@ -4397,11 +4386,6 @@ assign_parms (fndecl) continue; } - /* For varargs.h function, save info about regs and stack space - used by the individual args, not including the va_alist arg. */ - if (hide_last_arg && last_named) - current_function_args_info = args_so_far; - /* Find mode of arg as it is passed, and mode of arg as it should be during execution of this function. */ passed_mode = TYPE_MODE (passed_type); @@ -5125,8 +5109,7 @@ assign_parms (fndecl) /* For stdarg.h function, save info about regs and stack space used by the named args. */ - if (!hide_last_arg) - current_function_args_info = args_so_far; + current_function_args_info = args_so_far; /* Set the rtx used for the function return value. Put this in its own variable so any optimizers that need this information don't have @@ -6278,8 +6261,7 @@ prepare_function_start () /* Indicate we have no need of a frame pointer yet. */ frame_pointer_needed = 0; - /* By default assume not varargs or stdarg. */ - current_function_varargs = 0; + /* By default assume not stdarg. */ current_function_stdarg = 0; /* We haven't made any trampolines for this function yet. */ @@ -6379,15 +6361,6 @@ init_function_for_compilation () VARRAY_GROW (sibcall_epilogue, 0); } -/* Indicate that the current function uses extra args - not explicitly mentioned in the argument list in any fashion. */ - -void -mark_varargs () -{ - current_function_varargs = 1; -} - /* Expand a call to __main at the beginning of a possible main function. */ #if defined(INIT_SECTION_ASM_OP) && !defined(INVOKE__main) diff --git a/gcc/function.h b/gcc/function.h index 3dbd6fd4abd..0ee31d1ed53 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -451,12 +451,7 @@ struct function GTY(()) function. */ unsigned int limit_stack : 1; - /* Nonzero if current function uses varargs.h or equivalent. - Zero for functions that use stdarg.h. */ - unsigned int varargs : 1; - - /* Nonzero if current function uses stdarg.h or equivalent. - Zero for functions that use varargs.h. */ + /* Nonzero if current function uses stdarg.h or equivalent. */ unsigned int stdarg : 1; /* Nonzero if this function is being processed in function-at-a-time @@ -525,7 +520,6 @@ extern int virtuals_instantiated; #define current_function_pretend_args_size (cfun->pretend_args_size) #define current_function_outgoing_args_size (cfun->outgoing_args_size) #define current_function_arg_offset_rtx (cfun->arg_offset_rtx) -#define current_function_varargs (cfun->varargs) #define current_function_stdarg (cfun->stdarg) #define current_function_internal_arg_pointer (cfun->internal_arg_pointer) #define current_function_return_rtx (cfun->return_rtx) diff --git a/gcc/ginclude/stdarg.h b/gcc/ginclude/stdarg.h index 9f6215d31fa..e451c31c53f 100644 --- a/gcc/ginclude/stdarg.h +++ b/gcc/ginclude/stdarg.h @@ -47,18 +47,13 @@ typedef __builtin_va_list __gnuc_va_list; if this invocation was from the user program. */ #ifdef _STDARG_H -/* Note that the type used in va_arg is supposed to match the - actual type **after default promotions**. - Thus, va_arg (..., short) is not valid. */ - -#define va_start(v,l) __builtin_stdarg_start((v),l) -#define va_end __builtin_va_end -#define va_arg __builtin_va_arg +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L -#define va_copy(d,s) __builtin_va_copy((d),(s)) +#define va_copy(d,s) __builtin_va_copy(d,s) #endif -#define __va_copy(d,s) __builtin_va_copy((d),(s)) - +#define __va_copy(d,s) __builtin_va_copy(d,s) /* Define va_list, if desired, from __gnuc_va_list. */ /* We deliberately do not define va_list when called from diff --git a/gcc/ginclude/varargs.h b/gcc/ginclude/varargs.h index 098094cdd7b..4b9803e71ac 100644 --- a/gcc/ginclude/varargs.h +++ b/gcc/ginclude/varargs.h @@ -1,144 +1,7 @@ -/* Copyright (C) 1989, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* As a special exception, if you include this header file into source - files compiled by GCC, this header file does not by itself cause - the resulting executable to be covered by the GNU General Public - License. This exception does not however invalidate any other - reasons why the executable file might be covered by the GNU General - Public License. */ - #ifndef _VARARGS_H #define _VARARGS_H -#ifdef __NeXT__ - -/* On Next, erase any vestiges of stdarg.h. */ - -#ifdef _ANSI_STDARG_H_ -#define _VA_LIST_ -#endif -#define _ANSI_STDARG_H_ - -#undef va_alist -#undef va_dcl -#undef va_list -#undef va_start -#undef va_end -#undef va_arg -#endif /* __NeXT__ */ - -/* These macros implement traditional (non-ANSI) varargs - for GNU C. */ - -#define va_alist __builtin_va_alist - -/* ??? We don't process attributes correctly in K&R argument context. */ -typedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); - -/* ??? It would be nice to get rid of the ellipsis here. It causes - current_function_varargs to be set in cc1. */ -#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... - -/* Define __gnuc_va_list, just as in stdarg.h. */ - -#ifndef __GNUC_VA_LIST -#define __GNUC_VA_LIST -typedef __builtin_va_list __gnuc_va_list; -#endif - -#define va_start(v) __builtin_varargs_start((v)) -#define va_end __builtin_va_end -#define va_arg __builtin_va_arg -#define __va_copy(d,s) __builtin_va_copy((d),(s)) - -/* Define va_list from __gnuc_va_list. */ +#error "GCC no longer implements <varargs.h>." +#error "Revise your code to use <stdarg.h>." -#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ -#undef _VA_LIST -#endif - -#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) -/* SVR4.2 uses _VA_LIST for an internal alias for va_list, - so we must avoid testing it and setting it here. - SVR4 uses _VA_LIST as a flag in stdarg.h, but we should - have no conflict with that. */ -#ifndef _VA_LIST_ -#define _VA_LIST_ -#ifdef __i860__ -#ifndef _VA_LIST -#define _VA_LIST va_list -#endif -#endif /* __i860__ */ -typedef __gnuc_va_list va_list; -#ifdef _SCO_DS -#define __VA_LIST -#endif -#endif /* _VA_LIST_ */ - -#else /* not __svr4__ || _SCO_DS */ - -/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. - But on BSD NET2 we must not test or define or undef it. - (Note that the comments in NET 2's ansi.h - are incorrect for _VA_LIST_--see stdio.h!) */ -/* Michael Eriksson <mer@sics.se> at Thu Sep 30 11:00:57 1993: - Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to - use for va_list (``typedef _VA_LIST_ va_list'') */ -#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) -/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ -#ifndef _VA_LIST_DEFINED -/* The macro _VA_LIST is used in SCO Unix 3.2. */ -#ifndef _VA_LIST -/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ -#ifndef _VA_LIST_T_H -/* The macro __va_list__ is used by BeOS. */ -#ifndef __va_list__ -typedef __gnuc_va_list va_list; -#endif /* not __va_list__ */ -#endif /* not _VA_LIST_T_H */ -#endif /* not _VA_LIST */ -#endif /* not _VA_LIST_DEFINED */ -#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) -#define _VA_LIST_ -#endif -#ifndef _VA_LIST -#define _VA_LIST #endif -#ifndef _VA_LIST_DEFINED -#define _VA_LIST_DEFINED -#endif -#ifndef _VA_LIST_T_H -#define _VA_LIST_T_H -#endif -#ifndef __va_list__ -#define __va_list__ -#endif - -#endif /* not _VA_LIST_, except on certain systems */ - -#endif /* not __svr4__ */ - -/* The next BSD release (if there is one) wants this symbol to be - undefined instead of _VA_LIST_. */ -#ifdef _BSD_VA_LIST -#undef _BSD_VA_LIST -#endif - -#endif /* _VARARGS_H */ diff --git a/gcc/integrate.c b/gcc/integrate.c index ead6d31df80..49fd4482e23 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -178,8 +178,7 @@ function_cannot_inline_p (fndecl) return N_("function cannot be inline"); /* No inlines with varargs. */ - if ((last && TREE_VALUE (last) != void_type_node) - || current_function_varargs) + if (last && TREE_VALUE (last) != void_type_node) return N_("varargs function cannot be inline"); if (current_function_calls_alloca) diff --git a/gcc/sibcall.c b/gcc/sibcall.c index a5d1b867d8b..d13f3a9064a 100644 --- a/gcc/sibcall.c +++ b/gcc/sibcall.c @@ -676,8 +676,7 @@ optimize_sibling_and_tail_recursive_calls () sibling call optimizations, but not tail recursion. Similarly if we use varargs or stdarg since they implicitly may take the address of an argument. */ - if (current_function_calls_alloca - || current_function_varargs || current_function_stdarg) + if (current_function_calls_alloca || current_function_stdarg) sibcall = 0; /* See if there are any reasons we can't perform either sibling or diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4883daf0ef0..77bbae2b7db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,9 +1,21 @@ +2002-07-15 Zack Weinberg <zack@codesourcery.com> + + * c-torture/execute/991216-3.c, c-torture/execute/strct-varg-1.c, + c-torture/execute/va-arg-7.c, c-torture/execute/va-arg-8.c, + c-torture/execute/va-arg-15.c, c-torture/execute/va-arg-16.c, + c-torture/execute/va-arg-17.c, c-torture/execute/va-arg-19.c: + Convert to use <stdarg.h>. + * c-torture/execute/va-arg-3.c, c-torture/execute/va-arg-3.x: + Delete. + * gcc.dg/va-arg-2.c: New. + * lib/gcc.exp, lib/objc.exp: Remove code to set -DNO_VARARGS. + 2002-07-15 Jakub Jelinek <jakub@redhat.com> * gcc.c-torture/compile/20020710-1.c: New test. Thu Jul 11 15:39:21 2002 J"orn Rennecke <joern.rennecke@superh.com> - Andrew Pinski <pinskia@physics.uc.edu> + Andrew Pinski <pinskia@physics.uc.edu> gcc.c-torture/compile/simd-2.c: New testcase. gcc.c-torture/compile/simd-3.c: Likewise. @@ -12,7 +24,7 @@ Thu Jul 11 15:39:21 2002 J"orn Rennecke <joern.rennecke@superh.com> PR c++/7224 * g++.dg/overload/error1.C: New test. - + 2002-07-11 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> * gcc.misc-tests/linkage.exp: Handle mips-sgi-irix6*o32 @@ -28,13 +40,13 @@ Thu Jul 11 15:39:21 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-07-10 Jeffrey A Law <law@redhat.com> - * gcc.c-torture/compile/981006-1.x: Do not use -fpic for mn102. + * gcc.c-torture/compile/981006-1.x: Do not use -fpic for mn102. - * gcc.c-torture/compile/930326-1.x: Remove. No longer needed. + * gcc.c-torture/compile/930326-1.x: Remove. No longer needed. 2002-07-09 Aldy Hernandez <aldyh@redhat.com> - * gcc.dg/20020312-2.c: Check for __PPC__. + * gcc.dg/20020312-2.c: Check for __PPC__. 2002-07-09 Diego Novillo <dnovillo@redhat.com> @@ -57,7 +69,7 @@ Thu Jul 11 15:39:21 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-07-05 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> PR c++/7099 - * g++.dg/warn/noreturn1.C: New test. + * g++.dg/warn/noreturn1.C: New test. 2002-07-03 Mark Mitchell <mark@codesourcery.com> @@ -168,8 +180,8 @@ Mon Jul 1 12:51:05 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-06-27 Aldy Hernandez <aldyh@redhat.com> - * gcc.c-torture/execute/string-opt-8.c (strncmp): Fix typo in - return type. + * gcc.c-torture/execute/string-opt-8.c (strncmp): Fix typo in + return type. Thu Jun 27 15:23:21 2002 J"orn Rennecke <joern.rennecke@superh.com> @@ -269,9 +281,9 @@ Tue Jun 25 21:50:38 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-06-18 Aldy Hernandez <aldyh@redhat.com> - * gcc.c-torture/execute/simd-1.c: New. + * gcc.c-torture/execute/simd-1.c: New. - * gcc.dg/simd-1.c: New. + * gcc.dg/simd-1.c: New. 2002-06-18 Hans-Peter Nilsson <hp@axis.com> @@ -355,7 +367,7 @@ Tue Jun 25 21:50:38 2002 J"orn Rennecke <joern.rennecke@superh.com> 2002-06-04 Aldy Hernandez <aldyh@redhat.com> - * gcc.dg/altivec-2.c: Remove test for invalid vector type V2DF. + * gcc.dg/altivec-2.c: Remove test for invalid vector type V2DF. 2002-06-03 Richard Henderson <rth@redhat.com> diff --git a/gcc/testsuite/gcc.c-torture/execute/991216-3.c b/gcc/testsuite/gcc.c-torture/execute/991216-3.c index 9c58c16b1e3..948b35f9795 100644 --- a/gcc/testsuite/gcc.c-torture/execute/991216-3.c +++ b/gcc/testsuite/gcc.c-torture/execute/991216-3.c @@ -1,17 +1,16 @@ -#include <varargs.h> +#include <stdarg.h> #define VALUE 0x123456789abcdefLL #define AFTER 0x55 void -test (va_alist) - va_dcl +test (int n, ...) { va_list ap; - int i, n; + int i; + + va_start (ap, n); - va_start (ap); - n = va_arg (ap, int); for (i = 2; i <= n; i++) { if (va_arg (ap, int) != i) diff --git a/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c b/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c index f76bb368409..ddd6f05d5ac 100644 --- a/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c +++ b/gcc/testsuite/gcc.c-torture/execute/strct-varg-1.c @@ -1,28 +1,14 @@ -#ifdef NO_VARARGS #include <stdarg.h> -#define va_alist int x_attr, ... -#define va_dcl -#else -#include <varargs.h> -#endif struct s { int x, y; }; -f (va_alist) - va_dcl +f (int attr, ...) { struct s va_values; va_list va; - int attr; int i; -#ifdef NO_VARARGS - va_start (va, x_attr); - attr = x_attr; -#else - va_start (va); - attr = va_arg (va, int); -#endif + va_start (va, attr); if (attr != 2) abort (); diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c index ed1b2e24818..24411f8c404 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-15.c @@ -1,8 +1,6 @@ -#include <varargs.h> +#include <stdarg.h> -void vafunction (dummy, va_alist) - char *dummy; - va_dcl +void vafunction (char *dummy, ...) { double darg; int iarg; @@ -10,7 +8,7 @@ void vafunction (dummy, va_alist) int i; va_list ap; - va_start(ap); + va_start(ap, dummy); for (i = 1; i <= 18; i++, flag++) { if (flag & 1) diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c index f07972113f3..1115ef0855d 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-16.c @@ -1,14 +1,12 @@ -#include <varargs.h> +#include <stdarg.h> typedef double TYPE; -void vafunction (dummy1, dummy2, va_alist) - TYPE dummy1, dummy2; - va_dcl +void vafunction (TYPE dummy1, TYPE dummy2, ...) { va_list ap; - va_start(ap); + va_start(ap, dummy2); if (dummy1 != 888.) abort(); if (dummy2 != 999.) diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c index ff72d59e3b5..17850db1443 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-17.c @@ -1,14 +1,12 @@ -#include <varargs.h> +#include <stdarg.h> typedef double TYPE; -void vafunction (dummy, va_alist) - char *dummy; - va_dcl +void vafunction (char *dummy, ...) { va_list ap; - va_start(ap); + va_start(ap, dummy); if (va_arg (ap, TYPE) != 1.) abort(); if (va_arg (ap, TYPE) != 2.) diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c index d0581742720..9fdf49d89dd 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-19.c @@ -1,14 +1,12 @@ -#include <varargs.h> +#include <stdarg.h> typedef int TYPE; -void vafunction (dummy, va_alist) - char *dummy; - va_dcl +void vafunction (char *dummy, ...) { va_list ap; - va_start(ap); + va_start(ap, dummy); if (va_arg (ap, TYPE) != 1) abort(); if (va_arg (ap, TYPE) != 2) diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-3.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-3.c deleted file mode 100644 index 7b0a0b0cf36..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-3.c +++ /dev/null @@ -1,339 +0,0 @@ -/* Same as va-arg-2.c but using varargs.h. */ -/* The purpose of this test is to catch edge cases when arguments are passed - in regs and on the stack. We test 16 cases, trying to catch multiple - targets (some use 3 regs for argument passing, some use 12, etc.). - We test both the arguments and the `lastarg' (the argument to va_start). */ - -#ifdef NO_VARARGS -int main() -{ - exit (0); -} - -#else -#include <varargs.h> - -extern __SIZE_TYPE__ strlen (); - -int -to_hex (unsigned int a) -{ - static char hex[] = "0123456789abcdef"; - - if (a > 15) - abort (); - return hex[a]; -} - -void -f0 (va_alist) - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 0) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f1 (a1, va_alist) - int a1; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 1) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f2 (a1, a2, va_alist) - int a1, a2; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 2) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f3 (a1, a2, a3, va_alist) - int a1, a2, a3; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 3) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f4 (a1, a2, a3, a4, va_alist) - int a1, a2, a3, a4; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 4) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f5 (a1, a2, a3, a4, a5, va_alist) - int a1, a2, a3, a4, a5; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 5) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f6 (a1, a2, a3, a4, a5, a6, va_alist) - int a1, a2, a3, a4, a5, a6; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 6) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f7 (a1, a2, a3, a4, a5, a6, a7, va_alist) - int a1, a2, a3, a4, a5, a6, a7; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 7) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f8 (a1, a2, a3, a4, a5, a6, a7, a8, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 8) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f9 (a1, a2, a3, a4, a5, a6, a7, a8, a9, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 9) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f10 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 10) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f11 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, - va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 11) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f12 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 12) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f13 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 13) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f14 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 14) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -void -f15 (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, va_alist) - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15; - va_dcl -{ - va_list ap; - char *format; - - va_start (ap); - format = va_arg (ap, char *); - if (strlen (format) != 16 - 15) - abort (); - while (*format) - if (*format++ != to_hex (va_arg (ap, int))) - abort (); - va_end(ap); -} - -main () -{ - char *f = "0123456789abcdef"; - - f0 (f+0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f1 (0, f+1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f2 (0, 1, f+2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f3 (0, 1, 2, f+3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f4 (0, 1, 2, 3, f+4, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f5 (0, 1, 2, 3, 4, f+5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f6 (0, 1, 2, 3, 4, 5, f+6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f7 (0, 1, 2, 3, 4, 5, 6, f+7, 7, 8, 9, 10, 11, 12, 13, 14, 15); - f8 (0, 1, 2, 3, 4, 5, 6, 7, f+8, 8, 9, 10, 11, 12, 13, 14, 15); - f9 (0, 1, 2, 3, 4, 5, 6, 7, 8, f+9, 9, 10, 11, 12, 13, 14, 15); - f10 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, f+10, 10, 11, 12, 13, 14, 15); - f11 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, f+11, 11, 12, 13, 14, 15); - f12 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, f+12, 12, 13, 14, 15); - f13 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, f+13, 13, 14, 15); - f14 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, f+14, 14, 15); - f15 (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, f+15, 15); - - exit (0); -} -#endif /* ! NO_VARARGS */ diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-3.x b/gcc/testsuite/gcc.c-torture/execute/va-arg-3.x deleted file mode 100644 index 865aaf81c54..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-3.x +++ /dev/null @@ -1,12 +0,0 @@ -# This doesn't work on mn10200 - -if { [istarget "mn10200*-*-*"] } { - set torture_execute_xfail "mn10200*-*-*" -} - -if { [istarget "h8300*-*-*"] } { - set torture_execute_xfail "h8300*-*-*" -} - - -return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c index a9022db95d0..f45219a56f5 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-7.c @@ -1,16 +1,15 @@ /* Origin: Franz Sirl <Franz.Sirl-kernel@lauterbach.com> */ -#include <varargs.h> +#include <stdarg.h> inline void -debug(i1, i2, i3, i4, i5, i6, i7, f1, f2, f3, f4, f5, f6, f7, f8, f9, va_alist) - int i1, i2, i3, i4, i5, i6, i7; - double f1, f2, f3, f4, f5, f6, f7, f8, f9; - va_dcl +debug(int i1, int i2, int i3, int i4, int i5, int i6, int i7, + double f1, double f2, double f3, double f4, double f5, + double f6, double f7, double f8, double f9, ...) { va_list ap; - va_start (ap); + va_start (ap, f9); if (va_arg (ap,int) != 8) abort (); @@ -25,7 +24,8 @@ debug(i1, i2, i3, i4, i5, i6, i7, f1, f2, f3, f4, f5, f6, f7, f8, f9, va_alist) int main(void) { - debug (1, 2, 3, 4, 5, 6, 7, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, - 8.0, 9.0, 8, 9, 10); + debug (1, 2, 3, 4, 5, 6, 7, + 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, + 8, 9, 10); exit (0); } diff --git a/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c b/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c index ece5338e4fc..964833b5281 100644 --- a/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/va-arg-8.c @@ -1,6 +1,6 @@ /* Origin: Franz Sirl <Franz.Sirl-kernel@lauterbach.com> */ -#include <varargs.h> +#include <stdarg.h> #include <limits.h> #if __LONG_LONG_MAX__ == 9223372036854775807LL @@ -8,13 +8,12 @@ typedef long long int INT64; inline void -debug(i1, i2, i3, i4, i5, i6, i7, i8, i9, va_alist) - int i1, i2, i3, i4, i5, i6, i7, i8, i9; - va_dcl +debug(int i1, int i2, int i3, int i4, int i5, + int i6, int i7, int i8, int i9, ...) { va_list ap; - va_start (ap); + va_start (ap, i9); if (va_arg (ap,int) != 10) abort (); diff --git a/gcc/testsuite/gcc.dg/va-arg-2.c b/gcc/testsuite/gcc.dg/va-arg-2.c new file mode 100644 index 00000000000..2e2849c1528 --- /dev/null +++ b/gcc/testsuite/gcc.dg/va-arg-2.c @@ -0,0 +1,12 @@ +/* <varargs.h> is not supported anymore, but we do install a stub + file which issues an #error telling the user to convert their code. */ + +/* { dg-do compile } */ + +#include <varargs.h> /* { dg-bogus "varargs.h" "missing file" } */ + +/* { dg-error "" "In file included from" { target *-*-* } 6 } */ +/* { dg-error "no longer implements" "#error 1" { target *-*-* } 4 } */ +/* { dg-error "Revise your code" "#error 2" { target *-*-* } 5 } */ + +int x; /* prevent empty-source-file warning */ diff --git a/gcc/testsuite/lib/gcc.exp b/gcc/testsuite/lib/gcc.exp index 73337556a47..09e5f9e77f9 100644 --- a/gcc/testsuite/lib/gcc.exp +++ b/gcc/testsuite/lib/gcc.exp @@ -149,9 +149,6 @@ proc gcc_target_compile { source dest type options } { if [info exists TOOL_OPTIONS] { lappend options "additional_flags=$TOOL_OPTIONS" } - if [target_info exists gcc,no_varargs] { - lappend options "additional_flags=-DNO_VARARGS" - } if [target_info exists gcc,timeout] { lappend options "timeout=[target_info gcc,timeout]" } diff --git a/gcc/testsuite/lib/objc.exp b/gcc/testsuite/lib/objc.exp index 9042a283dcc..d57b59744f0 100644 --- a/gcc/testsuite/lib/objc.exp +++ b/gcc/testsuite/lib/objc.exp @@ -165,9 +165,6 @@ proc objc_target_compile { source dest type options } { if [info exists TOOL_OPTIONS] { lappend options "additional_flags=$TOOL_OPTIONS" } - if [target_info exists objc,no_varargs] { - lappend options "additional_flags=-DNO_VARARGS" - } # Point to the ObjC headers in libobjc. set objc_include_dir "${srcdir}/../../libobjc" diff --git a/gcc/tree.h b/gcc/tree.h index 84a221822aa..7f8c04970f0 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2899,7 +2899,6 @@ extern void build_common_tree_nodes_2 PARAMS ((int)); extern void setjmp_protect_args PARAMS ((void)); extern void setjmp_protect PARAMS ((tree)); extern void expand_main_function PARAMS ((void)); -extern void mark_varargs PARAMS ((void)); extern void init_dummy_function_start PARAMS ((void)); extern void expand_dummy_function_end PARAMS ((void)); extern void init_function_for_compilation PARAMS ((void)); |