public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Remove last dynamic prop macros
@ 2020-08-01 23:59 Simon Marchi
  2020-08-01 23:59 ` [PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON Simon Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Simon Marchi @ 2020-08-01 23:59 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON
  2020-08-01 23:59 [PATCH 0/3] Remove last dynamic prop macros Simon Marchi
@ 2020-08-01 23:59 ` Simon Marchi
  2020-08-01 23:59 ` [PATCH 2/3] gdb: remove TYPE_DYN_PROP_KIND Simon Marchi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Simon Marchi @ 2020-08-01 23:59 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/3] gdb: remove TYPE_DYN_PROP_KIND
  2020-08-01 23:59 [PATCH 0/3] Remove last dynamic prop macros Simon Marchi
  2020-08-01 23:59 ` [PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON Simon Marchi
@ 2020-08-01 23:59 ` Simon Marchi
  2020-08-01 23:59 ` [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR Simon Marchi
  2020-08-04 18:06 ` [PATCH 0/3] Remove last dynamic prop macros Tom Tromey
  3 siblings, 0 replies; 10+ messages in thread
From: Simon Marchi @ 2020-08-01 23:59 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR
  2020-08-01 23:59 [PATCH 0/3] Remove last dynamic prop macros Simon Marchi
  2020-08-01 23:59 ` [PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON Simon Marchi
  2020-08-01 23:59 ` [PATCH 2/3] gdb: remove TYPE_DYN_PROP_KIND Simon Marchi
@ 2020-08-01 23:59 ` Simon Marchi
  2020-08-05  9:20   ` Tom de Vries
  2020-08-04 18:06 ` [PATCH 0/3] Remove last dynamic prop macros Tom Tromey
  3 siblings, 1 reply; 10+ messages in thread
From: Simon Marchi @ 2020-08-01 23:59 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] Remove last dynamic prop macros
  2020-08-01 23:59 [PATCH 0/3] Remove last dynamic prop macros Simon Marchi
                   ` (2 preceding siblings ...)
  2020-08-01 23:59 ` [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR Simon Marchi
@ 2020-08-04 18:06 ` Tom Tromey
  2020-08-04 18:48   ` Simon Marchi
  3 siblings, 1 reply; 10+ messages in thread
From: Tom Tromey @ 2020-08-04 18:06 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/3] Remove last dynamic prop macros
  2020-08-04 18:06 ` [PATCH 0/3] Remove last dynamic prop macros Tom Tromey
@ 2020-08-04 18:48   ` Simon Marchi
  0 siblings, 0 replies; 10+ messages in thread
From: Simon Marchi @ 2020-08-04 18:48 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches

On 2020-08-04 2:06 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR
  2020-08-01 23:59 ` [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR Simon Marchi
@ 2020-08-05  9:20   ` Tom de Vries
  2020-08-05 10:33     ` [committed][gdb] Fix prop->const_val uses in gdbtypes.c Tom de Vries
  0 siblings, 1 reply; 10+ messages in thread
From: Tom de Vries @ 2020-08-05  9:20 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [committed][gdb] Fix prop->const_val uses in gdbtypes.c
  2020-08-05  9:20   ` Tom de Vries
@ 2020-08-05 10:33     ` Tom de Vries
  2020-08-05 12:46       ` Simon Marchi
  0 siblings, 1 reply; 10+ messages in thread
From: Tom de Vries @ 2020-08-05 10:33 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

[-- Attachment #1: Type: text/plain, Size: 813 bytes --]

[ 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


[-- Attachment #2: 0001-gdb-Fix-prop-const_val-uses-in-gdbtypes.c.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

[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  <tdevries@suse.de>

	* 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.  */

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [committed][gdb] Fix prop->const_val uses in gdbtypes.c
  2020-08-05 10:33     ` [committed][gdb] Fix prop->const_val uses in gdbtypes.c Tom de Vries
@ 2020-08-05 12:46       ` Simon Marchi
  2020-08-05 12:56         ` Tom de Vries
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Marchi @ 2020-08-05 12:46 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [committed][gdb] Fix prop->const_val uses in gdbtypes.c
  2020-08-05 12:46       ` Simon Marchi
@ 2020-08-05 12:56         ` Tom de Vries
  0 siblings, 0 replies; 10+ messages in thread
From: Tom de Vries @ 2020-08-05 12:56 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-05 12:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01 23:59 [PATCH 0/3] Remove last dynamic prop macros Simon Marchi
2020-08-01 23:59 ` [PATCH 1/3] gdb: remove TYPE_DYN_PROP_BATON Simon Marchi
2020-08-01 23:59 ` [PATCH 2/3] gdb: remove TYPE_DYN_PROP_KIND Simon Marchi
2020-08-01 23:59 ` [PATCH 3/3] gdb: remove TYPE_DYN_PROP_ADDR Simon Marchi
2020-08-05  9:20   ` Tom de Vries
2020-08-05 10:33     ` [committed][gdb] Fix prop->const_val uses in gdbtypes.c Tom de Vries
2020-08-05 12:46       ` Simon Marchi
2020-08-05 12:56         ` Tom de Vries
2020-08-04 18:06 ` [PATCH 0/3] Remove last dynamic prop macros Tom Tromey
2020-08-04 18:48   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).