gdb: remove TYPE_VARARGS
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 14 Sep 2020 15:08:02 +0000 (11:08 -0400)
gdb/ChangeLog:

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

Change-Id: Ieea4a64b4bfa4b8be643e68cb403081881133740

17 files changed:
gdb/ChangeLog
gdb/arm-tdep.c
gdb/c-typeprint.c
gdb/compile/compile-c-types.c
gdb/compile/compile-cplus-types.c
gdb/dwarf2/read.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/nds32-tdep.c
gdb/or1k-tdep.c
gdb/riscv-tdep.c
gdb/rust-lang.c
gdb/rx-tdep.c
gdb/s390-tdep.c
gdb/sh-tdep.c
gdb/tic6x-tdep.c
gdb/valops.c

index e8fecf714cfe881d7585eace66aab56dfd88d007..cde84e1159ff92e710744a5d5d728fccdd96e845 100644 (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.
index 1a5017495adf9cf2c5e7d2438a455dadefd24710..1eeaea32dc66e2071b7333d30449a787cfc768b3 100644 (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)
index 37bb16e6daec0273ee9f8c6290a9ff8364f07828..0c2268f8d0aebbb92d87e94d15eb6d25ccc68be7 100644 (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 ("    ");
index 08c8c6b4a9a57d91fbac2d1051f614c26c017254..03536c0ca333c3d3095fa8c456899168b02bea1d 100644 (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);
 
index 8431cbc6c113b850fb0370abe21d491397900cc2..8270defa17ce02c3ab9da71d3df85a09f641a775 100644 (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
index e61eda73de4b5238b60285adc484c1c45c1c9d21..45fdaf863755ff5bc3dc0ccb405d773fbb065f86 100644 (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
index 2ff458af9089df3b4bc7bf8ae0a1d09212992216..5927f5007812775f1dd7e558c380a6d8dd69f6a5 100644 (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");
     }
index e1b0d442f1c569baabf31f40ac1ad71cf19320d0..86d2f8cd9032115eb638904537827e769100e1c8 100644 (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;
index 94ac234d3fb20679afcaa86b0b7cc4b1ff447af7..fc90797f6d0372466111eb52c88e035f4fafc623 100644 (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;
 
index 75df206a2bd409eeebef9074cbbac842d08b80be..6ba6503864fe7fc3a6e3f7aa2628b95685c3fc65 100644 (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.  */
index b86ba6305402c84aaaf4665855125ae37e93d3c8..a79b5f5b0cf628e9207a22c496f14bac4647efa6 100644 (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);
index a0310a0b9d61dcb58897a49276d98f69d8e4d5c5..b8ab59bd207b32152722fa3356e11159a833d4ba 100644 (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);
index 04477945917baa029f55a564ea47a90125cbfd84..6401ef236c8be7f438be52bf673bbd7590f1d98f 100644 (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;
index bc6f98e0484c5890b1053838a03b6f783a746edb..efe650ae03613b5cc7d5dde7fb58f5a17d66c8ac 100644 (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)
index 7aadf9165ca5755c5a3411be4ef962dba133bc0b..2c3342156f41dbb11f2a1ff4a7c0723ddcae19b1 100644 (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.  */
index 57945d21db711f17fad49b0e4c35c44247f9bce9..4227e716622a03d01421f17eba490cc24e55396c 100644 (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.  */
index 60f6041d053888d118903020cb9c65775e0556d9..aba4c70d45e2c437885cc6498231f98f44afa91d 100644 (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))
                  {
This page took 0.047591 seconds and 4 git commands to generate.