From 0b5c3ccf352c1cd2b0b46455cf38984ae912ce7a Mon Sep 17 00:00:00 2001 From: Alecto Irene Perez Date: Thu, 10 Oct 2024 14:12:49 -0400 Subject: [PATCH] Fix spurious warning 'misc-use-anonymous-namespace' (#1860) Disables 'misc-use-anonymous-namespace' for usage of the BENCHMARK macro. This warning is spurious, and the variable declared by the BENCHMARK macro can't be moved into an annonymous namespace. We don't want to disable it globally, but it can be disabled locally, for the `BENCHMARK` statement, as this warning appears downstream for users. See: https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics --- include/benchmark/benchmark.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index 53a22247f..86f9dbbab 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h @@ -1554,6 +1554,7 @@ class Fixture : public internal::Benchmark { BaseClass##_##Method##_Benchmark #define BENCHMARK_PRIVATE_DECLARE(n) \ + /* NOLINTNEXTLINE(misc-use-anonymous-namespace) */ \ static ::benchmark::internal::Benchmark* BENCHMARK_PRIVATE_NAME(n) \ BENCHMARK_UNUSED