[PATCH] D49091: Warn about usage of __has_include/__has_include_next in macro expansions

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 20:19:46 PDT 2019


rsmith added a comment.

Under http://eel.is/c++draft/cpp#cond-7.sentence-2, the identifier `__has_include` can't appear anywhere other than in the context of an `#if`, `#elif`, `#iifdef`, or `#ifndef`. That's what we should be checking for and diagnosing here (and we should produce an `ExtWarn` rather than a `Warning` for this case, because such code is ill-formed, and accepting it at all is a language extension compared to the C++ rules). We should apply the same behavior to `__has_cpp_attribute`, to which the same rule applies.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D49091/new/

https://reviews.llvm.org/D49091





More information about the cfe-commits mailing list