diff --git a/Test/baseResults/badMacroArgs.frag.out b/Test/baseResults/badMacroArgs.frag.out index 6a46a0f3..95937ce3 100644 --- a/Test/baseResults/badMacroArgs.frag.out +++ b/Test/baseResults/badMacroArgs.frag.out @@ -1,7 +1,7 @@ badMacroArgs.frag 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: '' : syntax error +ERROR: 0:4: '' : compilation terminated ERROR: 2 compilation errors. No code generated. diff --git a/Test/baseResults/cppNest.vert.out b/Test/baseResults/cppNest.vert.out index 4f95f5a2..df905579 100644 --- a/Test/baseResults/cppNest.vert.out +++ b/Test/baseResults/cppNest.vert.out @@ -4,7 +4,7 @@ ERROR: 0:152: '#else' : #else after #else ERROR: 0:161: '#elif' : #elif after #else ERROR: 0:169: '#else' : #else after #else 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. diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index b064e5b2..f5cd5f15 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // 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). -#define GLSLANG_REVISION "Overload400-PrecQual.1454" -#define GLSLANG_DATE "29-Aug-2016" +#define GLSLANG_REVISION "Overload400-PrecQual.1456" +#define GLSLANG_DATE "31-Aug-2016" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 42dafbd1..24f106a4 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -55,7 +55,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0), inMain(false), postMainReturn(false), currentFunctionType(nullptr), blockName(nullptr), limits(resources.limits), parsingBuiltins(parsingBuiltins), - afterEOF(false), atomicUintOffsets(nullptr), anyIndexLimits(false) { // 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 +// 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) { - if (afterEOF) { - if (tokensBeforeEOF == 1) - error(getCurrentLoc(), "", "premature end of input", s, ""); - } else + if (! getScanner()->atEndOfInput() || numErrors == 0) error(getCurrentLoc(), "", "", s, ""); + else + error(getCurrentLoc(), "compilation terminated", "", ""); } void TParseContext::handlePragma(const TSourceLoc& loc, const TVector& tokens) diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 19830399..aa92954b 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -77,7 +77,7 @@ public: EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TInfoSink& infoSink, bool forwardCompatible, EShMessages messages) : TParseVersions(interm, version, profile, spvVersion, language, infoSink, forwardCompatible, messages), - symbolTable(symbolTable), tokensBeforeEOF(false), + symbolTable(symbolTable), linkage(nullptr), scanContext(nullptr), ppContext(nullptr) { } virtual ~TParseContextBase() { } @@ -125,7 +125,6 @@ public: } TSymbolTable& symbolTable; // symbol table that goes with the current language, version, and profile - bool tokensBeforeEOF; protected: TParseContextBase(TParseContextBase&); @@ -387,7 +386,6 @@ protected: static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2 * 2 * 2)); // see computeSamplerTypeIndex() TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex]; TPrecisionManager precisionManager; - bool afterEOF; TQualifier globalBufferDefaults; TQualifier globalUniformDefaults; TQualifier globalInputDefaults; diff --git a/glslang/MachineIndependent/Scan.h b/glslang/MachineIndependent/Scan.h index 4282cd59..67c86d2e 100644 --- a/glslang/MachineIndependent/Scan.h +++ b/glslang/MachineIndependent/Scan.h @@ -204,6 +204,8 @@ public: currentSource = numSources; } + bool atEndOfInput() const { return endOfFileReached; } + const TSourceLoc& getSourceLoc() const { if (singleLogical) { diff --git a/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp index dad4c425..d6b76c57 100644 --- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -762,12 +762,8 @@ const char* TPpContext::tokenize(TPpToken* ppToken) break; } - if (tokenString) { - if (tokenString[0] != 0) - parseContext.tokensBeforeEOF = 1; - + if (tokenString) return tokenString; - } } } diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index 74609b77..a214df96 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -55,7 +55,6 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), postMainReturn(false), limits(resources.limits), - afterEOF(false), entryPointOutput(nullptr) { // ensure we always have a linkage node, even if empty, to simplify tree topology algorithms diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index f7ac1750..2f5ee570 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -189,7 +189,6 @@ protected: HlslParseContext& operator=(HlslParseContext&); static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex() - bool afterEOF; TQualifier globalBufferDefaults; TQualifier globalUniformDefaults; TQualifier globalInputDefaults;