[PATCH] D45470: Emit an error when mixing <stdatomic.h> and <atomic>

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 17:07:33 PDT 2018


vsapsai updated this revision to Diff 145817.
vsapsai added a comment.

Here is another approach that should emit an error only when mixing headers
causes compilation problems.

Have no ideas how to test the change. `-verify` doesn't work with fatal errors
and libcxx doesn't use FileCheck. Performed only manual testing.


https://reviews.llvm.org/D45470

Files:
  libcxx/include/atomic


Index: libcxx/include/atomic
===================================================================
--- libcxx/include/atomic
+++ libcxx/include/atomic
@@ -555,6 +555,9 @@
 #if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
 #error <atomic> is not implemented
 #endif
+#ifdef kill_dependency
+#error C++ standard library is incompatible with <stdatomic.h>
+#endif
 
 #if _LIBCPP_STD_VER > 14
 # define __cpp_lib_atomic_is_always_lock_free 201603L


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45470.145817.patch
Type: text/x-patch
Size: 472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180509/2e9f5ef3/attachment.bin>


More information about the cfe-commits mailing list