diff mbox series

[pushed] c++: reduce unnecessary tree_common

Message ID 20241111163241.2685953-1-jason@redhat.com
State New
Headers show
Series [pushed] c++: reduce unnecessary tree_common | expand

Commit Message

Jason Merrill Nov. 11, 2024, 4 p.m. UTC
Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

Lewis' r15-5067 fixing the marking of TRAIT_EXPR led me to compare some
other front-end type definitions to their marking in cp_common_init_ts; it
seems we can change tree_common to something smaller in several cases, to
match how they are marked.

gcc/cp/ChangeLog:

	* cp-tree.h (struct ptrmem_cst): Change tree_common to tree_typed.
	(struct tree_trait_expr): Likewise.
	(struct tree_static_assert): Change tree_common to tree_base.
	(struct tree_argument_pack_select): Likewise.
---
 gcc/cp/cp-tree.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


base-commit: 42a2df0b7985b2a4732ba1c29726ac7aabd5eeae

Comments

Richard Biener Nov. 12, 2024, 7:55 a.m. UTC | #1
On Mon, Nov 11, 2024 at 5:33 PM Jason Merrill <jason@redhat.com> wrote:
>
> Tested x86_64-pc-linux-gnu, applying to trunk.

Don't you need to adjust cp_common_init_ts () as well for this?  Oddly enough
PTRMEM_CST is already TS_TYPED there and others are not adjusted at all.

Richard.

> -- 8< --
>
> Lewis' r15-5067 fixing the marking of TRAIT_EXPR led me to compare some
> other front-end type definitions to their marking in cp_common_init_ts; it
> seems we can change tree_common to something smaller in several cases, to
> match how they are marked.
>
> gcc/cp/ChangeLog:
>
>         * cp-tree.h (struct ptrmem_cst): Change tree_common to tree_typed.
>         (struct tree_trait_expr): Likewise.
>         (struct tree_static_assert): Change tree_common to tree_base.
>         (struct tree_argument_pack_select): Likewise.
> ---
>  gcc/cp/cp-tree.h | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
> index 92d1dba6a5c..1a0d5349749 100644
> --- a/gcc/cp/cp-tree.h
> +++ b/gcc/cp/cp-tree.h
> @@ -715,7 +715,7 @@ struct GTY(()) template_parm_index {
>  };
>
>  struct GTY(()) ptrmem_cst {
> -  struct tree_common common;
> +  struct tree_typed typed;
>    tree member;
>    location_t locus;
>  };
> @@ -1378,14 +1378,14 @@ struct GTY (()) tree_deferred_noexcept {
>    (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
>
>  struct GTY (()) tree_static_assert {
> -  struct tree_common common;
> +  struct tree_base base;
>    tree condition;
>    tree message;
>    location_t location;
>  };
>
>  struct GTY (()) tree_argument_pack_select {
> -  struct tree_common common;
> +  struct tree_base base;
>    tree argument_pack;
>    int index;
>  };
> @@ -1425,7 +1425,7 @@ extern const struct cp_trait cp_traits[];
>    (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->locus)
>
>  struct GTY (()) tree_trait_expr {
> -  struct tree_common common;
> +  struct tree_typed typed;
>    tree type1;
>    tree type2;
>    location_t locus;
>
> base-commit: 42a2df0b7985b2a4732ba1c29726ac7aabd5eeae
> --
> 2.47.0
>
Jason Merrill Nov. 12, 2024, 3:26 p.m. UTC | #2
On 11/12/24 2:55 AM, Richard Biener wrote:
> On Mon, Nov 11, 2024 at 5:33 PM Jason Merrill <jason@redhat.com> wrote:
> 
> Don't you need to adjust cp_common_init_ts () as well for this?  Oddly enough
> PTRMEM_CST is already TS_TYPED there and others are not adjusted at all.

Right, this patch fixed the type definitions to match cp_common_init_ts.

Jason
diff mbox series

Patch

diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 92d1dba6a5c..1a0d5349749 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -715,7 +715,7 @@  struct GTY(()) template_parm_index {
 };
 
 struct GTY(()) ptrmem_cst {
-  struct tree_common common;
+  struct tree_typed typed;
   tree member;
   location_t locus;
 };
@@ -1378,14 +1378,14 @@  struct GTY (()) tree_deferred_noexcept {
   (((struct tree_static_assert *)STATIC_ASSERT_CHECK (NODE))->location)
 
 struct GTY (()) tree_static_assert {
-  struct tree_common common;
+  struct tree_base base;
   tree condition;
   tree message;
   location_t location;
 };
 
 struct GTY (()) tree_argument_pack_select {
-  struct tree_common common;
+  struct tree_base base;
   tree argument_pack;
   int index;
 };
@@ -1425,7 +1425,7 @@  extern const struct cp_trait cp_traits[];
   (((struct tree_trait_expr *)TRAIT_EXPR_CHECK (NODE))->locus)
 
 struct GTY (()) tree_trait_expr {
-  struct tree_common common;
+  struct tree_typed typed;
   tree type1;
   tree type2;
   location_t locus;