diff options
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/builtins.c | 4 | ||||
-rw-r--r-- | gcc/c-aux-info.c | 25 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 4 | ||||
-rw-r--r-- | gcc/config/avr/avr.c | 10 | ||||
-rw-r--r-- | gcc/config/iq2000/iq2000.c | 4 | ||||
-rw-r--r-- | gcc/config/lm32/lm32.c | 6 | ||||
-rw-r--r-- | gcc/config/m68k/m68k.c | 4 | ||||
-rw-r--r-- | gcc/config/mn10300/mn10300.c | 4 | ||||
-rw-r--r-- | gcc/config/pa/pa.c | 4 | ||||
-rw-r--r-- | gcc/config/pa/som.h | 4 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 5 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 2 | ||||
-rw-r--r-- | gcc/function.c | 6 |
16 files changed, 36 insertions, 73 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b103cb..013683f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,20 @@ +2010-08-09 Nathan Froyd <froydnj@codesourcery.com> + + * builtins.c (fold_builtin_next_arg): Use stdarg_p. + * config/arm/arm.c (arm_get_pcs_model): Likewise. + * config/avr/avr.c (init_cumulative_args): Likewise. + * config/iq2000/iq2000.c (iq2000_expand_prologue): Likewise. + * config/lm32/lm32.c (lm32_setup_incoming_varargs): Likewise. + * config/m68k/m68k.c (m68k_return_pops_args): Likewise. + * config/mn10300/mn10300.c (mn10300_builtin_saveregs): Likewise. + * config/pa/pa.c (hppa_builtin_saveregs): Likewise. + * config/pa/som.h (ASM_DECLARE_FUNCTION_NAME): Likewise. + * config/rs6000/rs6000.c (init_cumulative_args): Likewise. + * dwarf2out.c (gen_subprogram_die): Likewise. + * function.c (allocate_struct_function): Likewise. + * c-aux-info.c (gen_formal_list_for_func_dec): Likewise. + (deserves_ellipsis): Delete. + 2010-08-09 Richard Guenther <rguenther@suse.de> * tree-ssa-copy.c (cached_last_copy_of): Remove. diff --git a/gcc/builtins.c b/gcc/builtins.c index 096fec6..3b9ca5a 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -11526,9 +11526,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p) int nargs = call_expr_nargs (exp); tree arg; - if (TYPE_ARG_TYPES (fntype) == 0 - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - == void_type_node)) + if (!stdarg_p (fntype)) { error ("%<va_start%> used in function with fixed args"); return true; diff --git a/gcc/c-aux-info.c b/gcc/c-aux-info.c index 28da8e0..8ec6a13 100644 --- a/gcc/c-aux-info.c +++ b/gcc/c-aux-info.c @@ -42,7 +42,6 @@ static const char *data_type; static char *affix_data_type (const char *) ATTRIBUTE_MALLOC; static const char *gen_formal_list_for_type (tree, formals_style); -static int deserves_ellipsis (tree); static const char *gen_formal_list_for_func_def (tree, formals_style); static const char *gen_type (const char *, tree, formals_style); static const char *gen_decl (tree, int, formals_style); @@ -183,28 +182,6 @@ gen_formal_list_for_type (tree fntype, formals_style style) return concat (" (", formal_list, ")", NULL); } -/* For the generation of an ANSI prototype for a function definition, we have - to look at the formal parameter list of the function's own "type" to - determine if the function's formal parameter list should end with an - ellipsis. Given a tree node, the following function will return nonzero - if the "function type" parameter list should end with an ellipsis. */ - -static int -deserves_ellipsis (tree fntype) -{ - tree formal_type; - - formal_type = TYPE_ARG_TYPES (fntype); - while (formal_type && TREE_VALUE (formal_type) != void_type_node) - formal_type = TREE_CHAIN (formal_type); - - /* If there were at least some parameters, and if the formals-types-list - petered out to a NULL (i.e. without being terminated by a void_type_node) - then we need to tack on an ellipsis. */ - - return (!formal_type && TYPE_ARG_TYPES (fntype)); -} - /* Generate a parameter list for a function definition (in some given style). Note that this routine has to be separate (and different) from the code that @@ -248,7 +225,7 @@ gen_formal_list_for_func_def (tree fndecl, formals_style style) { if (!DECL_ARGUMENTS (fndecl)) formal_list = concat (formal_list, "void", NULL); - if (deserves_ellipsis (TREE_TYPE (fndecl))) + if (stdarg_p (TREE_TYPE (fndecl))) formal_list = concat (formal_list, ", ...", NULL); } if ((style == ansi) || (style == k_and_r_names)) diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a406c29..d0ea6e1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -3717,9 +3717,7 @@ arm_get_pcs_model (const_tree type, const_tree decl) /* Detect varargs functions. These always use the base rules (no argument is ever a candidate for a co-processor register). */ - bool base_rules = (TYPE_ARG_TYPES (type) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (type))) - != void_type_node)); + bool base_rules = stdarg_p (type); if (user_convention) { diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 87393f2..e8d6fa3 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1530,14 +1530,8 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname, { cum->nregs = 18; cum->regno = FIRST_CUM_REG; - if (!libname && fntype) - { - int stdarg = (TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)); - if (stdarg) - cum->nregs = 0; - } + if (!libname && stdarg_p (fntype)) + cum->nregs = 0; } /* Returns the number of registers to allocate for a function argument. */ diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 71642099..b152d1a 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -1996,9 +1996,7 @@ iq2000_expand_prologue (void) /* If this function is a varargs function, store any registers that would normally hold arguments ($4 - $7) on the stack. */ if (store_args_on_stack - && ((TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)) + && (stdarg_p (fntype) || last_arg_is_vararg_marker)) { int offset = (regno - GP_ARG_FIRST) * UNITS_PER_WORD; diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c index 2bcbe67..e601693 100644 --- a/gcc/config/lm32/lm32.c +++ b/gcc/config/lm32/lm32.c @@ -656,14 +656,10 @@ lm32_setup_incoming_varargs (CUMULATIVE_ARGS * cum, enum machine_mode mode, { int first_anon_arg; tree fntype; - int stdarg_p; fntype = TREE_TYPE (current_function_decl); - stdarg_p = (TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)); - if (stdarg_p) + if (stdarg_p (fntype)) first_anon_arg = *cum + LM32_FIRST_ARG_REG; else { diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 566b8d2..d903246 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -6540,9 +6540,7 @@ m68k_return_pops_args (tree fundecl, tree funtype, int size) return ((TARGET_RTD && (!fundecl || TREE_CODE (fundecl) != IDENTIFIER_NODE) - && (TYPE_ARG_TYPES (funtype) == 0 - || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (funtype))) - == void_type_node))) + && (!stdarg_p (funtype))) ? size : 0); } diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 1243a33..b55ca37 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -1493,9 +1493,7 @@ mn10300_builtin_saveregs (void) { rtx offset, mem; tree fntype = TREE_TYPE (current_function_decl); - int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node))) + int argadj = ((!stdarg_p (fntype)) ? UNITS_PER_WORD : 0); alias_set_type set = get_varargs_alias_set (); diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 96acecb..6593e53 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -5944,9 +5944,7 @@ hppa_builtin_saveregs (void) { rtx offset, dest; tree fntype = TREE_TYPE (current_function_decl); - int argadj = ((!(TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node))) + int argadj = ((!stdarg_p (fntype)) ? UNITS_PER_WORD : 0); if (argadj) diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h index 8be8def..53dddb7 100644 --- a/gcc/config/pa/som.h +++ b/gcc/config/pa/som.h @@ -157,9 +157,7 @@ do { \ } \ } \ /* anonymous args */ \ - if (TYPE_ARG_TYPES (tree_type) != 0 \ - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (tree_type)))\ - != void_type_node)) \ + if (stdarg_p (tree_type)) \ { \ 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 5d465b8..2621af9 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7369,10 +7369,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, cum->call_cookie = ((DEFAULT_ABI == ABI_V4 && libcall) ? CALL_LIBCALL : CALL_NORMAL); cum->sysv_gregno = GP_ARG_MIN_REG; - cum->stdarg = fntype - && (TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)); + cum->stdarg = stdarg_p (fntype); cum->nargs_prototype = 0; if (incoming || cum->prototype) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 85a84d0..3f50885 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2010-08-09 Nathan Froyd <froydnj@codesourcery.com> + + * tree.c (varargs_function_p): Use stdarg_p. + 2010-08-07 Nathan Froyd <froydnj@codesourcery.com> * parser.c (cp_default_arg_entry): Declare. Declare a VEC of it. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 5441448..af5a82f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -2284,11 +2284,7 @@ error_type (tree arg) int varargs_function_p (const_tree function) { - const_tree parm = TYPE_ARG_TYPES (TREE_TYPE (function)); - for (; parm; parm = TREE_CHAIN (parm)) - if (TREE_VALUE (parm) == void_type_node) - return 0; - return 1; + return stdarg_p (TREE_TYPE (function)); } /* Returns 1 if decl is a member of a class. */ diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8e6f94f..0f3bea8 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -18927,7 +18927,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die) if (fn_arg_types != NULL) { /* This is the prototyped case, check for.... */ - if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node) + if (stdarg_p (TREE_TYPE (decl))) gen_unspecified_parameters_die (decl, subr_die); } else if (DECL_INITIAL (decl) == NULL_TREE) diff --git a/gcc/function.c b/gcc/function.c index a540d05..5a4dc10 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -4293,11 +4293,7 @@ allocate_struct_function (tree fndecl, bool abstract_p) cfun->returns_struct = 1; } - cfun->stdarg - = (fntype - && TYPE_ARG_TYPES (fntype) != 0 - && (TREE_VALUE (tree_last (TYPE_ARG_TYPES (fntype))) - != void_type_node)); + cfun->stdarg = stdarg_p (fntype); /* Assume all registers in stdarg functions need to be saved. */ cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE; |