-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Fix Fuscia builder failing on atomic warnings #96791
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
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
@llvm/pr-subscribers-libc Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/96791.diff 2 Files Affected:
diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp
index ff3875c2f6959..8f2ae90336d51 100644
--- a/libc/src/stdlib/rand.cpp
+++ b/libc/src/stdlib/rand.cpp
@@ -13,6 +13,10 @@
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)) {
@@ -29,4 +33,6 @@ 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 21166c7a6754e..681aad8fac4e8 100644
--- a/libc/src/stdlib/srand.cpp
+++ b/libc/src/stdlib/srand.cpp
@@ -12,8 +12,14 @@
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.
The approach looks fine to me. Just notice that, sometimes inline atomics are not used because the compiler is permissive about target features.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/131/builds/818 Here is the relevant piece of the build log for the reference:
|
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary: This function uses atomics now, which emit warnings on some platforms that don't support full lock-free atomics. These aren't specifically wrong, and in the future we could investigate a libc configuration specialized for single-threaded microprocessors, but for now we should get the bot running again.
Summary:
This function uses atomics now, which emit warnings on some platforms
that don't support full lock-free atomics. These aren't specifically
wrong, and in the future we could investigate a libc configuration
specialized for single-threaded microprocessors, but for now we should
get the bot running again.