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 3e4a0099a1)
This commit is contained in:
Hans Boehm 2014-08-26 15:58:15 -07:00
parent c8cf3513ec
commit 2b10e2f122

View file

@ -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;