Unexpected tokens after conditionals should be an error instead of a warning. Change-Id: I49d6d36ecf9a5f0d3d333422b3e4970192617c05 Reviewed-on: https://swiftshader-review.googlesource.com/5180 Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/preprocessor/Diagnostics.h b/src/OpenGL/compiler/preprocessor/Diagnostics.h index 8ca62c9..0516c2b 100644 --- a/src/OpenGL/compiler/preprocessor/Diagnostics.h +++ b/src/OpenGL/compiler/preprocessor/Diagnostics.h
@@ -53,6 +53,7 @@ CONDITIONAL_ELIF_WITHOUT_IF, CONDITIONAL_ELIF_AFTER_ELSE, CONDITIONAL_UNTERMINATED, + CONDITIONAL_UNEXPECTED_TOKEN, INVALID_EXTENSION_NAME, INVALID_EXTENSION_BEHAVIOR, INVALID_EXTENSION_DIRECTIVE, @@ -67,7 +68,6 @@ WARNING_BEGIN, EOF_IN_DIRECTIVE, - CONDITIONAL_UNEXPECTED_TOKEN, UNRECOGNIZED_PRAGMA, WARNING_END };
diff --git a/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp b/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp index a76b5f4..cf759b1 100644 --- a/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp +++ b/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp
@@ -490,7 +490,7 @@ block.skipGroup = block.foundValidGroup; block.foundValidGroup = true; - // Warn if there are extra tokens after #else. + // Check if there are extra tokens after #else. mTokenizer->lex(token); if (!isEOD(token)) { @@ -554,7 +554,7 @@ mConditionalStack.pop_back(); - // Warn if there are tokens after #endif. + // Check if there are tokens after #endif. mTokenizer->lex(token); if (!isEOD(token)) { @@ -915,7 +915,7 @@ macroExpander.lex(token); expressionParser.parse(token, &expression); - // Warn if there are tokens after #if expression. + // Check if there are tokens after #if expression. if (!isEOD(token)) { mDiagnostics->report(Diagnostics::CONDITIONAL_UNEXPECTED_TOKEN, @@ -943,7 +943,7 @@ MacroSet::const_iterator iter = mMacroSet->find(token->text); int expression = iter != mMacroSet->end() ? 1 : 0; - // Warn if there are tokens after #ifdef expression. + // Check if there are tokens after #ifdef expression. mTokenizer->lex(token); if (!isEOD(token)) {