[llvm] 336b7a2 - [ObjCopy] Fix warning in conditional expression [NFC]

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 03:47:50 PDT 2023


Author: Mikael Holmen
Date: 2023-09-29T12:44:54+02:00
New Revision: 336b7a256bf886055c3040d09480900a9bdfb68a

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

LOG: [ObjCopy] Fix warning in conditional expression [NFC]

Without the fix gcc warned with
 ../lib/ObjCopy/ELF/ELFObjcopy.cpp: In function 'uint64_t getSectionFlagsPreserveMask(uint64_t, uint64_t, uint16_t)':
 ../lib/ObjCopy/ELF/ELFObjcopy.cpp:106:31: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
   106 |       ~(EMachine == EM_X86_64 ? ELF::SHF_X86_64_LARGE : 0UL);
       |         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Added: 
    

Modified: 
    llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
index 58cb9cb65679b71..9d02ba051a0a84b 100644
--- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
+++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp
@@ -103,7 +103,7 @@ static uint64_t getSectionFlagsPreserveMask(uint64_t OldFlags,
        ELF::SHF_MASKOS | ELF::SHF_MASKPROC | ELF::SHF_TLS |
        ELF::SHF_INFO_LINK) &
       ~ELF::SHF_EXCLUDE &
-      ~(EMachine == EM_X86_64 ? ELF::SHF_X86_64_LARGE : 0UL);
+      ~(EMachine == EM_X86_64 ? (uint64_t)ELF::SHF_X86_64_LARGE : 0UL);
   return (OldFlags & PreserveMask) | (NewFlags & ~PreserveMask);
 }
 


        


More information about the llvm-commits mailing list