This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 2/8] Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++. It clashes with the one in libc++'s <atomic> header.
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Cc: dim <dim at FreeBSD dot org>
- Date: Tue, 4 Apr 2017 09:04:53 +0200
- Subject: [PATCH 2/8] Stop exposing the C11 _Atomic() macro in <sys/cdefs.h>, when compiling for C++. It clashes with the one in libc++'s <atomic> header.
- Authentication-results: sourceware.org; auth=none
- References: <1491289499-30548-1-git-send-email-sebastian.huber@embedded-brains.de>
From: dim <dim@FreeBSD.org>
(Previously, the _Atomic() macro was defined in <stdatomic.h>, which is
only for use with C11, but for various reasons it was moved to its
current location in r251804.)
Discussed with: bdrewery, ed
MFC after: 2 weeks
---
newlib/libc/include/sys/cdefs.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 1e3c6b0..0c8fced 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -295,7 +295,8 @@
#define _Alignof(x) __alignof(x)
#endif
-#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
+#if !defined(__cplusplus) && !__has_extension(c_atomic) && \
+ !__has_extension(cxx_atomic)
/*
* No native support for _Atomic(). Place object in structure to prevent
* most forms of direct non-atomic access.
--
1.8.4.5