[llvm] [NFC] Add SHF_NONE to fix Werror=extra warning (PR #112808)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 19:07:42 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Jinsong Ji (jsji)
<details>
<summary>Changes</summary>
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;
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
---
Full diff: https://github.com/llvm/llvm-project/pull/112808.diff
2 Files Affected:
- (modified) llvm/include/llvm/BinaryFormat/ELF.h (+3)
- (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+1-1)
``````````diff
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(),
``````````
</details>
https://github.com/llvm/llvm-project/pull/112808
More information about the llvm-commits
mailing list