From 2dcd52dd206448ebbe8ae3fc316edd5b736f6b50 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Fri, 15 Feb 2013 15:01:50 -0500 Subject: [PATCH] Only turn on whitespace/comment reporting when not in a preprocessor handler. Things like "#define" handling need to manipulate that lexer state directly. --- mojoshader_preprocessor.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index 9bdaa659..4ea172d1 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -546,10 +546,6 @@ static int push_source(Context *ctx, const char *fname, const char *source, } // if } // if - #if !MATCH_MICROSOFT_PREPROCESSOR - state->report_comments = 1; - #endif - state->close_callback = close_callback; state->source_base = source; state->source = source; @@ -732,10 +728,6 @@ static inline void pushback(IncludeState *state) static Token lexer(IncludeState *state) { - #if !MATCH_MICROSOFT_PREPROCESSOR - state->report_whitespace = 1; - #endif - if (!state->pushedback) return preprocessor_lexer(state); state->pushedback = 0; @@ -2022,8 +2014,18 @@ static inline const char *_preprocessor_nexttoken(Preprocessor *_ctx, const Conditional *cond = state->conditional_stack; const int skipping = ((cond != NULL) && (cond->skipping)); + #if !MATCH_MICROSOFT_PREPROCESSOR + state->report_whitespace = 1; + state->report_comments = 1; + #endif + const Token token = lexer(state); + #if !MATCH_MICROSOFT_PREPROCESSOR + state->report_whitespace = 0; + state->report_comments = 0; + #endif + if (token != TOKEN_IDENTIFIER) ctx->recursion_count = 0;