diff options
author | Joseph Huber <huberjn@outlook.com> | 2024-06-26 11:24:48 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-26 11:24:48 -0500 |
commit | d0527ab69765740c1747695bbfe72a3db1781b16 (patch) | |
tree | 79f334ecb0f9e5b936dcdd26538df108c30381ad /libc | |
parent | 19183691f32c8cc6967322523f6fa338617929bd (diff) | |
download | llvm-d0527ab69765740c1747695bbfe72a3db1781b16.zip llvm-d0527ab69765740c1747695bbfe72a3db1781b16.tar.gz llvm-d0527ab69765740c1747695bbfe72a3db1781b16.tar.bz2 |
[libc] Fix Fuscia builder failing on atomic warnings (#96791)
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.
Diffstat (limited to 'libc')
-rw-r--r-- | libc/src/stdlib/rand.cpp | 6 | ||||
-rw-r--r-- | libc/src/stdlib/srand.cpp | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libc/src/stdlib/rand.cpp b/libc/src/stdlib/rand.cpp index ff3875c..8f2ae90 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 21166c7..681aad8 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 |