[PATCH] D45470: Emit an error when include <atomic> after <stdatomic.h>

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 9 11:51:27 PDT 2018


vsapsai added a comment.

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

> In https://reviews.llvm.org/D45470#1092212, @vsapsai wrote:
>
> > 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.
>
>
> This worked with `<atomic>` before `<stdatomic.h>` as well as with the order reversed?




  #include <stdatomic.h>
  #include <atomic>

> fatal error: too many errors emitted, stopping now [-ferror-limit=]



  #include <atomic>
  #include <stdatomic.h>

> no errors

So when `<atomic>` is //after// `<stdatomic.h>`, I add one more error to existing. When `<atomic>` is //before// `<stdatomic.h>`, there are no errors and I don't add anything.


https://reviews.llvm.org/D45470





More information about the cfe-commits mailing list