<div class="__aliyun_email_body_block"><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Hi David,</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">  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.</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Thanks,</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Chuanqi</span></div><blockquote  style="margin-right:0;margin-top:0;margin-bottom:0;"><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:David Blaikie <dblaikie@gmail.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2022年8月23日(星期二) 07:22</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:Chuanqi Xu <yedeng.yd@linux.alibaba.com>; Chuanqi Xu <llvmlistbot@llvm.org></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:cfe-commits <cfe-commits@lists.llvm.org></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [clang] acaf6b9 - [NFC] Add [[maybe_unused]] to avoid warning in gcc9</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br /></span></div>Seems like a bug in the GCC9 warning - any chance we can disable it?<br >(is it fixed in later versions of GCC?)<br ><br >I can't seem to reproduce this with godbolt at least with basic<br >examples - it'd be good to know how bad the thing is we're working<br >around so we know if we want to keep working around it, or suppress<br >the warning for certainly compiler versions entirely.<br ><br >On Thu, Aug 18, 2022 at 11:43 PM Chuanqi Xu via cfe-commits<br ><cfe-commits@lists.llvm.org> wrote:<br >><br >><br >> Author: Chuanqi Xu<br >> Date: 2022-08-19T14:43:22+08:00<br >> New Revision: acaf6b9dc07de3c12c8a1a55fd8674bca547a917<br >><br >> URL: https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917<br >> DIFF: https://github.com/llvm/llvm-project/commit/acaf6b9dc07de3c12c8a1a55fd8674bca547a917.diff<br >><br >> LOG: [NFC] Add [[maybe_unused]] to avoid warning in gcc9<br >><br >> GCC9 may issue warning for the 'unused' parameters in if constexpr.<br >> This commit try to fix it by adding the [[maybe_unused]] attribute.<br >><br >> Added:<br >><br >><br >> Modified:<br >>     clang/include/clang/AST/RecursiveASTVisitor.h<br >><br >> Removed:<br >><br >><br >><br >> ################################################################################<br >> diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h<br >> index 91baad51b26e..bd7fadb87c5f 100644<br >> --- a/clang/include/clang/AST/RecursiveASTVisitor.h<br >> +++ b/clang/include/clang/AST/RecursiveASTVisitor.h<br >> @@ -73,7 +73,8 @@ struct has_same_member_pointer_type<R (T::*)(P...), R (U::*)(P...)><br >>  /// are pointers to the same non-static member function.<br >>  template <typename FirstMethodPtrTy, typename SecondMethodPtrTy><br >>  LLVM_ATTRIBUTE_ALWAYS_INLINE LLVM_ATTRIBUTE_NODEBUG auto<br >> -isSameMethod(FirstMethodPtrTy FirstMethodPtr, SecondMethodPtrTy SecondMethodPtr)<br >> +isSameMethod([[maybe_unused]] FirstMethodPtrTy FirstMethodPtr,<br >> +             [[maybe_unused]] SecondMethodPtrTy SecondMethodPtr)<br >>      -> bool {<br >>    if constexpr (has_same_member_pointer_type<FirstMethodPtrTy,<br >>                                               SecondMethodPtrTy>::value)<br >><br >><br >><br >> _______________________________________________<br >> cfe-commits mailing list<br >> cfe-commits@lists.llvm.org<br >> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</blockquote></div>