summaryrefslogtreecommitdiff
path: root/tests/stdatomic_test.cpp
AgeCommit message (Collapse)Author
2020-07-21Changes for #inclusivefixit.Elliott Hughes
Test: treehugger Change-Id: I7ff0496c5c2792a41781e74634247f55b0548213
2020-03-25Increase iteration count for ordering testHans Boehm
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
2020-02-13Remove mips test workarounds.Elliott Hughes
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
2019-08-14stdatomic_test: always use bits/stdatomic.hTom Cherry
Host includes are updated now, so we always must include bits/stdatomic.h Bug: 137876753 Bug: 138701943 Test: not yet Change-Id: Ib2ce34ae5dace8f9a114fa8c04f864cd7f41a5d9
2019-07-18Change stdatomic.h check from defined(_USING_LIBCXX) to __has_include(<atomic>)Tom Cherry
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
2018-08-02Modernize codebase by replacing NULL with nullptrYi Kong
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2017-04-05Fix compare_exchange_weak tests to allow spurious failureHans Boehm
Test: Ran bionic unit tests on angler. Bug: 36869788 Change-Id: Ic1e0e4e409ac719d5b426391a771b4858a6149ee
2016-06-06Preliminary cleanup of <sys/cdefs.h>.Elliott Hughes
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
2014-09-30Switch benchmarks and tests to libc++.Dan Albert
Change-Id: I3b9c8f8c14a1e227e67ae1977cc29b0e8fccef5d
2014-08-29Make stdatomic.h work with gcc4.6 host compilerHans Boehm
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
2014-08-22Fix, generalize stdatomic.h; improve test.Hans Boehm
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
2014-07-24[MIPS] Fix atomic_is_lock_free test for mips32.Raghu Gandham
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
2014-05-28Fixes stdatomic.h test to match C11 specDan Albert
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
2014-05-23Add C11 <stdatomic.h>.Elliott Hughes
Bug: 14903517 Change-Id: I631dbfdaa698cf7fea8e3b5e18a32586383e62a5