gdb: remove TYPE_VARARGS

gdb/ChangeLog:

	* gdbtypes.h (TYPE_VARARGS): Remove, replace all
	uses with type::has_varargs.

Change-Id: Ieea4a64b4bfa4b8be643e68cb403081881133740
This commit is contained in:
Simon Marchi 2020-09-14 11:08:02 -04:00
parent 1d6286ed04
commit a409645d13
17 changed files with 30 additions and 27 deletions

View file

@ -1,3 +1,8 @@
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (TYPE_VARARGS): Remove, replace all
uses with type::has_varargs.
2020-09-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <has_varargs, set_has_varargs>: New methods.

View file

@ -3694,7 +3694,7 @@ arm_vfp_abi_for_function (struct gdbarch *gdbarch, struct type *func_type)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Variadic functions always use the base ABI. Assume that functions
without debug info are not variadic. */
if (func_type && TYPE_VARARGS (check_typedef (func_type)))
if (func_type && check_typedef (func_type)->has_varargs ())
return 0;
/* The VFP ABI is only supported as a variant of AAPCS. */
if (tdep->arm_abi != ARM_ABI_AAPCS)

View file

@ -279,7 +279,7 @@ cp_type_print_method_args (struct type *mtype, const char *prefix,
{
struct field *args = mtype->fields ();
int nargs = mtype->num_fields ();
int varargs = TYPE_VARARGS (mtype);
int varargs = mtype->has_varargs ();
int i;
fprintf_symbol_filtered (stream, prefix,
@ -591,12 +591,12 @@ c_type_print_args (struct type *type, struct ui_file *stream,
printed_any = 1;
}
if (printed_any && TYPE_VARARGS (type))
if (printed_any && type->has_varargs ())
{
/* Print out a trailing ellipsis for varargs functions. Ignore
TYPE_VARARGS if the function has no named arguments; that
represents unprototyped (K&R style) C functions. */
if (printed_any && TYPE_VARARGS (type))
if (printed_any && type->has_varargs ())
{
fprintf_filtered (stream, ", ");
wrap_here (" ");

View file

@ -153,7 +153,7 @@ convert_func (compile_c_instance *context, struct type *type)
int i;
gcc_type result, return_type;
struct gcc_type_array array;
int is_varargs = TYPE_VARARGS (type) || !type->is_prototyped ();
int is_varargs = type->has_varargs () || !type->is_prototyped ();
struct type *target_type = TYPE_TARGET_TYPE (type);

View file

@ -964,7 +964,7 @@ static gcc_type
compile_cplus_convert_func (compile_cplus_instance *instance,
struct type *type, bool strip_artificial)
{
int is_varargs = TYPE_VARARGS (type);
int is_varargs = type->has_varargs ();
struct type *target_type = TYPE_TARGET_TYPE (type);
/* Functions with no debug info have no return type. Ideally we'd

View file

@ -15631,7 +15631,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
TYPE_TARGET_TYPE (this_type),
this_type->fields (),
this_type->num_fields (),
TYPE_VARARGS (this_type));
this_type->has_varargs ());
/* Handle static member functions.
Dwarf2 has no clean way to discern C++ static and non-static
@ -15847,7 +15847,7 @@ quirk_gcc_member_function_pointer (struct type *type, struct objfile *objfile)
new_type = alloc_type (objfile);
smash_to_method_type (new_type, self_type, TYPE_TARGET_TYPE (pfn_type),
pfn_type->fields (), pfn_type->num_fields (),
TYPE_VARARGS (pfn_type));
pfn_type->has_varargs ());
smash_to_methodptr_type (type, new_type);
}
@ -17352,7 +17352,7 @@ read_tag_ptr_to_member_type (struct die_info *die, struct dwarf2_cu *cu)
smash_to_method_type (new_type, domain, TYPE_TARGET_TYPE (to_type),
to_type->fields (), to_type->num_fields (),
TYPE_VARARGS (to_type));
to_type->has_varargs ());
type = lookup_methodptr_type (new_type);
}
else

View file

@ -3992,7 +3992,7 @@ check_types_equal (struct type *type1, struct type *type2,
|| type1->is_unsigned () != type2->is_unsigned ()
|| type1->has_no_signedness () != type2->has_no_signedness ()
|| TYPE_ENDIANITY_NOT_DEFAULT (type1) != TYPE_ENDIANITY_NOT_DEFAULT (type2)
|| TYPE_VARARGS (type1) != TYPE_VARARGS (type2)
|| type1->has_varargs () != type2->has_varargs ()
|| TYPE_VECTOR (type1) != TYPE_VECTOR (type2)
|| TYPE_NOTTEXT (type1) != TYPE_NOTTEXT (type2)
|| TYPE_INSTANCE_FLAGS (type1) != TYPE_INSTANCE_FLAGS (type2)
@ -5088,7 +5088,7 @@ recursive_dump_type (struct type *type, int spaces)
{
puts_filtered (" TYPE_PROTOTYPED");
}
if (TYPE_VARARGS (type))
if (type->has_varargs ())
{
puts_filtered (" TYPE_VARARGS");
}

View file

@ -216,11 +216,6 @@ DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
#define TYPE_ENDIANITY_NOT_DEFAULT(t) (TYPE_MAIN_TYPE (t)->flag_endianity_not_default)
/* * FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
#define TYPE_VARARGS(t) ((t)->has_varargs ())
/* * Identify a vector type. Gcc is handling this by adding an extra
attribute to the array type. We slurp that in as a new flag of a
type. This is used only in dwarf2read.c. */
@ -1108,6 +1103,9 @@ struct type
this->main_type->m_flag_prototyped = is_prototyped;
}
/* FIXME drow/2002-06-03: Only used for methods, but applies as well
to functions. */
bool has_varargs () const
{
return this->main_type->m_flag_varargs;

View file

@ -1495,7 +1495,7 @@ nds32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
For ABI2FP+, the caller pushes only named arguments in registers
and pushes all unnamed arguments in stack. */
if (abi_use_fpr && TYPE_VARARGS (func_type)
if (abi_use_fpr && func_type->has_varargs ()
&& i >= func_type->num_fields ())
goto use_stack;

View file

@ -635,7 +635,7 @@ or1k_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = TYPE_LENGTH (arg_type);
enum type_code typecode = arg_type->code ();
if (TYPE_VARARGS (func_type) && argnum >= func_type->num_fields ())
if (func_type->has_varargs () && argnum >= func_type->num_fields ())
break; /* end or regular args, varargs go to stack. */
/* Extract the value, either a reference or the data. */

View file

@ -2589,7 +2589,7 @@ riscv_push_dummy_call (struct gdbarch *gdbarch,
arg_type = check_typedef (value_type (arg_value));
riscv_arg_location (gdbarch, info, &call_info, arg_type,
TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
ftype->has_varargs () && i >= ftype->num_fields ());
if (info->type != arg_type)
arg_value = value_cast (info->type, arg_value);

View file

@ -779,7 +779,7 @@ rust_internal_print_type (struct type *type, const char *varstring,
case TYPE_CODE_FUNC:
/* Delegate varargs to the C printer. */
if (TYPE_VARARGS (type))
if (type->has_varargs ())
goto c_printer;
fputs_filtered ("fn ", stream);

View file

@ -686,7 +686,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
requiring multiple registers, etc. We rely instead on the value
of the ``arg_reg'' variable to get these other details correct. */
if (TYPE_VARARGS (func_type))
if (func_type->has_varargs ())
num_register_candidate_args = func_type->num_fields () - 1;
else
num_register_candidate_args = 4;

View file

@ -1939,7 +1939,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
and arg_state.argp with the size of the parameter area. */
for (i = 0; i < nargs; i++)
s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
ftype->has_varargs () && i >= ftype->num_fields ());
param_area_start = align_down (arg_state.copy - arg_state.argp, 8);
@ -1966,7 +1966,7 @@ s390_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Write all parameters. */
for (i = 0; i < nargs; i++)
s390_handle_arg (&arg_state, args[i], tdep, word_size, byte_order,
TYPE_VARARGS (ftype) && i >= ftype->num_fields ());
ftype->has_varargs () && i >= ftype->num_fields ());
/* Store return PSWA. In 31-bit mode, keep addressing mode bit. */
if (word_size == 4)

View file

@ -1083,7 +1083,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
&& TYPE_VARARGS (func_type))
&& func_type->has_varargs ())
last_reg_arg = func_type->num_fields () - 2;
/* First force sp to a 4-byte alignment. */
@ -1224,7 +1224,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch,
non-vararg argument to be on the stack, no matter how many
registers have been used so far. */
if (sh_is_renesas_calling_convention (func_type)
&& TYPE_VARARGS (func_type))
&& func_type->has_varargs ())
last_reg_arg = func_type->num_fields () - 2;
/* First force sp to a 4-byte alignment. */

View file

@ -889,7 +889,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* For a variadic C function, the last explicitly declared argument and all
remaining arguments are passed on the stack. */
if (TYPE_VARARGS (func_type))
if (func_type->has_varargs ())
first_arg_on_stack = func_type->num_fields () - 1;
/* Now make space on the stack for the args. */

View file

@ -2010,7 +2010,7 @@ search_struct_method (const char *name, struct value **arg1p,
while (j >= 0)
{
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
TYPE_VARARGS (TYPE_FN_FIELD_TYPE (f, j)),
TYPE_FN_FIELD_TYPE (f, j)->has_varargs (),
TYPE_FN_FIELD_TYPE (f, j)->num_fields (),
TYPE_FN_FIELD_ARGS (f, j), args))
{