[PATCH] D91852: [compiler-rt] [windows] Add UNUSED attributes on variables/functions only used for 64 bit targets
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 00:05:04 PST 2020
mstorsjo added inline comments.
================
Comment at: compiler-rt/lib/interception/interception_win.cpp:139
static const int kShortJumpInstructionLength = 2;
-static const int kIndirectJumpInstructionLength = 6;
+UNUSED static const int kIndirectJumpInstructionLength = 6;
static const int kBranchLength =
----------------
amccarth wrote:
> I suppose this is fine, but it seems most of these could be `constexpr`, which would obviate the need for the preprocessor macro.
Hmm, making them constexpr doesn't seem to help to silence the warnings:
```
$ cat test.cpp
constexpr int unusedVar = 42;
void func() { }
$ clang -target x86_64-w64-mingw32 -c test.cpp -Wall
test.cpp:2:15: warning: unused variable 'unusedVar' [-Wunused-const-variable]
constexpr int unusedVar = 42;
^
1 warning generated.
```
(Same also goes for a MSVC triple.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91852/new/
https://reviews.llvm.org/D91852
More information about the llvm-commits
mailing list