Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in gcc9

2022-08-23 Thread David Blaikie via cfe-commits
Thanks for the link - fair enough. We'll see how ubiquitous the
constexpr-creating-sort-of-unused-variables situation is. If it comes
up a lot we might want to disable the warning for GCC 9.

On Mon, Aug 22, 2022 at 7:58 PM chuanqi.xcq  wrote:
>
> Hi David,
>
>   This is the reproduce link from godbolt: https://godbolt.org/z/nEc7WYKnq. 
> It is weird that it requries `-Wunused-but-set-parameter` instead of 
> `-Wunused-parameter`. The bug exists in all versions of GCC9. And it gets 
> fixed in GCC10 and later. Personally, I feel it looks better to suppress the 
> warning for GCC9.
>
> Thanks,
> Chuanqi
>
> --
> From:David Blaikie 
> Send Time:2022年8月23日(星期二) 07:22
> To:Chuanqi Xu ; Chuanqi Xu 
> Cc:cfe-commits 
> Subject:Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in 
> gcc9
>
> Seems like a bug in the GCC9 warning - any chance we can disable it?
> (is it fixed in later versions of GCC?)
>
> I can't seem to reproduce this with godbolt at least with basic
> examples - it'd be good to know how bad the thing is we're working
> around so we know if we want to keep working around it, or suppress
> the warning for certainly compiler versions entirely.
>
> On Thu, Aug 18, 2022 at 11:43 PM Chuanqi Xu via cfe-commits
>  wrote:
> >
> >
> > Author: Chuanqi Xu
> > Date: 2022-08-19T14:43:22+08:00
> > New Revision: acaf6b9dc07de3c12c8a1a55fd8674bca547a917
> >
> > URL: 
> > https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917
> > DIFF: 
> > https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917.diff
> >
> > LOG: [NFC] Add [[maybe_unused]] to avoid warning in gcc9
> >
> > GCC9 may issue warning for the 'unused' parameters in if constexpr.
> > This commit try to fix it by adding the [[maybe_unused]] attribute.
> >
> > Added:
> >
> >
> > Modified:
> > clang/include/clang/AST/RecursiveASTVisitor.h
> >
> > Removed:
> >
> >
> >
> > 
> > diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
> > b/clang/include/clang/AST/RecursiveASTVisitor.h
> > index 91baad51b26e..bd7fadb87c5f 100644
> > --- a/clang/include/clang/AST/RecursiveASTVisitor.h
> > +++ b/clang/include/clang/AST/RecursiveASTVisitor.h
> > @@ -73,7 +73,8 @@ struct has_same_member_pointer_type > (U::*)(P...)>
> >  /// are pointers to the same non-static member function.
> >  template 
> >  LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto
> > -isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy 
> > SecondMethodPtr)
> > +isSameMethod([[maybe_unused]] FirstMethodPtrTy FirstMethodPtr,
> > + [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
> >  -> bool {
> >if constexpr (has_same_member_pointer_type >   SecondMethodPtrTy>::value)
> >
> >
> >
> > ___
> > cfe-commits mailing list
> > cfe-commits@lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in gcc9

2022-08-23 Thread chuanqi.xcq via cfe-commits
Hi David,
 This is the reproduce link from godbolt: https://godbolt.org/z/nEc7WYKnq. It 
is weird that it requries `-Wunused-but-set-parameter` instead of 
`-Wunused-parameter`. The bug exists in all versions of GCC9. And it gets fixed 
in GCC10 and later. Personally, I feel it looks better to suppress the warning 
for GCC9.
Thanks,
Chuanqi
--
From:David Blaikie 
Send Time:2022年8月23日(星期二) 07:22
To:Chuanqi Xu ; Chuanqi Xu 
Cc:cfe-commits 
Subject:Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in 
gcc9
Seems like a bug in the GCC9 warning - any chance we can disable it?
(is it fixed in later versions of GCC?)
I can't seem to reproduce this with godbolt at least with basic
examples - it'd be good to know how bad the thing is we're working
around so we know if we want to keep working around it, or suppress
the warning for certainly compiler versions entirely.
On Thu, Aug 18, 2022 at 11:43 PM Chuanqi Xu via cfe-commits
 wrote:
>
>
> Author: Chuanqi Xu
> Date: 2022-08-19T14:43:22+08:00
> New Revision: acaf6b9dc07de3c12c8a1a55fd8674bca547a917
>
> URL: 
> https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917
> DIFF: 
> https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917.diff
>
> LOG: [NFC] Add [[maybe_unused]] to avoid warning in gcc9
>
> GCC9 may issue warning for the 'unused' parameters in if constexpr.
> This commit try to fix it by adding the [[maybe_unused]] attribute.
>
> Added:
>
>
> Modified:
> clang/include/clang/AST/RecursiveASTVisitor.h
>
> Removed:
>
>
>
> 
> diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
> b/clang/include/clang/AST/RecursiveASTVisitor.h
> index 91baad51b26e..bd7fadb87c5f 100644
> --- a/clang/include/clang/AST/RecursiveASTVisitor.h
> +++ b/clang/include/clang/AST/RecursiveASTVisitor.h
> @@ -73,7 +73,8 @@ struct has_same_member_pointer_type (U::*)(P...)>
> /// are pointers to the same non-static member function.
> template 
> LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto
> -isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy 
> SecondMethodPtr)
> +isSameMethod([[maybe_unused]] FirstMethodPtrTy FirstMethodPtr,
> + [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
> -> bool {
> if constexpr (has_same_member_pointer_type SecondMethodPtrTy>::value)
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in gcc9

2022-08-22 Thread David Blaikie via cfe-commits
Seems like a bug in the GCC9 warning - any chance we can disable it?
(is it fixed in later versions of GCC?)

I can't seem to reproduce this with godbolt at least with basic
examples - it'd be good to know how bad the thing is we're working
around so we know if we want to keep working around it, or suppress
the warning for certainly compiler versions entirely.

On Thu, Aug 18, 2022 at 11:43 PM Chuanqi Xu via cfe-commits
 wrote:
>
>
> Author: Chuanqi Xu
> Date: 2022-08-19T14:43:22+08:00
> New Revision: acaf6b9dc07de3c12c8a1a55fd8674bca547a917
>
> URL: 
> https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917
> DIFF: 
> https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917.diff
>
> LOG: [NFC] Add [[maybe_unused]] to avoid warning in gcc9
>
> GCC9 may issue warning for the 'unused' parameters in if constexpr.
> This commit try to fix it by adding the [[maybe_unused]] attribute.
>
> Added:
>
>
> Modified:
> clang/include/clang/AST/RecursiveASTVisitor.h
>
> Removed:
>
>
>
> 
> diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
> b/clang/include/clang/AST/RecursiveASTVisitor.h
> index 91baad51b26e..bd7fadb87c5f 100644
> --- a/clang/include/clang/AST/RecursiveASTVisitor.h
> +++ b/clang/include/clang/AST/RecursiveASTVisitor.h
> @@ -73,7 +73,8 @@ struct has_same_member_pointer_type (U::*)(P...)>
>  /// are pointers to the same non-static member function.
>  template 
>  LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto
> -isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy 
> SecondMethodPtr)
> +isSameMethod([[maybe_unused]] FirstMethodPtrTy FirstMethodPtr,
> + [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
>  -> bool {
>if constexpr (has_same_member_pointer_type   SecondMethodPtrTy>::value)
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in gcc9

2022-08-19 Thread Chuanqi Xu via cfe-commits

Author: Chuanqi Xu
Date: 2022-08-19T14:43:22+08:00
New Revision: acaf6b9dc07de3c12c8a1a55fd8674bca547a917

URL: 
https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917
DIFF: 
https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917.diff

LOG: [NFC] Add [[maybe_unused]] to avoid warning in gcc9

GCC9 may issue warning for the 'unused' parameters in if constexpr.
This commit try to fix it by adding the [[maybe_unused]] attribute.

Added: 


Modified: 
clang/include/clang/AST/RecursiveASTVisitor.h

Removed: 




diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h 
b/clang/include/clang/AST/RecursiveASTVisitor.h
index 91baad51b26e..bd7fadb87c5f 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -73,7 +73,8 @@ struct has_same_member_pointer_type
 /// are pointers to the same non-static member function.
 template 
 LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto
-isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy 
SecondMethodPtr)
+isSameMethod([[maybe_unused]] FirstMethodPtrTy FirstMethodPtr,
+ [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)
 -> bool {
   if constexpr (has_same_member_pointer_type::value)



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits