summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2018-05-02 17:56:45 +0000
committerVolodymyr Sapsai <vsapsai@apple.com>2018-05-02 17:56:45 +0000
commitdea80d5174178482fad4deb435a1bc849b9c5abb (patch)
tree44ceb733e8a439aa023be0e3f6b8621a29edffea /libcxx/include
parentc0a278aada533d52ab0f481abdcab582861d05b2 (diff)
downloadbcm5719-llvm-dea80d5174178482fad4deb435a1bc849b9c5abb.tar.gz
bcm5719-llvm-dea80d5174178482fad4deb435a1bc849b9c5abb.zip
Emit an error when mixing <stdatomic.h> and <atomic>
Atomics in C and C++ are incompatible at the moment and mixing the headers can result in confusing error messages. Emit an error explicitly telling about the incompatibility. Introduce the macro `__ALLOW_STDC_ATOMICS_IN_CXX__` that allows to choose in C++ between C atomics and C++ atomics. rdar://problem/27435938 Reviewers: rsmith, EricWF, mclow.lists Reviewed By: mclow.lists Subscribers: jkorous-apple, christof, bumblebritches57, JonChesterfield, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D45470 llvm-svn: 331379
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/atomic3
1 files changed, 3 insertions, 0 deletions
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 34a2a58b20c..adffc354a87 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -555,6 +555,9 @@ void atomic_signal_fence(memory_order m) noexcept;
#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
#error <atomic> is not implemented
#endif
+#ifdef __ALLOW_STDC_ATOMICS_IN_CXX__
+#error <stdatomic.h> is incompatible with the C++ standard library
+#endif
#if _LIBCPP_STD_VER > 14
# define __cpp_lib_atomic_is_always_lock_free 201603L
OpenPOWER on IntegriCloud