From c09277b0d8402cd3702a01f6314d6f81a7838da0 Mon Sep 17 00:00:00 2001 From: Yang Fan Date: Wed, 21 Apr 2021 16:00:57 +0800 Subject: [PATCH] [lld][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- lld/ELF/SyntheticSections.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(VER_NDX_GLOBAL) + : s.sym->versionId); buf += 2; } }