Skip to content

Commit

Permalink
suppress warning interference-size
Browse files Browse the repository at this point in the history
Summary: Let uses of `folly::hardware_constructive_interference_size` and `folly::hardware_destructive_interference_size` no longer warn.

Reviewed By: Gownta

Differential Revision: D68400814

fbshipit-source-id: 67d58945f5f5eb3ea731a729fe1ee60a0887cd95
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Jan 21, 2025
1 parent 95c9b2b commit ffbab25
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions folly/lang/Align.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,25 @@ struct alignas(max_align_v) max_align_t {};

#if defined(__cpp_lib_hardware_interference_size)

using std::hardware_constructive_interference_size;
using std::hardware_destructive_interference_size;
// GCC unconditionally warns about uses of the std's interference-size
// constants, on the basis that their uses in public ABIs is likely broken:
//
// its value can vary between compiler versions or with different ‘-mtune’
// or ‘-mcpu’ flags; if this use is part of a public ABI, change it to
// instead use a constant variable you define
//
// For now, these remain theoretical concerns in the expected scenario, where
// all of the application is built together with the same compiler options.
FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Winterference-size")

constexpr std::size_t hardware_constructive_interference_size =
std::hardware_constructive_interference_size;

constexpr std::size_t hardware_destructive_interference_size =
std::hardware_destructive_interference_size;

FOLLY_POP_WARNING

#else

Expand Down

0 comments on commit ffbab25

Please sign in to comment.