From daec6204e13ab20db9e8f858ab0ef000d46b6cfb Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 15 Feb 2009 02:03:24 -0500 Subject: [PATCH] Fixed line numbers when a preprocessor directive fails. --- mojoshader_preprocessor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mojoshader_preprocessor.c b/mojoshader_preprocessor.c index 878e09c5..87ebae04 100644 --- a/mojoshader_preprocessor.c +++ b/mojoshader_preprocessor.c @@ -553,12 +553,12 @@ int preprocessor_outofmemory(Preprocessor *_ctx) static int require_newline(IncludeState *state) { const char *source = state->source; + const unsigned int linenum = state->line; const Token token = preprocessor_internal_lexer(state); + state->source = source; // rewind no matter what. + state->line = linenum; if (token == TOKEN_INCOMPLETE_COMMENT) - { - state->source = source; // pick this up later. - return 1; // call it an eol. - } // if + return 1; // call it an eol. return ( (token == ((Token) '\n')) || (token == TOKEN_EOI) ); } // require_newline