Page MenuHomePhabricator

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

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

Details

Reviewers
mcgov
amccarth
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.Fri, Nov 20, 1:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptFri, Nov 20, 1:44 AM
Herald added subscribers: Restricted Project, dberris. · View Herald Transcript
mstorsjo requested review of this revision.Fri, Nov 20, 1:44 AM
amccarth accepted this revision.Mon, Nov 30, 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.Mon, Nov 30, 4:41 PM
mstorsjo added inline comments.Tue, Dec 1, 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.)