This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [windows] Add UNUSED attributes on variables/functions only used for 64 bit targets
ClosedPublic

Authored by mstorsjo on Nov 20 2020, 1:44 AM.

Details

Summary

This fixes warnings when building for 32 bit targets.

Alternatively we could stick a few (void)var; in some 32-bit-only codepath.

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 20 2020, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2020, 1:44 AM
Herald added subscribers: Restricted Project, dberris. · View Herald Transcript
mstorsjo requested review of this revision.Nov 20 2020, 1:44 AM
amccarth accepted this revision.Nov 30 2020, 4:41 PM
amccarth added inline comments.
compiler-rt/lib/interception/interception_win.cpp
139

I suppose this is fine, but it seems most of these could be constexpr, which would obviate the need for the preprocessor macro.

This revision is now accepted and ready to land.Nov 30 2020, 4:41 PM
mstorsjo added inline comments.Dec 1 2020, 12:05 AM
compiler-rt/lib/interception/interception_win.cpp
139

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.)

Ping @amccarth, do you want to follow up on the discussion before I land this?

Ping @amccarth, do you want to follow up on the discussion before I land this?

Sorry about the delay -- holidays. Landing this without further discussion was fine by me.