[llvm] [NFC] Add SHF_NONE to fix Werror=extra warning (PR #112808)
Jinsong Ji via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 19:28:23 PDT 2024
https://github.com/jsji updated https://github.com/llvm/llvm-project/pull/112808
>From 9fcfbd339b9b7001dd5023fbc44960bbce0a9105 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong.ji at intel.com>
Date: Fri, 18 Oct 2024 04:03:13 +0200
Subject: [PATCH 1/2] [NFC] Add SHF_NONE to fix Werror=extra warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is one of the many PRs to fix errors with LLVM_ENABLE_WERROR=on. Built by GCC 11.
Fix warnings:
llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp: In member function ‘void llvm::AsmPrinter::emitJumpTableSizesSection(const llvm::MachineJumpTableInfo*, const llvm::Function&) const’:
llvm-project/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:2852:31: error: enumerated and non-enumerated type in conditional expression [-Werror=extra]
2852 | int Flags = F.hasComdat() ? ELF::SHF_GROUP : 0;
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
---
llvm/include/llvm/BinaryFormat/ELF.h | 3 +++
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index 2eff87c911343f..eb594b1baa9663 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -1180,6 +1180,9 @@ enum : unsigned {
// Section flags.
enum : unsigned {
+ // No flag
+ SHF_NONE= 0x0,
+
// Section data should be writable during execution.
SHF_WRITE = 0x1,
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 3a8cde7330efc0..94536f803376ef 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -2849,7 +2849,7 @@ void AsmPrinter::emitJumpTableSizesSection(const MachineJumpTableInfo *MJTI,
if (isElf) {
MCSymbolELF *LinkedToSym = dyn_cast<MCSymbolELF>(CurrentFnSym);
- int Flags = F.hasComdat() ? ELF::SHF_GROUP : 0;
+ int Flags = F.hasComdat() ? ELF::SHF_GROUP : ELF::SHF_NONE;
JumpTableSizesSection = OutContext.getELFSection(
sectionName, ELF::SHT_LLVM_JT_SIZES, Flags, 0, GroupName, F.hasComdat(),
>From 4d5984e68ca916eddecaec4f51c60fc64c0405b0 Mon Sep 17 00:00:00 2001
From: Jinsong Ji <jinsong.ji at intel.com>
Date: Fri, 18 Oct 2024 04:28:10 +0200
Subject: [PATCH 2/2] clangformat
---
llvm/include/llvm/BinaryFormat/ELF.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h
index eb594b1baa9663..2bb50e4b06b44e 100644
--- a/llvm/include/llvm/BinaryFormat/ELF.h
+++ b/llvm/include/llvm/BinaryFormat/ELF.h
@@ -1181,7 +1181,7 @@ enum : unsigned {
// Section flags.
enum : unsigned {
// No flag
- SHF_NONE= 0x0,
+ SHF_NONE = 0x0,
// Section data should be writable during execution.
SHF_WRITE = 0x1,
More information about the llvm-commits
mailing list