diff options
author | Hans Boehm <hboehm@google.com> | 2014-08-28 15:21:32 -0700 |
---|---|---|
committer | Hans Boehm <hboehm@google.com> | 2014-09-02 11:37:02 -0700 |
commit | 9ac60bf82b1f0e316666b862e9924f90caa60342 (patch) | |
tree | 23d3f05c668cab59870dd136ad1f9cc1368c25eb /tests/stdatomic_test.cpp | |
parent | 2b10e2f12262c5ac5d8dac4f0bfc16b1848cbfec (diff) | |
download | bionic-9ac60bf82b1f0e316666b862e9924f90caa60342.zip bionic-9ac60bf82b1f0e316666b862e9924f90caa60342.tar.gz bionic-9ac60bf82b1f0e316666b862e9924f90caa60342.tar.bz2 |
Make stdatomic.h work with gcc4.6 host compiler
This is needed to make L work correctly, and bionic tests pass
again, after applying the equivalent of
commit 00aaea364501b3b0abe58dae461136159df1e356 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
(cherry picked from commit 32429606bf696d3b2ca555f132a0d60c566d0bd0)
Diffstat (limited to 'tests/stdatomic_test.cpp')
-rw-r--r-- | tests/stdatomic_test.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp index 222bd9c..b7fb19b 100644 --- a/tests/stdatomic_test.cpp +++ b/tests/stdatomic_test.cpp @@ -63,14 +63,17 @@ TEST(stdatomic, atomic_signal_fence) { TEST(stdatomic, atomic_is_lock_free) { atomic_char small; - atomic_intmax_t big; ASSERT_TRUE(atomic_is_lock_free(&small)); +#if defined(__clang__) || __GNUC_PREREQ(4, 7) + // Otherwise stdatomic.h doesn't handle this. + atomic_intmax_t big; // atomic_intmax_t(size = 64) is not lock free on mips32. #if defined(__mips__) && !defined(__LP64__) ASSERT_FALSE(atomic_is_lock_free(&big)); #else ASSERT_TRUE(atomic_is_lock_free(&big)); #endif +#endif } TEST(stdatomic, atomic_flag) { |