[lld] 85b67d5 - [lld][MachO] Silence "enumeral and non-enumeral type" warning from gcc

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 3 02:03:21 PST 2021


Author: Mikael Holmen
Date: 2021-03-03T10:39:35+01:00
New Revision: 85b67d5fa92dceac2861c64ffedc02eb114f839d

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

LOG: [lld][MachO] Silence "enumeral and non-enumeral type" warning from gcc

gcc complained with

[1110/1140] Building CXX object tools/lld/MachO/CMakeFiles/lldMachO2.dir/SyntheticSections.cpp.o
../../lld/MachO/SyntheticSections.cpp: In function 'int16_t ordinalForDylibSymbol(const lld::macho::DylibSymbol&)':
../../lld/MachO/SyntheticSections.cpp:287:14: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
  286 |   return config->namespaceKind == NamespaceKind::flat || dysym.isDynamicLookup()
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  287 |              ? MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288 |              : dysym.getFile()->ordinal;
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~

Added: 
    

Modified: 
    lld/MachO/SyntheticSections.cpp

Removed: 
    


################################################################################
diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 27c0996cd601..7f5b0a56d5ff 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -284,7 +284,7 @@ static void encodeBinding(const Symbol *sym, const OutputSection *osec,
 // Non-weak bindings need to have their dylib ordinal encoded as well.
 static int16_t ordinalForDylibSymbol(const DylibSymbol &dysym) {
   return config->namespaceKind == NamespaceKind::flat || dysym.isDynamicLookup()
-             ? MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP
+             ? (int16_t)MachO::BIND_SPECIAL_DYLIB_FLAT_LOOKUP
              : dysym.getFile()->ordinal;
 }
 


        


More information about the llvm-commits mailing list