Skip to content

Commit a476d0f

Browse files
authoredAug 8, 2022
Avoid deprecation warning in NVHPC (google#1459)
* Avoid deprecation warning in NVHPC * Use more general NVCC identification macro
1 parent 974cd5a commit a476d0f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎include/benchmark/benchmark.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ BENCHMARK(BM_test)->Unit(benchmark::kMillisecond);
231231
#define BENCHMARK_INTERNAL_TOSTRING(x) BENCHMARK_INTERNAL_TOSTRING2(x)
232232

233233
// clang-format off
234-
#if defined(__GNUC__) || defined(__clang__)
234+
#if defined(__GNUC__) && !defined(__NVCC__) || defined(__clang__)
235235
#define BENCHMARK_BUILTIN_EXPECT(x, y) __builtin_expect(x, y)
236236
#define BENCHMARK_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
237237
#define BENCHMARK_DISABLE_DEPRECATED_WARNING \

‎src/benchmark.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ State::State(IterationCount max_iters, const std::vector<int64_t>& ranges,
182182
#pragma GCC diagnostic push
183183
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
184184
#endif
185-
#if defined(__CUDACC__)
185+
#if defined(__NVCC__)
186186
#pragma nv_diagnostic push
187187
#pragma nv_diag_suppress 1427
188188
#endif
@@ -196,7 +196,7 @@ State::State(IterationCount max_iters, const std::vector<int64_t>& ranges,
196196
#elif defined(__GNUC__)
197197
#pragma GCC diagnostic pop
198198
#endif
199-
#if defined(__CUDACC__)
199+
#if defined(__NVCC__)
200200
#pragma nv_diagnostic pop
201201
#endif
202202
}

0 commit comments

Comments
 (0)
Please sign in to comment.