[lld] [lld] Fix warning in SymbolTable.cpp (PR #112323)

Karl-Johan Karlsson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 23:45:54 PDT 2024


https://github.com/karka228 created https://github.com/llvm/llvm-project/pull/112323

Fix gcc warning:

lld/ELF/SymbolTable.cpp:340:33: warning: enumeral and non-enumeral type in conditional expression [-Wextra]

>From d55f2576bbfaa98e07a98341d02634bdf84aba11 Mon Sep 17 00:00:00 2001
From: Karl-Johan Karlsson <karl-johan.karlsson at ericsson.com>
Date: Tue, 15 Oct 2024 08:39:13 +0200
Subject: [PATCH] [lld] Fix warning in SymbolTable.cpp

Fix gcc warning:

lld/ELF/SymbolTable.cpp:340:33: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
---
 lld/ELF/SymbolTable.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 02814e04139094..674b1ef983f843 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -337,7 +337,7 @@ void SymbolTable::scanVersionScript() {
         globalAsteriskFound = !isLocal;
       }
     }
-    assignWildcard(pat, isLocal ? VER_NDX_LOCAL : ver->id, ver->name);
+    assignWildcard(pat, isLocal ? (uint16_t)VER_NDX_LOCAL : ver->id, ver->name);
   };
   for (VersionDefinition &v : llvm::reverse(ctx.arg.versionDefinitions)) {
     for (SymbolVersion &pat : v.nonLocalPatterns)



More information about the llvm-commits mailing list