Skip to content

Commit

Permalink
disable the warning in code, not CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
fsb4000 committed Aug 19, 2024
1 parent 3492073 commit bb7df73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

# Disable padding warning because we did it intentionally
# C4324: 'benchmark::State': structure was padded due to alignment specifier
add_cxx_compiler_flag(-wd4324)

if(BENCHMARK_ENABLE_WERROR)
add_cxx_compiler_flag(-WX)
endif()
Expand Down
9 changes: 9 additions & 0 deletions include/benchmark/benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,15 @@ enum Skipped

} // namespace internal

#if defined(_MSC_VER)
#pragma warning(push)
// C4324: 'benchmark::State': structure was padded due to alignment specifier
#pragma warning(disable : 4324)
#endif // _MSC_VER_
// State is passed to a running Benchmark and contains state for the
// benchmark to use.
class BENCHMARK_EXPORT BENCHMARK_INTERNAL_CACHELINE_ALIGNED State {

public:
struct StateIterator;
friend struct StateIterator;
Expand Down Expand Up @@ -1063,6 +1069,9 @@ class BENCHMARK_EXPORT BENCHMARK_INTERNAL_CACHELINE_ALIGNED State {

friend class internal::BenchmarkInstance;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif // _MSC_VER_

inline BENCHMARK_ALWAYS_INLINE bool State::KeepRunning() {
return KeepRunningInternal(1, /*is_batch=*/false);
Expand Down

0 comments on commit bb7df73

Please sign in to comment.