-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[libc] Remove atomic alignment diagnostics globally #96803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-clang @llvm/pr-subscribers-libc Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/96803.diff 3 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
index 3bf429381d4af..b49df8b4df6c0 100644
--- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
+++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
@@ -87,6 +87,7 @@ function(_get_common_compile_options output_var flags)
list(APPEND compile_options "-Wstrict-prototypes")
list(APPEND compile_options "-Wthread-safety")
list(APPEND compile_options "-Wglobal-constructors")
+ list(APPEND compile_options "-Wno-atomic-alignment")
endif()
elseif(MSVC)
list(APPEND compile_options "/EHs-c-")
diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp
index 8f2ae90336d51..ff3875c2f6959 100644
--- a/libc/src/stdlib/rand.cpp
+++ b/libc/src/stdlib/rand.cpp
@@ -13,10 +13,6 @@
namespace LIBC_NAMESPACE {
-// Silence warnings on targets with slow atomics.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Watomic-alignment"
-
// An implementation of the xorshift64star pseudo random number generator. This
// is a good general purpose generator for most non-cryptographics applications.
LLVM_LIBC_FUNCTION(int, rand, (void)) {
@@ -33,6 +29,4 @@ LLVM_LIBC_FUNCTION(int, rand, (void)) {
}
}
-#pragma GCC diagnostic pop
-
} // namespace LIBC_NAMESPACE
diff --git a/libc/src/stdlib/srand.cpp b/libc/src/stdlib/srand.cpp
index 681aad8fac4e8..21166c7a6754e 100644
--- a/libc/src/stdlib/srand.cpp
+++ b/libc/src/stdlib/srand.cpp
@@ -12,14 +12,8 @@
namespace LIBC_NAMESPACE {
-// Silence warnings on targets with slow atomics.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Watomic-alignment"
-
LLVM_LIBC_FUNCTION(void, srand, (unsigned int seed)) {
rand_next.store(seed, cpp::MemoryOrder::RELAXED);
}
-#pragma GCC diagnostic pop
-
} // namespace LIBC_NAMESPACE
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patch LGTM; but please wait for @petrhosek to confirm that he's ok with this approach for Fuchsia.
Perhaps we only want to set this for 32b arm?
Unsure how to check that for CMake, but it seems like in general we should probably get let atomics lie where they are. If we want different behavior in-code we should probably use |
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.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/756 Here is the relevant piece of the build log for the reference:
|
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.
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.
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.
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.
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.
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.
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.
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.
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.