From 0c998f7cc4137fcd8da8e0c1887689a19fa19ecf Mon Sep 17 00:00:00 2001 From: Alecto Irene Perez Date: Thu, 10 Oct 2024 18:02:36 -0400 Subject: [PATCH] Fix spurious warning 'misc-use-anonymous-namespace' (#1860) (#1861) 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 53a22247..86f9dbba 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