This revision was automatically updated to reflect the committed changes. Closed by commit rC331378: Emit an error when mixing <stdatomic.h> and <atomic> (authored by vsapsai, committed by ).
Changed prior to commit: https://reviews.llvm.org/D45470?vs=143817&id=144903#toc Repository: rC Clang https://reviews.llvm.org/D45470 Files: lib/Headers/stdatomic.h test/Headers/stdatomic.cpp Index: lib/Headers/stdatomic.h =================================================================== --- lib/Headers/stdatomic.h +++ lib/Headers/stdatomic.h @@ -31,6 +31,10 @@ # include_next <stdatomic.h> #else +#if !defined(__ALLOW_STDC_ATOMICS_IN_CXX__) && defined(__cplusplus) +#error "<stdatomic.h> is incompatible with the C++ standard library; define __ALLOW_STDC_ATOMICS_IN_CXX__ to proceed." +#endif + #include <stddef.h> #include <stdint.h> Index: test/Headers/stdatomic.cpp =================================================================== --- test/Headers/stdatomic.cpp +++ test/Headers/stdatomic.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify +// RUN: %clang_cc1 -D__ALLOW_STDC_ATOMICS_IN_CXX__ %s -verify + +#include <stdatomic.h> + +#ifndef __ALLOW_STDC_ATOMICS_IN_CXX__ +// expected-error@stdatomic.h:* {{<stdatomic.h> is incompatible with the C++ standard library}} +#else +// expected-no-diagnostics +#endif
Index: lib/Headers/stdatomic.h =================================================================== --- lib/Headers/stdatomic.h +++ lib/Headers/stdatomic.h @@ -31,6 +31,10 @@ # include_next <stdatomic.h> #else +#if !defined(__ALLOW_STDC_ATOMICS_IN_CXX__) && defined(__cplusplus) +#error "<stdatomic.h> is incompatible with the C++ standard library; define __ALLOW_STDC_ATOMICS_IN_CXX__ to proceed." +#endif + #include <stddef.h> #include <stdint.h> Index: test/Headers/stdatomic.cpp =================================================================== --- test/Headers/stdatomic.cpp +++ test/Headers/stdatomic.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -verify +// RUN: %clang_cc1 -D__ALLOW_STDC_ATOMICS_IN_CXX__ %s -verify + +#include <stdatomic.h> + +#ifndef __ALLOW_STDC_ATOMICS_IN_CXX__ +// expected-error@stdatomic.h:* {{<stdatomic.h> is incompatible with the C++ standard library}} +#else +// expected-no-diagnostics +#endif
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits