Commit 4b6bfe10 by Jamie Madill

Revert "Track if a non-preprocessor token has been seen and validate #extension with it."

Causing failures in the GLES2 CTS "build", related to extensions. BUG=483252 BUG=angleproject:989 This reverts commit bbdb9e22. Change-Id: I3e1ad989af645194c8ee9b9847b2131e289d09e1 Reviewed-on: https://chromium-review.googlesource.com/269403Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent fee03501
...@@ -123,8 +123,6 @@ std::string Diagnostics::message(ID id) ...@@ -123,8 +123,6 @@ std::string Diagnostics::message(ID id)
return "unexpected token after conditional expression"; return "unexpected token after conditional expression";
case PP_UNRECOGNIZED_PRAGMA: case PP_UNRECOGNIZED_PRAGMA:
return "unrecognized pragma"; return "unrecognized pragma";
case PP_NON_PP_TOKEN_BEFORE_EXTENSION:
return "extension directive must occur before any non-preprocessor tokens";
// Warnings end. // Warnings end.
default: default:
assert(false); assert(false);
......
...@@ -70,7 +70,6 @@ class Diagnostics ...@@ -70,7 +70,6 @@ class Diagnostics
PP_WARNING_BEGIN, PP_WARNING_BEGIN,
PP_EOF_IN_DIRECTIVE, PP_EOF_IN_DIRECTIVE,
PP_UNRECOGNIZED_PRAGMA, PP_UNRECOGNIZED_PRAGMA,
PP_NON_PP_TOKEN_BEFORE_EXTENSION,
PP_WARNING_END PP_WARNING_END
}; };
......
...@@ -211,7 +211,6 @@ DirectiveParser::DirectiveParser(Tokenizer *tokenizer, ...@@ -211,7 +211,6 @@ DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
Diagnostics *diagnostics, Diagnostics *diagnostics,
DirectiveHandler *directiveHandler) DirectiveHandler *directiveHandler)
: mPastFirstStatement(false), : mPastFirstStatement(false),
mSeenNonPreprocessorToken(false),
mTokenizer(tokenizer), mTokenizer(tokenizer),
mMacroSet(macroSet), mMacroSet(macroSet),
mDiagnostics(diagnostics), mDiagnostics(diagnostics),
...@@ -230,10 +229,6 @@ void DirectiveParser::lex(Token *token) ...@@ -230,10 +229,6 @@ void DirectiveParser::lex(Token *token)
parseDirective(token); parseDirective(token);
mPastFirstStatement = true; mPastFirstStatement = true;
} }
else if (!isEOD(token))
{
mSeenNonPreprocessorToken = true;
}
if (token->type == Token::LAST) if (token->type == Token::LAST)
{ {
...@@ -720,12 +715,6 @@ void DirectiveParser::parseExtension(Token *token) ...@@ -720,12 +715,6 @@ void DirectiveParser::parseExtension(Token *token)
token->location, token->text); token->location, token->text);
valid = false; valid = false;
} }
if (valid && mSeenNonPreprocessorToken)
{
mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION,
token->location, token->text);
valid = false;
}
if (valid) if (valid)
mDirectiveHandler->handleExtension(token->location, name, behavior); mDirectiveHandler->handleExtension(token->location, name, behavior);
} }
......
...@@ -70,8 +70,6 @@ class DirectiveParser : public Lexer ...@@ -70,8 +70,6 @@ class DirectiveParser : public Lexer
} }
}; };
bool mPastFirstStatement; bool mPastFirstStatement;
bool mSeenNonPreprocessorToken; // Tracks if a non-preprocessor token has been seen yet. Some macros, such as
// #extension must be declared before all shader code.
std::vector<ConditionalBlock> mConditionalStack; std::vector<ConditionalBlock> mConditionalStack;
Tokenizer *mTokenizer; Tokenizer *mTokenizer;
MacroSet *mMacroSet; MacroSet *mMacroSet;
......
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