[PATCH 0/3] Remove last dynamic prop macros

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/3] Remove last dynamic prop macros

Sourceware - gdb-patches mailing list
I found these macros, which should probably have been removed in the
previous type macros series.  This series does it.

 gdb/f-typeprint.c | 6 +++---
 gdb/gdbtypes.c    | 8 ++++----
 gdb/gdbtypes.h    | 8 --------
 3 files changed, 7 insertions(+), 15 deletions(-)

--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON

Sourceware - gdb-patches mailing list
This macro is now unused.

gdb/ChangeLog:

        * gdbtypes.h (TYPE_DYN_PROP_BATON): Remove.

Change-Id: I6daead794f7ecb516cc59f9e05262c894515fad3
---
 gdb/gdbtypes.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index eaa4cff608d7..9ea23718ffb5 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1636,8 +1636,6 @@ extern bool set_type_align (struct type *, ULONGEST);
   ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
 
 /* Attribute accessors for dynamic properties.  */
-#define TYPE_DYN_PROP_BATON(dynprop) \
-  dynprop->data.baton
 #define TYPE_DYN_PROP_ADDR(dynprop) \
   (dynprop->const_val ())
 #define TYPE_DYN_PROP_KIND(dynprop) \
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/3] gdb: remove TYPE_DYN_PROP_KIND

Sourceware - gdb-patches mailing list
In reply to this post by Sourceware - gdb-patches mailing list
Replace uses with calling the dynamic_prop::kind method directly.

gdb/ChangeLog:

        * gdbtypes.h (TYPE_DYN_PROP_KIND): Remove, replace uses with
        dynamic_prop::kind.

Change-Id: I78a3e2890f0b3e3950e9a19ad657b976cbb9610b
---
 gdb/f-typeprint.c | 6 +++---
 gdb/gdbtypes.c    | 8 ++++----
 gdb/gdbtypes.h    | 2 --
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index 65ec93af9f41..c3a01673d2bc 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -196,11 +196,11 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
       else if (type_not_allocated (type))
  print_rank_only = true;
       else if ((TYPE_ASSOCIATED_PROP (type)
- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
+ && PROP_CONST != TYPE_ASSOCIATED_PROP (type)->kind ())
        || (TYPE_ALLOCATED_PROP (type)
-   && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
+   && PROP_CONST != TYPE_ALLOCATED_PROP (type)->kind ())
        || (TYPE_DATA_LOCATION (type)
-   && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
+   && PROP_CONST != TYPE_DATA_LOCATION (type)->kind ()))
  {
   /* This case exist when we ptype a typename which has the dynamic
      properties but cannot be resolved as there is no object.  */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index e87648813ec5..4b1f40ab77dc 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4133,8 +4133,8 @@ type_not_allocated (const struct type *type)
 {
   struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
 
-  return (prop && TYPE_DYN_PROP_KIND (prop) == PROP_CONST
-         && !TYPE_DYN_PROP_ADDR (prop));
+  return (prop != nullptr && prop->kind () == PROP_CONST
+  && !TYPE_DYN_PROP_ADDR (prop));
 }
 
 /* Associated status of type TYPE.  Return zero if type TYPE is associated.
@@ -4145,8 +4145,8 @@ type_not_associated (const struct type *type)
 {
   struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
 
-  return (prop && TYPE_DYN_PROP_KIND (prop) == PROP_CONST
-         && !TYPE_DYN_PROP_ADDR (prop));
+  return (prop != nullptr && prop->kind () == PROP_CONST
+  && !TYPE_DYN_PROP_ADDR (prop));
 }
 
 /* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR.  */
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 9ea23718ffb5..de54a5ed73b6 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1638,8 +1638,6 @@ extern bool set_type_align (struct type *, ULONGEST);
 /* Attribute accessors for dynamic properties.  */
 #define TYPE_DYN_PROP_ADDR(dynprop) \
   (dynprop->const_val ())
-#define TYPE_DYN_PROP_KIND(dynprop) \
-  (dynprop->kind ())
 
 /* C++ */
 
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR

Sourceware - gdb-patches mailing list
In reply to this post by Sourceware - gdb-patches mailing list
Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling
dynamic_prop::const_val directly.

gdb/ChangeLog:

        * gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with
        dynamic_prop::const_val.

Change-Id: Ie99b9cd9a0627488c1c69a75e57f020d34e392af
---
 gdb/gdbtypes.c | 4 ++--
 gdb/gdbtypes.h | 4 ----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 4b1f40ab77dc..0cd4b194d982 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4134,7 +4134,7 @@ type_not_allocated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-  && !TYPE_DYN_PROP_ADDR (prop));
