[all-commits] [llvm/llvm-project] ce4c7a: [clang] Silence a false positive GCC -Wunused-but-...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Aug 31 04:57:53 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ce4c7a987fa3f255fa49570da4be1b9739815369
      https://github.com/llvm/llvm-project/commit/ce4c7a987fa3f255fa49570da4be1b9739815369
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M clang/include/clang/Tooling/Transformer/Transformer.h

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

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.

Differential Revision: https://reviews.llvm.org/D132920




More information about the All-commits mailing list