public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] c++: Avoid using __array_rank as a variable name [PR115061]
@ 2024-05-13  6:48 Ken Matsui
  2024-05-13 15:18 ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Matsui @ 2024-05-13  6:48 UTC (permalink / raw)
  To: gcc-patches; +Cc: jason, Ken Matsui

This patch fixes a compilation error when building GCC using Clang.
Since __array_rank is used as a built-in trait name, use rank instead.

	PR c++/115061

gcc/cp/ChangeLog:

	* semantics.cc (finish_trait_expr): Use rank instead of
	__array_rank.

Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
---
 gcc/cp/semantics.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 43b175f92fd..df62e2d80db 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -12914,10 +12914,10 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
   tree val;
   if (kind == CPTK_RANK)
     {
-      size_t __array_rank = 0;
+      size_t rank = 0;
       for (; TREE_CODE (type1) == ARRAY_TYPE; type1 = TREE_TYPE (type1))
-	++__array_rank;
-      val = build_int_cst (size_type_node, __array_rank);
+	++rank;
+      val = build_int_cst (size_type_node, rank);
     }
   else
     val = (trait_expr_value (kind, type1, type2)
-- 
2.44.0


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

* Re: [PATCH] c++: Avoid using __array_rank as a variable name [PR115061]
  2024-05-13  6:48 [PATCH] c++: Avoid using __array_rank as a variable name [PR115061] Ken Matsui
@ 2024-05-13 15:18 ` Marek Polacek
  2024-05-13 17:15   ` Ken Matsui
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Polacek @ 2024-05-13 15:18 UTC (permalink / raw)
  To: Ken Matsui; +Cc: gcc-patches, jason

On Sun, May 12, 2024 at 11:48:07PM -0700, Ken Matsui wrote:
> This patch fixes a compilation error when building GCC using Clang.
> Since __array_rank is used as a built-in trait name, use rank instead.

I think you can go ahead and push this patch as obvious, thanks.
 
> 	PR c++/115061
> 
> gcc/cp/ChangeLog:
> 
> 	* semantics.cc (finish_trait_expr): Use rank instead of
> 	__array_rank.
> 
> Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> ---
>  gcc/cp/semantics.cc | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
> index 43b175f92fd..df62e2d80db 100644
> --- a/gcc/cp/semantics.cc
> +++ b/gcc/cp/semantics.cc
> @@ -12914,10 +12914,10 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
>    tree val;
>    if (kind == CPTK_RANK)
>      {
> -      size_t __array_rank = 0;
> +      size_t rank = 0;
>        for (; TREE_CODE (type1) == ARRAY_TYPE; type1 = TREE_TYPE (type1))
> -	++__array_rank;
> -      val = build_int_cst (size_type_node, __array_rank);
> +	++rank;
> +      val = build_int_cst (size_type_node, rank);
>      }
>    else
>      val = (trait_expr_value (kind, type1, type2)
> -- 
> 2.44.0
> 

Marek


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

* Re: [PATCH] c++: Avoid using __array_rank as a variable name [PR115061]
  2024-05-13 15:18 ` Marek Polacek
@ 2024-05-13 17:15   ` Ken Matsui
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Matsui @ 2024-05-13 17:15 UTC (permalink / raw)
  To: Marek Polacek; +Cc: Ken Matsui, gcc-patches, jason

On Mon, May 13, 2024 at 8:19 AM Marek Polacek <polacek@redhat.com> wrote:
>
> On Sun, May 12, 2024 at 11:48:07PM -0700, Ken Matsui wrote:
> > This patch fixes a compilation error when building GCC using Clang.
> > Since __array_rank is used as a built-in trait name, use rank instead.
>
> I think you can go ahead and push this patch as obvious, thanks.

Oh, I see.  Thank you for letting me know!

>
> >       PR c++/115061
> >
> > gcc/cp/ChangeLog:
> >
> >       * semantics.cc (finish_trait_expr): Use rank instead of
> >       __array_rank.
> >
> > Signed-off-by: Ken Matsui <kmatsui@gcc.gnu.org>
> > ---
> >  gcc/cp/semantics.cc | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
> > index 43b175f92fd..df62e2d80db 100644
> > --- a/gcc/cp/semantics.cc
> > +++ b/gcc/cp/semantics.cc
> > @@ -12914,10 +12914,10 @@ finish_trait_expr (location_t loc, cp_trait_kind kind, tree type1, tree type2)
> >    tree val;
> >    if (kind == CPTK_RANK)
> >      {
> > -      size_t __array_rank = 0;
> > +      size_t rank = 0;
> >        for (; TREE_CODE (type1) == ARRAY_TYPE; type1 = TREE_TYPE (type1))
> > -     ++__array_rank;
> > -      val = build_int_cst (size_type_node, __array_rank);
> > +     ++rank;
> > +      val = build_int_cst (size_type_node, rank);
> >      }
> >    else
> >      val = (trait_expr_value (kind, type1, type2)
> > --
> > 2.44.0
> >
>
> Marek
>

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

end of thread, other threads:[~2024-05-13 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13  6:48 [PATCH] c++: Avoid using __array_rank as a variable name [PR115061] Ken Matsui
2024-05-13 15:18 ` Marek Polacek
2024-05-13 17:15   ` Ken Matsui

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).