@@ -250,13 +250,19 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
250250 _Pragma (" GCC diagnostic push" ) \
251251 _Pragma(" GCC diagnostic ignored \" -Wdeprecated-declarations\" " )
252252#define BENCHMARK_RESTORE_DEPRECATED_WARNING _Pragma (" GCC diagnostic pop" )
253+ #define BENCHMARK_DISABLE_PEDANTIC_WARNING \
254+ _Pragma (" GCC diagnostic push" ) \
255+ _Pragma(" GCC diagnostic ignored \" -Wpedantic\" " )
256+ #define BENCHMARK_RESTORE_PEDANTIC_WARNING _Pragma (" GCC diagnostic pop" )
253257#elif defined(__NVCOMPILER)
254258#define BENCHMARK_BUILTIN_EXPECT (x, y ) __builtin_expect(x, y)
255259#define BENCHMARK_DEPRECATED_MSG (msg ) __attribute__((deprecated(msg)))
256260#define BENCHMARK_DISABLE_DEPRECATED_WARNING \
257261 _Pragma (" diagnostic push" ) \
258262 _Pragma(" diag_suppress deprecated_entity_with_custom_message" )
259263#define BENCHMARK_RESTORE_DEPRECATED_WARNING _Pragma (" diagnostic pop" )
264+ #define BENCHMARK_DISABLE_PEDANTIC_WARNING
265+ #define BENCHMARK_RESTORE_PEDANTIC_WARNING
260266#else
261267#define BENCHMARK_BUILTIN_EXPECT (x, y ) x
262268#define BENCHMARK_DEPRECATED_MSG (msg )
@@ -265,6 +271,8 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
265271 __LINE__) ") : warning note: " msg))
266272#define BENCHMARK_DISABLE_DEPRECATED_WARNING
267273#define BENCHMARK_RESTORE_DEPRECATED_WARNING
274+ #define BENCHMARK_DISABLE_PEDANTIC_WARNING
275+ #define BENCHMARK_RESTORE_PEDANTIC_WARNING
268276#endif
269277// clang-format on
270278
@@ -1531,11 +1539,13 @@ class Fixture : public internal::Benchmark {
15311539// Check that __COUNTER__ is defined and that __COUNTER__ increases by 1
15321540// every time it is expanded. X + 1 == X + 0 is used in case X is defined to be
15331541// empty. If X is empty the expression becomes (+1 == +0).
1542+ BENCHMARK_DISABLE_PEDANTIC_WARNING
15341543#if defined(__COUNTER__) && (__COUNTER__ + 1 == __COUNTER__ + 0)
15351544#define BENCHMARK_PRIVATE_UNIQUE_ID __COUNTER__
15361545#else
15371546#define BENCHMARK_PRIVATE_UNIQUE_ID __LINE__
15381547#endif
1548+ BENCHMARK_RESTORE_PEDANTIC_WARNING
15391549
15401550// Helpers for generating unique variable names
15411551#ifdef BENCHMARK_HAS_CXX11
0 commit comments