vsapsai added a comment.

In https://reviews.llvm.org/D45470#1087026, @jfb wrote:

> This isn't bad, so I'd go with it, but separately I imagine that we could 
> implement the suggestion in http://wg21.link/p0943 and expose it even before 
> C++20? Not sure we do this much, but I'd argue that before that fix 
> stdatomic.h is just useless anyways, so it's a fine breakage. I imagine that 
> the stdatomic.h where it's implemented would be the one injected by clang, 
> not the libc++ one?


Change visible here is for the header injected by clang. libc++ change is 
r331379 <https://reviews.llvm.org/rCXX331379> but that error triggers only when 
you consciously decided to opt in C atomics but included C++ `<atomic>`.

I am concerned that the change adds the error to the valid code that uses C 
atomics from C++ and doesn't mix them with C++ atomics. It is unfortunate but I 
think it is a right trade-off. Adding `__ALLOW_STDC_ATOMICS_IN_CXX__` to fix 
such code shouldn't take much time. While having an explicit error can save a 
lot of time trying to figure out a broken build. Also I expect that with time 
libc++ will use `<atomic>` more and mixing currently safe parts of libc++ with 
`<stdatomic.h>` is likely to cause problems at some point. So it is better to 
be prepared and have an explicit error for this case.


Repository:
  rC Clang

https://reviews.llvm.org/D45470



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to