Front-ends: Remove now defunct afterEOF and related, use scanner's instead.
Code using atEndOfFile was dead, instead do something useful with the scanners atEndOfInput(). This allows a better error message for early termination of cascading errors.
This commit is contained in:
parent
830b0cc98b
commit
5e56423046
@ -1,7 +1,7 @@
|
|||||||
badMacroArgs.frag
|
badMacroArgs.frag
|
||||||
Warning, version 400 is not yet complete; most version-specific features are present, but some are missing.
|
Warning, version 400 is not yet complete; most version-specific features are present, but some are missing.
|
||||||
ERROR: 0:4: 'macro expansion' : Too few args in Macro m
|
ERROR: 0:4: 'macro expansion' : Too few args in Macro m
|
||||||
ERROR: 0:4: '' : syntax error
|
ERROR: 0:4: '' : compilation terminated
|
||||||
ERROR: 2 compilation errors. No code generated.
|
ERROR: 2 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ ERROR: 0:152: '#else' : #else after #else
|
|||||||
ERROR: 0:161: '#elif' : #elif after #else
|
ERROR: 0:161: '#elif' : #elif after #else
|
||||||
ERROR: 0:169: '#else' : #else after #else
|
ERROR: 0:169: '#else' : #else after #else
|
||||||
ERROR: 0:177: 'macro expansion' : End of input in macro FUNC
|
ERROR: 0:177: 'macro expansion' : End of input in macro FUNC
|
||||||
ERROR: 0:178: '' : syntax error
|
ERROR: 0:178: '' : compilation terminated
|
||||||
ERROR: 6 compilation errors. No code generated.
|
ERROR: 6 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// For the version, it uses the latest git tag followed by the number of commits.
|
||||||
// For the date, it uses the current date (when then script is run).
|
// For the date, it uses the current date (when then script is run).
|
||||||
|
|
||||||
#define GLSLANG_REVISION "Overload400-PrecQual.1454"
|
#define GLSLANG_REVISION "Overload400-PrecQual.1456"
|
||||||
#define GLSLANG_DATE "29-Aug-2016"
|
#define GLSLANG_DATE "31-Aug-2016"
|
||||||
|
@ -55,7 +55,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
|
|||||||
contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0),
|
contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0),
|
||||||
inMain(false), postMainReturn(false), currentFunctionType(nullptr), blockName(nullptr),
|
inMain(false), postMainReturn(false), currentFunctionType(nullptr), blockName(nullptr),
|
||||||
limits(resources.limits), parsingBuiltins(parsingBuiltins),
|
limits(resources.limits), parsingBuiltins(parsingBuiltins),
|
||||||
afterEOF(false),
|
|
||||||
atomicUintOffsets(nullptr), anyIndexLimits(false)
|
atomicUintOffsets(nullptr), anyIndexLimits(false)
|
||||||
{
|
{
|
||||||
// ensure we always have a linkage node, even if empty, to simplify tree topology algorithms
|
// ensure we always have a linkage node, even if empty, to simplify tree topology algorithms
|
||||||
@ -193,13 +192,15 @@ bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& inp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is called from bison when it has a parse (syntax) error
|
// This is called from bison when it has a parse (syntax) error
|
||||||
|
// Note though that to stop cascading errors, we set EOF, which
|
||||||
|
// will usually cause a syntax error, so be more accurate that
|
||||||
|
// compilation is terminating.
|
||||||
void TParseContext::parserError(const char* s)
|
void TParseContext::parserError(const char* s)
|
||||||
{
|
{
|
||||||
if (afterEOF) {
|
if (! getScanner()->atEndOfInput() || numErrors == 0)
|
||||||
if (tokensBeforeEOF == 1)
|
|
||||||
error(getCurrentLoc(), "", "premature end of input", s, "");
|
|
||||||
} else
|
|
||||||
error(getCurrentLoc(), "", "", s, "");
|
error(getCurrentLoc(), "", "", s, "");
|
||||||
|
else
|
||||||
|
error(getCurrentLoc(), "compilation terminated", "", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
|
void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
|
EProfile profile, const SpvVersion& spvVersion, EShLanguage language,
|
||||||
TInfoSink& infoSink, bool forwardCompatible, EShMessages messages)
|
TInfoSink& infoSink, bool forwardCompatible, EShMessages messages)
|
||||||
: TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
|
: TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages),
|
||||||
symbolTable(symbolTable), tokensBeforeEOF(false),
|
symbolTable(symbolTable),
|
||||||
linkage(nullptr), scanContext(nullptr), ppContext(nullptr) { }
|
linkage(nullptr), scanContext(nullptr), ppContext(nullptr) { }
|
||||||
virtual ~TParseContextBase() { }
|
virtual ~TParseContextBase() { }
|
||||||
|
|
||||||
@ -125,7 +125,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile
|
TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile
|
||||||
bool tokensBeforeEOF;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TParseContextBase(TParseContextBase&);
|
TParseContextBase(TParseContextBase&);
|
||||||
@ -387,7 +386,6 @@ protected:
|
|||||||
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex()
|
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex()
|
||||||
TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex];
|
TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex];
|
||||||
TPrecisionManager precisionManager;
|
TPrecisionManager precisionManager;
|
||||||
bool afterEOF;
|
|
||||||
TQualifier globalBufferDefaults;
|
TQualifier globalBufferDefaults;
|
||||||
TQualifier globalUniformDefaults;
|
TQualifier globalUniformDefaults;
|
||||||
TQualifier globalInputDefaults;
|
TQualifier globalInputDefaults;
|
||||||
|
@ -204,6 +204,8 @@ public:
|
|||||||
currentSource = numSources;
|
currentSource = numSources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool atEndOfInput() const { return endOfFileReached; }
|
||||||
|
|
||||||
const TSourceLoc& getSourceLoc() const
|
const TSourceLoc& getSourceLoc() const
|
||||||
{
|
{
|
||||||
if (singleLogical) {
|
if (singleLogical) {
|
||||||
|
@ -762,13 +762,9 @@ const char* TPpContext::tokenize(TPpToken* ppToken)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tokenString) {
|
if (tokenString)
|
||||||
if (tokenString[0] != 0)
|
|
||||||
parseContext.tokensBeforeEOF = 1;
|
|
||||||
|
|
||||||
return tokenString;
|
return tokenString;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if we've seen balanced #if...#endif
|
// Checks if we've seen balanced #if...#endif
|
||||||
|
@ -55,7 +55,6 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
|
|||||||
contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
|
contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0),
|
||||||
postMainReturn(false),
|
postMainReturn(false),
|
||||||
limits(resources.limits),
|
limits(resources.limits),
|
||||||
afterEOF(false),
|
|
||||||
entryPointOutput(nullptr)
|
entryPointOutput(nullptr)
|
||||||
{
|
{
|
||||||
// ensure we always have a linkage node, even if empty, to simplify tree topology algorithms
|
// ensure we always have a linkage node, even if empty, to simplify tree topology algorithms
|
||||||
|
@ -189,7 +189,6 @@ protected:
|
|||||||
HlslParseContext& operator=(HlslParseContext&);
|
HlslParseContext& operator=(HlslParseContext&);
|
||||||
|
|
||||||
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex()
|
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex()
|
||||||
bool afterEOF;
|
|
||||||
TQualifier globalBufferDefaults;
|
TQualifier globalBufferDefaults;
|
||||||
TQualifier globalUniformDefaults;
|
TQualifier globalUniformDefaults;
|
||||||
TQualifier globalInputDefaults;
|
TQualifier globalInputDefaults;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user