... to make sure that stores to the same locations are harder to
eliminate.
Also ensure that reader gets a chance to run by sleeping if necessary.
Bug: 308744279
Test: atest stdatomic
Test: Check that we don't usually sleep.
Change-Id: Iddab2a109525f96e065ac8331f227baa08dd8e22
Change our handful of `constexpr static`s to the much more common
`static constexpr`. It's easier to "follow existing style" when there
aren't two existing styles to copy from, and all else being equal,
"majority wins" :-)
Test: treehugger
Change-Id: Ifbf0f62ab84c9450bf9c2e49e96915c126fd20c4
This should make it less likely that the writer finishes before the
reader even starts. It makes the test run longer, but devices have
gotten faster suince this test was written.
Bug: 152218463
Test: Treehugger
Change-Id: I409e59071991095fb17e067760f2a5f29ede0ba2
The mips/mips64 targets were never able to pass these tests, and the
supported architectures don't need any of these workarounds.
Test: treehugger
Change-Id: I640a8b7a98ae13d9d9cdb09b0fbef61d31d4c79a
Host includes are updated now, so we always must include
bits/stdatomic.h
Bug: 137876753
Bug: 138701943
Test: not yet
Change-Id: Ib2ce34ae5dace8f9a114fa8c04f864cd7f41a5d9
The previous check was causing some problems with platform builds
using the NDK. The new check is more accurate.
Move the C definitions from stdatomic.h to bits/stdatomic.h since
with the new check, we no longer can use the #undef trick to test
them.
Test: build platform NDK with stdatomic.h in pthread.h header
Test: stdatomic bionic-unit-tests
Change-Id: Ia0bc3cc8344f2ba4e6e55a52248fb6efee799d1d
We don't support anything other than Clang and GCC, and we don't support
GCC earlier than 4.9.
Move the various synonyms for __attribute__(__whatever__) together.
Fix a __STDC__VERSION__ (for __STDC_VERSION__) typo.
Drop support for BSD _ANSI_SOURCE and _C99_SOURCE; there's enough confusing
nonsense here already, and plenty of other ways to ask for obsolete standards.
There are plenty more problems here -- what I really want to do is rationalize
our treatment of __STDC_VERSION__ -- but let's get some of this easy stuff
out of the way first.
Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: I7526b9770fdc01f8a4667781b65e2fb08287b20b
This is needed to make L work correctly, and bionic tests pass
again, after applying the equivalent of
commit 00aaea3645 there.
It makes the preexisting code that uses __sync implementations
much more useful, although we should no longer be exercising that
code in AOSP.
Specifically fixes:
We were invoking __has_extension and __has_builtin for GCC compilations.
They're clang specific. Restructured the tests.
The __sync implementation was not defining the LOCK_FREE macros.
ATOMIC_VAR_INIT was using named field initializations. These are a
C, not C++, feature, that is not supported by g++ 4.6.
The stdatomic bionic test still failed with 4.6 and glibc with our
questionable LOCK_FREE macro implementation. Don't run that piece
with 4.6.
In L, this is a prerequisite for fixing:
Bug:16880454
Bug:16513433
Change-Id: I9b61e42307f96a114dce7552b6ead4ad1c544eab
We seem to use this stdatomic.h sometimes, and slightly different prebuilts
at other times, making them all difficult to test, and making it unclear
which one we're testing. This generalizes the bionic header so that it
can be used directly as the prebuilt header as well. So long as they
don't diverge again, that should somewhat improve test coverage.
Use the correct builtin for atomic_is_lock_free.
Fix atomic_flag_init.
Turn on atomic tests even with __GLIBC__, since they now appear to pass.
Include uchar.h in stdatomic.h where needed.
Add a basic memory ordering test.
Fix bit-rotted comments in bionic tests makefile.
Change-Id: If6a14c1075b379395ba5d93357d56025c0ffab68
On 32-bit MIPS, 64-bit atomic ops are achieved through locks.
So allow the test to fail for atomic_intmax_t on 32-bit MIPS.
Change-Id: I78e7807e50f899a0fea0d5b388d9ebb53228aaa0
C11 defines the expected value to atomic_compare_exchange_* as being non-atomic
types. Using an atomic type is a syntax error in clang.
http://en.cppreference.com/w/c/atomic/atomic_compare_exchange
Change-Id: I74de1061fa1fc50d835451792d902000f368200e