[lld] r359070 - [ELF] Fix a gcc -Wextra warning

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 22:33:34 PDT 2019


Author: maskray
Date: Tue Apr 23 22:33:33 2019
New Revision: 359070

URL: http://llvm.org/viewvc/llvm-project?rev=359070&view=rev
Log:
[ELF] Fix a gcc -Wextra warning

Extracted from D61046.

warning: enumeral and non-enumeral type in conditional expression [-Wextra]

Cast SHF_ALLOC to avoid that.

Modified:
    lld/trunk/ELF/LinkerScript.cpp

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=359070&r1=359069&r2=359070&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Tue Apr 23 22:33:33 2019
@@ -887,8 +887,8 @@ void LinkerScript::adjustSectionsBeforeS
     // in case it is empty.
     bool IsEmpty = getInputSections(Sec).empty();
     if (IsEmpty)
-      Sec->Flags =
-          Flags & ((Sec->NonAlloc ? 0 : SHF_ALLOC) | SHF_WRITE | SHF_EXECINSTR);
+      Sec->Flags = Flags & ((Sec->NonAlloc ? 0 : (uint64_t)SHF_ALLOC) |
+                            SHF_WRITE | SHF_EXECINSTR);
 
     if (IsEmpty && isDiscardable(*Sec)) {
       Sec->Live = false;




More information about the llvm-commits mailing list