Commit 391befef by Olli Etuaho

Revert "Add pragma errors for malformed pragmas."

Since this commit was made, dEQP tests were fixed to check that unrecognized pragma tokens only generate warnings, not errors. This applies to both ESSL1.00 and ESSL3.00, which specify this behavior in section 3.4 Preprocessor. BUG=angleproject:989 TEST=dEQP-GLES2.functional.shaders.preprocessor.pragmas.* This reverts commit d3c29f57. Change-Id: Ie4e0ec061fa3164d6f3872ac0016a063056ed110 Reviewed-on: https://chromium-review.googlesource.com/293181Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 77a90c26
......@@ -113,10 +113,6 @@ std::string Diagnostics::message(ID id)
return "invalid file number";
case PP_INVALID_LINE_DIRECTIVE:
return "invalid line directive";
case PP_INVALID_PRAGMA:
return "invalid pragma";
case PP_INVALID_PRAGMA_VALUE:
return "invalid pragma value, must be 'on' or 'off'";
case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
return "extension directive must occur before any non-preprocessor tokens in ESSL3";
// Errors end.
......
......@@ -64,8 +64,6 @@ class Diagnostics
PP_INVALID_LINE_NUMBER,
PP_INVALID_FILE_NUMBER,
PP_INVALID_LINE_DIRECTIVE,
PP_INVALID_PRAGMA,
PP_INVALID_PRAGMA_VALUE,
PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
PP_ERROR_END,
......
......@@ -631,8 +631,7 @@ void DirectiveParser::parsePragma(Token *token)
break;
case PRAGMA_VALUE:
value = token->text;
// Pragma value validation is handled in DirectiveHandler::handlePragma
// because the proper pragma value is dependent on the pragma name.
valid = valid && (token->type == Token::IDENTIFIER);
break;
case RIGHT_PAREN:
valid = valid && (token->type == ')');
......@@ -649,7 +648,7 @@ void DirectiveParser::parsePragma(Token *token)
(state == RIGHT_PAREN + 1)); // With value.
if (!valid)
{
mDiagnostics->report(Diagnostics::PP_INVALID_PRAGMA,
mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA,
token->location, name);
}
else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
......
......@@ -98,8 +98,9 @@ void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
if (invalidValue)
{
mDiagnostics.report(pp::Diagnostics::PP_INVALID_PRAGMA_VALUE, loc, value);
return;
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
"invalid pragma value", value,
"'on' or 'off' expected");
}
}
}
......
......@@ -137,9 +137,9 @@ TEST_P(InvalidPragmaTest, Identified)
using testing::_;
// No handlePragma calls.
EXPECT_CALL(mDirectiveHandler, handlePragma(_, _, _, false)).Times(0);
// Invalid pragma error.
// Unrecognized pragma warning.
EXPECT_CALL(mDiagnostics,
print(pp::Diagnostics::PP_INVALID_PRAGMA,
print(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA,
pp::SourceLocation(0, 1), _));
preprocess(str, expected);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment