Skip to content

Commit

Permalink
Fix spurious warning 'misc-use-anonymous-namespace' (#1860) (#1861)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
codeinred authored Oct 10, 2024
1 parent 24e0bd8 commit 0c998f7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/benchmark/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0c998f7

Please sign in to comment.