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
Stdatomic.h was potentially redefining _Atomic, in spite of a
prior definition by <atomic>. This could cause g++ builds that
included <stdatomic.h> with an available <atomic> header to break.
Change-Id: I562c7115118c0587d594d4d5b62d25101e47bfd8
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
This is an alternate, somewhat simpler, fix that makes it safe to
include both <atomic> and <stdatomic.h> from C++ code in either order.
It means that C code consistently uses one implementation of atomics
and C++ another. We still have to make sure that those two
implementations interoperate correctly at runtime; in particular,
any flavor of atomic object needs to be represented exactly like the
underlying type, with the proper alignment constraint.
Bug:17007799
Change-Id: Iffcfc5220d8fa150f89dd083a121b24d23f268fc
Some platform code is apparently compiled with switches that do
not support char16_t and char32_t. This caused stdatomic.h to fail
to compile. This CL makes stdatomic.h usable in those environments.
Change-Id: Ie5a17f20b8b545c97128d00605b4eabd2a6bfe3e