This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Apply pragma for silencing warning when building with clang-cl too
ClosedPublic

Authored by mstorsjo on Mar 5 2021, 4:50 AM.

Details

Summary

This silences warnings about unused functions (in an anonymous
namespace).

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Mar 5 2021, 4:50 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2021, 4:50 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
curdeius accepted this revision as: curdeius.Mar 5 2021, 6:16 AM
curdeius added a subscriber: curdeius.

Indeed. clang-cl does not define __GNUC__, only __clang__.
LGTM.

ldionne accepted this revision.Mar 5 2021, 6:16 AM
This revision is now accepted and ready to land.Mar 5 2021, 6:16 AM

I assume this warning is necessary because some functions are defined but not used in different configurations? Like a function that would be always defined but only used when building for Windows or the opposite?

I assume this warning is necessary because some functions are defined but not used in different configurations? Like a function that would be always defined but only used when building for Windows or the opposite?

No, this is a header under src/filesystem, included by two cpp files in src/filesystem, that contains an anonymous namespace with helper functions (to avoid creating externally visible symbols) used by both src files - but not all of the functions are used by both src files. (And there's one function with multiple overloads, where one overload currently doesn't seem to be used at all, see const path::value_type* unwrap(path::string_type const& s) { return s.c_str(); } on line 111.)

I assume this warning is necessary because some functions are defined but not used in different configurations? Like a function that would be always defined but only used when building for Windows or the opposite?

No, this is a header under src/filesystem, included by two cpp files in src/filesystem, that contains an anonymous namespace with helper functions (to avoid creating externally visible symbols) used by both src files - but not all of the functions are used by both src files. (And there's one function with multiple overloads, where one overload currently doesn't seem to be used at all, see const path::value_type* unwrap(path::string_type const& s) { return s.c_str(); } on line 111.)

Got it, thanks. We could consider removing that overload if it's unused (feel free to do that as a NFC change if you want).