[cfe-dev] [RFC] Make <atomic> and <stdatomic.h> explicitly incompatible
Volodymyr Sapsai via cfe-dev
cfe-dev at lists.llvm.org
Wed Mar 7 12:32:05 PST 2018
Hello all,
Currently atomics are available in C through <stdatomic.h> and in C++ through <atomic>. These headers have some common names, so using both of them in the same translation unit usually doesn’t work. The downside is that in some cases diagnostic can be overly verbose and overwhelming. For example, compiling just 2 lines
#include <stdatomic.h>
#include <atomic>
results in 68 errors.
I am proposing to make these headers explicitly incompatible, so we have just a single error telling so instead of multiple errors. What do you think?
Alternative solution is to make these headers compatible. But the consensus seems to be that it’s not the right solution. See https://reviews.llvm.org/D26376 <https://reviews.llvm.org/D26376> for more details. There is also a proposal P0943R0: Support C atomics in C++ <http://open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0943r0.html>. As far as I can tell, my proposal doesn’t interfere with P0943R0 but will be obsolete if that proposal is accepted. Regardless of the future development I think it is still beneficial to have better diagnostics in the short term.
I am not providing concrete implementation yet, at first I want to know the opinion of the community on the matter.
Thanks,
Volodymyr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180307/666af01c/attachment.html>
More information about the cfe-dev
mailing list