This is an archive of the discontinued LLVM Phabricator instance.

[clang] Silence a false positive GCC -Wunused-but-set-parameter warning with constexpr
ClosedPublic

Authored by mstorsjo on Aug 30 2022, 2:14 AM.

Details

Summary

This fixes the following warning:

In file included from ../tools/clang/lib/Tooling/Transformer/Transformer.cpp:9:
../tools/clang/include/clang/Tooling/Transformer/Transformer.h: In instantiation of ‘llvm::Error clang::tooling::detail::populateMetadata(const clang::transformer::RewriteRuleWith<MetadataT>&, size_t, const clang::ast_matchers::MatchFinder::MatchResult&, clang::tooling::TransformerResult<T>&) [with T = void; size_t = long unsigned int]’:
../tools/clang/include/clang/Tooling/Transformer/Transformer.h:179:34:   required from ‘void clang::tooling::detail::WithMetadataImpl<T>::onMatchImpl(const clang::ast_matchers::MatchFinder::MatchResult&) [with T = void]’
../tools/clang/include/clang/Tooling/Transformer/Transformer.h:156:8:   required from here
../tools/clang/include/clang/Tooling/Transformer/Transformer.h:120:25: warning: parameter ‘SelectedCase’ set but not used [-Wunused-but-set-parameter]
  120 |                  size_t SelectedCase,
      |                  ~~~~~~~^~~~~~~~~~~~

The issue is fixed in GCC 10 and later, but this silences the noisy
warning in older versions. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85827
for more details about the bug.

Diff Detail

Event Timeline

mstorsjo created this revision.Aug 30 2022, 2:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2022, 2:14 AM
mstorsjo requested review of this revision.Aug 30 2022, 2:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2022, 2:14 AM
bkramer accepted this revision.Aug 30 2022, 4:08 AM

thanks

This revision is now accepted and ready to land.Aug 30 2022, 4:08 AM
This revision was landed with ongoing or failed builds.Aug 31 2022, 4:57 AM
This revision was automatically updated to reflect the committed changes.