+  && prop->const_val () != 0);
 }
 
 /* Associated status of type TYPE.  Return zero if type TYPE is associated.
@@ -4146,7 +4146,7 @@ type_not_associated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-  && !TYPE_DYN_PROP_ADDR (prop));
+  && prop->const_val () != 0);
 }
 
 /* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR.  */
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index de54a5ed73b6..55a6dafb7e29 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1635,10 +1635,6 @@ extern bool set_type_align (struct type *, ULONGEST);
 #define TYPE_ASSOCIATED_PROP(thistype) \
   ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
 
-/* Attribute accessors for dynamic properties.  */
-#define TYPE_DYN_PROP_ADDR(dynprop) \
-  (dynprop->const_val ())
-
 /* C++ */
 
 #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
--
2.28.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/3] Remove last dynamic prop macros

Tom Tromey-2
In reply to this post by Sourceware - gdb-patches mailing list
>>>>> "Simon" == Simon Marchi via Gdb-patches <[hidden email]> writes:

Simon> I found these macros, which should probably have been removed in the
Simon> previous type macros series.  This series does it.

Looks good.  Thanks for doing this.

Tom
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/3] Remove last dynamic prop macros

Sourceware - gdb-patches mailing list
On 2020-08-04 2:06 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <[hidden email]> writes:
>
> Simon> I found these macros, which should probably have been removed in the
> Simon> previous type macros series.  This series does it.
>
> Looks good.  Thanks for doing this.
>
> Tom
>

Thanks, pushed.

Simon
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR

Tom de Vries
In reply to this post by Sourceware - gdb-patches mailing list
On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:
> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling
> dynamic_prop::const_val directly.
>
> gdb/ChangeLog:
>
> * gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with
> dynamic_prop::const_val.
>


This patch causes the following regression for me:
...
FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
...
(and 185 more, all for fortran test-cases).

>    return (prop != nullptr && prop->kind () == PROP_CONST
> -  && !TYPE_DYN_PROP_ADDR (prop));
> +  && prop->const_val () != 0);
>  }
>

Hmm, isn't that supposed to be "== 0" ?

Thanks,
- Tom
Reply | Threaded
Open this post in threaded view
|

[committed][gdb] Fix prop->const_val uses in gdbtypes.c

Tom de Vries
[ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]

On 8/5/20 11:20 AM, Tom de Vries wrote:

> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:
>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling
>> dynamic_prop::const_val directly.
>>
>> gdb/ChangeLog:
>>
>> * gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with
>> dynamic_prop::const_val.
>>
>
>
> This patch causes the following regression for me:
> ...
> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
> ...
> (and 185 more, all for fortran test-cases).
>
>>    return (prop != nullptr && prop->kind () == PROP_CONST
>> -  && !TYPE_DYN_PROP_ADDR (prop));
>> +  && prop->const_val () != 0);
>>  }
>>
>
> Hmm, isn't that supposed to be "== 0" ?
Committed patch that fixes the regressions.

Thanks,
- Tom


[gdb] Fix prop->const_val uses in gdbtypes.c

