[lld] c09277b - [lld][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC)
Yang Fan via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 21 01:02:28 PDT 2021
Author: Yang Fan
Date: 2021-04-21T16:01:46+08:00
New Revision: c09277b0d8402cd3702a01f6314d6f81a7838da0
URL: https://github.com/llvm/llvm-project/commit/c09277b0d8402cd3702a01f6314d6f81a7838da0
DIFF: https://github.com/llvm/llvm-project/commit/c09277b0d8402cd3702a01f6314d6f81a7838da0.diff
LOG: [lld][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC)
GCC warning:
```
/llvm-project/lld/ELF/SyntheticSections.cpp: In member function ‘virtual void lld::elf::VersionTableSection::writeTo(uint8_t*)’:
/llvm-project/lld/ELF/SyntheticSections.cpp:3128:34: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
3128 | write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Added:
Modified:
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 36ed89334758..cd81aa657701 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -3125,7 +3125,8 @@ void VersionTableSection::writeTo(uint8_t *buf) {
for (const SymbolTableEntry &s : getPartition().dynSymTab->getSymbols()) {
// Use the original versionId for an unfetched lazy symbol (undefined weak),
// which must be VER_NDX_GLOBAL (an undefined versioned symbol is an error).
- write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
+ write16(buf, s.sym->isLazy() ? static_cast<uint16_t>(VER_NDX_GLOBAL)
+ : s.sym->versionId);
buf += 2;
}
}
More information about the llvm-commits
mailing list