diff options
author | yonghong-song <yhs@fb.com> | 2025-07-22 16:37:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-22 16:37:10 -0700 |
commit | 5ca40fa101df2b75e10c0c260192b653120a9b1d (patch) | |
tree | d38eace299b2dad55b497d23ce3aabb96bb28539 /llvm/lib | |
parent | c267928700778f01870094009fe6afdce79635a6 (diff) | |
download | llvm-5ca40fa101df2b75e10c0c260192b653120a9b1d.zip llvm-5ca40fa101df2b75e10c0c260192b653120a9b1d.tar.gz llvm-5ca40fa101df2b75e10c0c260192b653120a9b1d.tar.bz2 |
[BPF] Fix build warnings due to a static var in header file (#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] https://github.com/llvm/llvm-project/pull/131731
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/BPF/BPF.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/BPF/BPF.h b/llvm/lib/Target/BPF/BPF.h index 5d49949..7faae8b 100644 --- a/llvm/lib/Target/BPF/BPF.h +++ b/llvm/lib/Target/BPF/BPF.h @@ -22,7 +22,7 @@ class BPFTargetMachine; class InstructionSelector; class PassRegistry; -static const char *BPF_TRAP = "__bpf_trap"; +#define BPF_TRAP "__bpf_trap" ModulePass *createBPFCheckAndAdjustIR(); |