After commit 66d6346b25 "gdb: remove TYPE_DYN_PROP_ADDR", I run into:
...
FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
...
(and 185 more FAILs, all for fortran test-cases).

The commit replaces "!x" by "x != 0".

Fix this by using "x == 0" instead.

Build and tested on x86_64-linux.

gdb/ChangeLog:

2020-08-05  Tom de Vries  <[hidden email]>

        * gdbtypes.c (type_not_allocated, type_not_associated): Use
        "prop->const_val () == 0" instead of "prop->const_val () != 0".

---
 gdb/gdbtypes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 0cd4b194d9..da1c58c65c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -4134,7 +4134,7 @@ type_not_allocated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ALLOCATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-  && prop->const_val () != 0);
+  && prop->const_val () == 0);
 }
 
 /* Associated status of type TYPE.  Return zero if type TYPE is associated.
@@ -4146,7 +4146,7 @@ type_not_associated (const struct type *type)
   struct dynamic_prop *prop = TYPE_ASSOCIATED_PROP (type);
 
   return (prop != nullptr && prop->kind () == PROP_CONST
-  && prop->const_val () != 0);
+  && prop->const_val () == 0);
 }
 
 /* rank_one_type helper for when PARM's type code is TYPE_CODE_PTR.  */
Reply | Threaded
Open this post in threaded view
|

Re: [committed][gdb] Fix prop->const_val uses in gdbtypes.c

Sourceware - gdb-patches mailing list
On 2020-08-05 6:33 a.m., Tom de Vries wrote:

> [ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]
>
> On 8/5/20 11:20 AM, Tom de Vries wrote:
>> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:
>>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling
>>> dynamic_prop::const_val directly.
>>>
>>> gdb/ChangeLog:
>>>
>>> * gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with
>>> dynamic_prop::const_val.
>>>
>>
>>
>> This patch causes the following regression for me:
>> ...
>> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
>> ...
>> (and 185 more, all for fortran test-cases).
>>
>>>    return (prop != nullptr && prop->kind () == PROP_CONST
>>> -  && !TYPE_DYN_PROP_ADDR (prop));
>>> +  && prop->const_val () != 0);
>>>  }
>>>
>>
>> Hmm, isn't that supposed to be "== 0" ?
>
> Committed patch that fixes the regressions.
>
> Thanks,
> - Tom
>

Arggh, thanks for fixing this.

Simon
Reply | Threaded
Open this post in threaded view
|

Re: [committed][gdb] Fix prop->const_val uses in gdbtypes.c

Tom de Vries
On 8/5/20 2:46 PM, Simon Marchi wrote:

> On 2020-08-05 6:33 a.m., Tom de Vries wrote:
>> [ was: Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR ]
>>
>> On 8/5/20 11:20 AM, Tom de Vries wrote:
>>> On 8/2/20 1:59 AM, Simon Marchi via Gdb-patches wrote:
>>>> Remove TYPE_DYN_PROP_ADDR, replacing its uses with calling
>>>> dynamic_prop::const_val directly.
>>>>
>>>> gdb/ChangeLog:
>>>>
>>>> * gdbtypes.h (TYPE_DYN_PROP_ADDR): Remove, replace uses with
>>>> dynamic_prop::const_val.
>>>>
>>>
>>>
>>> This patch causes the following regression for me:
>>> ...
>>> FAIL: gdb.fortran/class-allocatable-array.exp: print this%_data%b
>>> ...
>>> (and 185 more, all for fortran test-cases).
>>>
>>>>    return (prop != nullptr && prop->kind () == PROP_CONST
>>>> -  && !TYPE_DYN_PROP_ADDR (prop));
>>>> +  && prop->const_val () != 0);
>>>>  }
>>>>
>>>
>>> Hmm, isn't that supposed to be "== 0" ?
>>
>> Committed patch that fixes the regressions.
>>
>> Thanks,
>> - Tom
>>
>
> Arggh, thanks for fixing this.

Np :)

Cheers,
- Tom