Skip to content

Commit f23a5f0

Browse files
authored
[libc] Remove atomic alignment diagnostics globally (#96803)
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 5dcf3d5 commit f23a5f0

File tree

3 files changed

+1
-13
lines changed

3 files changed

+1
-13
lines changed

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ foreach(target armv6m-unknown-eabi;armv7m-unknown-eabi;armv8m-unknown-eabi)
321321
set(RUNTIMES_${target}_CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "")
322322
set(RUNTIMES_${target}_CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY CACHE STRING "")
323323
foreach(lang C;CXX;ASM)
324-
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -mthumb" CACHE STRING "")
324+
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "--target=${target} -mthumb -Wno-atomic-alignment" CACHE STRING "")
325325
endforeach()
326326
foreach(type SHARED;MODULE;EXE)
327327
set(RUNTIMES_${target}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "")

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)