+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.
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)
{
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,
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 (" ");
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);
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
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
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);
}
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
|| 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)
{
puts_filtered (" TYPE_PROTOTYPED");
}
- if (TYPE_VARARGS (type))
+ if (type->has_varargs ())
{
puts_filtered (" TYPE_VARARGS");
}
#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. */
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;
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;
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. */
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);
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);
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;
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);
/* 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)
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. */
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. */
/* 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. */
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))
{