Skip to content

Commit 6ec16eb

Browse files
committed
[libc] Remove atomic alignment diagnostics globally
Summary: These warnings mean that it will lower to a libcall. Previously we just disabled it locally, which didn't work with GCC. This patch does it globally in the compiler options if the compiler is clang.
1 parent d0527ab commit 6ec16eb

File tree

3 files changed

+1
-12
lines changed

3 files changed

+1
-12
lines changed

libc/cmake/modules/LLVMLibCCompileOptionRules.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function(_get_common_compile_options output_var flags)
8787
list(APPEND compile_options "-Wstrict-prototypes")
8888
list(APPEND compile_options "-Wthread-safety")
8989
list(APPEND compile_options "-Wglobal-constructors")
90+
list(APPEND compile_options "-Wno-atomic-alignment")
9091
endif()
9192
elseif(MSVC)
9293
list(APPEND compile_options "/EHs-c-")

libc/src/stdlib/rand.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313

1414
namespace LIBC_NAMESPACE {
1515

16-
// Silence warnings on targets with slow atomics.
17-
#pragma GCC diagnostic push
18-
#pragma GCC diagnostic ignored "-Watomic-alignment"
19-
2016
// An implementation of the xorshift64star pseudo random number generator. This
2117
// is a good general purpose generator for most non-cryptographics applications.
2218
LLVM_LIBC_FUNCTION(int, rand, (void)) {
@@ -33,6 +29,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) {
3329
}
3430
}
3531

36-
#pragma GCC diagnostic pop
37-
3832
} // namespace LIBC_NAMESPACE

libc/src/stdlib/srand.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@
1212

1313
namespace LIBC_NAMESPACE {
1414

15-
// Silence warnings on targets with slow atomics.
16-
#pragma GCC diagnostic push
17-
#pragma GCC diagnostic ignored "-Watomic-alignment"
18-
1915
LLVM_LIBC_FUNCTION(void, srand, (unsigned int seed)) {
2016
rand_next.store(seed, cpp::MemoryOrder::RELAXED);
2117
}
2218

23-
#pragma GCC diagnostic pop
24-
2519
} // namespace LIBC_NAMESPACE

0 commit comments

Comments
 (0)