Skip to content

Commit 5ca40fa

Browse files
[BPF] Fix build warnings due to a static var in header file (llvm#150128)
Simon Pilgrim ([1]) and Anton reported that the following warning will appear when building clang compiler: ``` In file included from .../llvm-project/llvm/lib/Target/BPF/BPFASpaceCastSimplifyPass.cpp:9: .../llvm-project/llvm/lib/Target/BPF/BPF.h:25:20: warning: ‘llvm::BPF_TRAP’ defined but not used [-Wunused-variable] 25 | static const char *BPF_TRAP = "__bpf_trap"; | ^~~~~~~~ ... In file included from .../llvm-project/llvm/lib/Target/BPF/MCTargetDesc/BPFInstPrinter.cpp:14: .../llvm-project/llvm/lib/Target/BPF/BPF.h:25:20: warning: ‘llvm::BPF_TRAP’ defined but not used [-Wunused-variable] 25 | static const char *BPF_TRAP = "__bpf_trap"; | ^~~~~~~~ ... ``` Instead of using static const variable, use macro to silence warnings. [1] llvm#131731
1 parent c267928 commit 5ca40fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/BPF/BPF.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BPFTargetMachine;
2222
class InstructionSelector;
2323
class PassRegistry;
2424

25-
static const char *BPF_TRAP = "__bpf_trap";
25+
#define BPF_TRAP "__bpf_trap"
2626

2727
ModulePass *createBPFCheckAndAdjustIR();
2828

0 commit comments

Comments
 (0)