[llvm] bd9a525 - [AArch64] Fix gcc "enumeral and non-enumeral type" warning

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 11 00:39:12 PDT 2024


Author: Mikael Holmen
Date: 2024-06-11T09:33:28+02:00
New Revision: bd9a525efdab2a83cb24773d95ce8c4a2e9cce68

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

LOG: [AArch64] Fix gcc "enumeral and non-enumeral type" warning

Without this gcc (9.3.0) warns with
 ../lib/Target/AArch64/GISel/AArch64CallLowering.cpp: In function 'unsigned int getCallOpcode(const llvm::MachineFunction&, bool, bool, std::optional<llvm::CallLowering::PtrAuthInfo>&, llvm::MachineRegisterInfo&)':
 ../lib/Target/AArch64/GISel/AArch64CallLowering.cpp:1025: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
  1025 |       return IsIndirect ? getBLRCallOpcode(CallerF) : AArch64::BL;
       |

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp b/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
index 270474f80767a..322bde3da6763 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp
@@ -1022,7 +1022,7 @@ static unsigned getCallOpcode(const MachineFunction &CallerF, bool IsIndirect,
 
   if (!IsTailCall) {
     if (!PAI)
-      return IsIndirect ? getBLRCallOpcode(CallerF) : AArch64::BL;
+      return IsIndirect ? getBLRCallOpcode(CallerF) : (unsigned)AArch64::BL;
 
     assert(IsIndirect && "Direct call should not be authenticated");
     assert((PAI->Key == AArch64PACKey::IA || PAI->Key == AArch64PACKey::IB) &&


        


More information about the llvm-commits mailing list