]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove TYPE_*_PROP macros
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 23 Oct 2025 19:06:58 +0000 (15:06 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 24 Oct 2025 15:16:47 +0000 (11:16 -0400)
Remove the macros in favor of using the dyn_prop member function
directly.

Change-Id: I29758ea408610a2df0a6a226327d1f1af39a178d
Approved-By: Tom Tromey <tom@tromey.com>
gdb/f-lang.c
gdb/f-typeprint.c
gdb/gdbtypes.c
gdb/gdbtypes.h
gdb/value.c

index 1aa9fc497d792f4b4495f2fcc95b7956b66b4a37..2720373e4f49f56ab5bf0e3a5fac003683c5e646 100644 (file)
@@ -404,7 +404,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
   /* All Fortran pointers should have the associated property, this is
      how we know the pointer is pointing at something or not.  */
   struct type *pointer_type = check_typedef (pointer->type ());
-  if (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
+  if (pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr
       && pointer_type->code () != TYPE_CODE_PTR)
     error (_("ASSOCIATED can only be applied to pointers"));
 
@@ -431,7 +431,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
         This is probably true for most targets, but might not be true for
         everyone.  */
       if (pointer_type->code () == TYPE_CODE_PTR
-         && TYPE_ASSOCIATED_PROP (pointer_type) == nullptr)
+         && pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr)
        is_associated = (pointer_addr != 0);
       else
        is_associated = !type_not_associated (pointer_type);
@@ -469,7 +469,7 @@ fortran_associated (struct gdbarch *gdbarch, const language_defn *lang,
      most targets, but might not be true for everyone.  */
   if (target->lval () != lval_memory
       || type_not_associated (pointer_type)
-      || (TYPE_ASSOCIATED_PROP (pointer_type) == nullptr
+      || (pointer_type->dyn_prop (DYN_PROP_ASSOCIATED) == nullptr
          && pointer_type->code () == TYPE_CODE_PTR
          && pointer_addr == 0))
     return value_from_longest (result_type, 0);
index 04eca74fb2bf99a2ec871f0f1c247aa301d1c2c4..3d3548475eb5990a55e3f6e0ef7236e2982c065b 100644 (file)
@@ -173,12 +173,12 @@ f_language::f_type_print_varspec_suffix (struct type *type,
        print_rank_only = true;
       else if (type_not_allocated (type))
        print_rank_only = true;
-      else if ((TYPE_ASSOCIATED_PROP (type)
-               && !TYPE_ASSOCIATED_PROP (type)->is_constant ())
-              || (TYPE_ALLOCATED_PROP (type)
-                  && !TYPE_ALLOCATED_PROP (type)->is_constant ())
-              || (TYPE_DATA_LOCATION (type)
-                  && !TYPE_DATA_LOCATION (type)->is_constant ()))
+      else if ((type->dyn_prop (DYN_PROP_ASSOCIATED)
+               && !type->dyn_prop (DYN_PROP_ASSOCIATED)->is_constant ())
+              || (type->dyn_prop (DYN_PROP_ALLOCATED)
+                  && !type->dyn_prop (DYN_PROP_ALLOCATED)->is_constant ())
+              || (type->dyn_prop (DYN_PROP_DATA_LOCATION)
+                  && !type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ()))
        {
          /* This case exist when we ptype a typename which has the dynamic
             properties but cannot be resolved as there is no object.  */
index 6c366829eb8f0dd8bb23a9a35463fab2aad74173..c396d6574d9acfac2c5ac525349afd94617519f3 100644 (file)
@@ -2072,15 +2072,15 @@ is_dynamic_type_internal (struct type *type, bool top_level)
      but it makes sense in this context, because the point is to determine
      whether any part of the type needs to be resolved before it can
      be exploited.  */
-  if (TYPE_DATA_LOCATION (type) != NULL
+  if (type->dyn_prop (DYN_PROP_DATA_LOCATION) != NULL
       && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
          || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
     return true;
 
-  if (TYPE_ASSOCIATED_PROP (type))
+  if (type->dyn_prop (DYN_PROP_ASSOCIATED))
     return true;
 
-  if (TYPE_ALLOCATED_PROP (type))
+  if (type->dyn_prop (DYN_PROP_ALLOCATED))
     return true;
 
   struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_VARIANT_PARTS);
@@ -2316,7 +2316,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
      not allocated/associated, as such we just ignore this property.  This
      is fine as GDB only checks the allocated/associated on the outer most
      dimension of the array.  */
-  prop = TYPE_ALLOCATED_PROP (type);
+  prop = type->dyn_prop (DYN_PROP_ALLOCATED);
   if (prop != NULL && resolve_p
       && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     {
@@ -2325,7 +2325,7 @@ resolve_dynamic_array_or_string_1 (struct type *type,
        resolve_p = false;
     }
 
-  prop = TYPE_ASSOCIATED_PROP (type);
+  prop = type->dyn_prop (DYN_PROP_ASSOCIATED);
   if (prop != NULL && resolve_p
       && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     {
@@ -2429,7 +2429,7 @@ resolve_dynamic_array_or_string (struct type *type,
   type = copy_type (type);
 
   /* Resolve the rank property to get rank value.  */
-  struct dynamic_prop *prop = TYPE_RANK_PROP (type);
+  struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_RANK);
   if (dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     {
       prop->set_const_val (value);
@@ -2889,7 +2889,7 @@ resolve_dynamic_type_internal (struct type *type,
     return type;
 
   std::optional<CORE_ADDR> type_length;
-  prop = TYPE_DYNAMIC_LENGTH (type);
+  prop = type->dyn_prop (DYN_PROP_BYTE_SIZE);
   if (prop != NULL
       && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     type_length = value;
@@ -2972,7 +2972,7 @@ resolve_dynamic_type_internal (struct type *type,
     }
 
   /* Resolve data_location attribute.  */
-  prop = TYPE_DATA_LOCATION (resolved_type);
+  prop = resolved_type->dyn_prop (DYN_PROP_DATA_LOCATION);
   if (prop != NULL
       && dwarf2_evaluate_property (prop, frame, addr_stack, &value))
     {
@@ -4525,7 +4525,7 @@ types_deeply_equal (struct type *type1, struct type *type2)
 int
 type_not_allocated (const struct type *type)
 {
-  struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
+  struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_ALLOCATED);
 
   return prop != nullptr && prop->is_constant () && prop->const_val () == 0;
 }
@@ -4536,7 +4536,7 @@ type_not_allocated (const struct type *type)
 int
 type_not_associated (const struct type *type)
 {
-  struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
+  struct dynamic_prop *prop = type->dyn_prop (DYN_PROP_ASSOCIATED);
 
   return prop != nullptr && prop->is_constant () && prop->const_val () == 0;
 }
@@ -5367,21 +5367,21 @@ recursive_dump_type (struct type *type, int spaces)
     }
   gdb_puts ("\n");
   gdb_printf ("%*snfields %d ", spaces, "", type->num_fields ());
-  if (TYPE_ASSOCIATED_PROP (type) != nullptr
-      || TYPE_ALLOCATED_PROP (type) != nullptr)
+  if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr
+      || type->dyn_prop (DYN_PROP_ALLOCATED) != nullptr)
     {
       gdb_printf ("%*s", spaces, "");
-      if (TYPE_ASSOCIATED_PROP (type) != nullptr)
+      if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr)
        {
          gdb_printf ("associated ");
-         dump_dynamic_prop (*TYPE_ASSOCIATED_PROP (type));
+         dump_dynamic_prop (*type->dyn_prop (DYN_PROP_ASSOCIATED));
        }
-      if (TYPE_ALLOCATED_PROP (type) != nullptr)
+      if (type->dyn_prop (DYN_PROP_ALLOCATED) != nullptr)
        {
-         if (TYPE_ASSOCIATED_PROP (type) != nullptr)
+         if (type->dyn_prop (DYN_PROP_ASSOCIATED) != nullptr)
            gdb_printf ("  ");
          gdb_printf ("allocated ");
-         dump_dynamic_prop (*TYPE_ALLOCATED_PROP (type));
+         dump_dynamic_prop (*type->dyn_prop (DYN_PROP_ALLOCATED));
        }
       gdb_printf ("\n");
     }
index 5abca515ac50c46192b51258482bb27b24e6cdce..820a90bcbab994e784b47eee09dd669e1d6a5c05 100644 (file)
@@ -1932,24 +1932,12 @@ extern unsigned type_align (struct type *);
 extern bool set_type_align (struct type *, ULONGEST);
 
 /* Property accessors for the type data location.  */
-#define TYPE_DATA_LOCATION(thistype) \
-  ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
 #define TYPE_DATA_LOCATION_BATON(thistype) \
-  TYPE_DATA_LOCATION (thistype)->data.baton
+  ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->data.baton)
 #define TYPE_DATA_LOCATION_ADDR(thistype) \
-  (TYPE_DATA_LOCATION (thistype)->const_val ())
+  ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->const_val ())
 #define TYPE_DATA_LOCATION_KIND(thistype) \
-  (TYPE_DATA_LOCATION (thistype)->kind ())
-#define TYPE_DYNAMIC_LENGTH(thistype) \
-  ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
-
-/* Property accessors for the type allocated/associated.  */
-#define TYPE_ALLOCATED_PROP(thistype) \
-  ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
-#define TYPE_ASSOCIATED_PROP(thistype) \
-  ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
-#define TYPE_RANK_PROP(thistype) \
-  ((thistype)->dyn_prop (DYN_PROP_RANK))
+  ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION)->kind ())
 
 /* C++ */
 
index ea24275c4f63b8b334497ee1ca39fb4f010fec50..7e530757567cecb4575aa9ce8f3395c25ca8e876 100644 (file)
@@ -1422,9 +1422,9 @@ value::address () const
     return 0;
   if (m_parent != NULL)
     return m_parent->address () + m_offset;
-  if (NULL != TYPE_DATA_LOCATION (type ()))
+  if (NULL != type ()->dyn_prop (DYN_PROP_DATA_LOCATION))
     {
-      gdb_assert (TYPE_DATA_LOCATION (type ())->is_constant ());
+      gdb_assert (type ()->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ());
       return TYPE_DATA_LOCATION_ADDR (type ());
     }
 
@@ -1658,15 +1658,15 @@ value::set_component_location (const struct value *whole)
   /* If the WHOLE value has a dynamically resolved location property then
      update the address of the COMPONENT.  */
   type = whole->type ();
-  if (NULL != TYPE_DATA_LOCATION (type)
-      && TYPE_DATA_LOCATION (type)->is_constant ())
+  if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION)
+      && type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
     set_address (TYPE_DATA_LOCATION_ADDR (type));
 
   /* Similarly, if the COMPONENT value has a dynamically resolved location
      property then update its address.  */
   type = this->type ();
-  if (NULL != TYPE_DATA_LOCATION (type)
-      && TYPE_DATA_LOCATION (type)->is_constant ())
+  if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION)
+      && type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
     {
       /* If the COMPONENT has a dynamic location, and is an
         lval_internalvar_component, then we change it to a lval_memory.
@@ -3107,13 +3107,13 @@ value::primitive_field (LONGEST offset, int fieldno, struct type *arg_type)
       v->set_offset (this->offset ());
       v->set_embedded_offset (offset + embedded_offset () + boffset);
     }
-  else if (NULL != TYPE_DATA_LOCATION (type))
+  else if (NULL != type->dyn_prop (DYN_PROP_DATA_LOCATION))
     {
       /* Field is a dynamic data member.  */
 
       gdb_assert (0 == offset);
       /* We expect an already resolved data location.  */
-      gdb_assert (TYPE_DATA_LOCATION (type)->is_constant ());
+      gdb_assert (type->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ());
       /* For dynamic data types defer memory allocation
         until we actual access the value.  */
       v = value::allocate_lazy (type);
@@ -3683,8 +3683,8 @@ value_from_contents_and_address (struct type *type,
     v = value::allocate_lazy (resolved_type);
   else
     v = value_from_contents (resolved_type, valaddr);
-  if (TYPE_DATA_LOCATION (resolved_type_no_typedef) != NULL
-      && TYPE_DATA_LOCATION (resolved_type_no_typedef)->is_constant ())
+  if (resolved_type_no_typedef->dyn_prop (DYN_PROP_DATA_LOCATION) != NULL
+      && resolved_type_no_typedef->dyn_prop (DYN_PROP_DATA_LOCATION)->is_constant ())
     address = TYPE_DATA_LOCATION_ADDR (resolved_type_no_typedef);
   v->set_lval (lval_memory);
   v->set_address (address);