[cfe-commits] [PATCH] Disallow __has_include and __has_include_next outside of preprocessor directives

Dmitri Gribenko gribozavr at gmail.com
Tue Jan 15 14:46:12 PST 2013

On Wed, Jan 16, 2013 at 12:37 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> This patch addresses PR14837, so that __has_include and
> __has_include_next do not work outside of preprocessor directives.
> This fixes a failing assertion, as well as clarifies the behavior (I
> can update the public docs if we think it's desirable).  Patch
> Includes test cases.

Mechanical issues:

+      if (PP.getCurrentLexer()->isParsingPreprocessorDirective())
+      else {

Indentation is funny on the "PP" line.

+        PP.Diag( SLoc, diag::err_pp_directive_required ) << II->getName();

No spaces after "(" and before ")", please.

Why not reject these cases with error at the very beginning of the
function or in the caller, Preprocessor::ExpandBuiltinMacro?


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the cfe-commits mailing list