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

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 23:43:47 PDT 2022


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<R (T::*)(P...), R (U::*)(P...)>
 /// are pointers to the same non-static member function.
 template <typename FirstMethodPtrTy, typename SecondMethodPtrTy>
 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<FirstMethodPtrTy,
                                              SecondMethodPtrTy>::value)


        


More information about the cfe-commits mailing list