summaryrefslogtreecommitdiffstats
path: root/libc/include
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2014-08-26 15:58:15 -0700
committerHans Boehm <hboehm@google.com>2014-09-02 10:32:34 -0700
commit2b10e2f12262c5ac5d8dac4f0bfc16b1848cbfec (patch)
treee8123aab9142d79227d17f2d6a725a16822dd15e /libc/include
parentc8cf3513ecb265ba3aadc846aa2113290a504c44 (diff)
downloadbionic-2b10e2f12262c5ac5d8dac4f0bfc16b1848cbfec.zip
bionic-2b10e2f12262c5ac5d8dac4f0bfc16b1848cbfec.tar.gz
bionic-2b10e2f12262c5ac5d8dac4f0bfc16b1848cbfec.tar.bz2
Undefine _Atomic before redefining
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. A functional stdatomic.h is a prerequisite for fixing the following bugs. This is the middle of 3 AOSP updates to bionics stdatomic.h that are needded to get there. Bug:16880454 Bug:16513433 Change-Id: I562c7115118c0587d594d4d5b62d25101e47bfd8 (cherry picked from commit 3e4a0099a179d7acee63d78c8fc4c3cc7b0bae42)
Diffstat (limited to 'libc/include')
-rw-r--r--libc/include/stdatomic.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/include/stdatomic.h b/libc/include/stdatomic.h
index e5420ff..47b333c 100644
--- a/libc/include/stdatomic.h
+++ b/libc/include/stdatomic.h
@@ -39,6 +39,13 @@
#include <atomic>
+#undef _Atomic
+ /* Also defined by <atomic> for gcc. But not used in macros. */
+ /* Also a clang intrinsic. */
+ /* Should not be used by client code before this file is */
+ /* included. The definitions in <atomic> themselves see */
+ /* the old definition, as they should. */
+ /* Client code sees the following definition. */
#define _Atomic(t) std::atomic<t>
using std::atomic_is_lock_free;