diff --git a/Test/baseResults/tokenPaste.vert.out b/Test/baseResults/tokenPaste.vert.out index e544d9ee33049fa39059da456fe4c831fef29361..acc2ced1a29cf9935c627f7e95f92602656eeed7 100755 --- a/Test/baseResults/tokenPaste.vert.out +++ b/Test/baseResults/tokenPaste.vert.out @@ -8,7 +8,8 @@ ERROR: 0:69: '##' : combined token is invalid ERROR: 0:82: 'macro expansion' : Too few args in Macro rec ERROR: 0:82: '##' : unexpected location ERROR: 0:82: '##' : unexpected location -ERROR: 8 compilation errors. No code generated. +ERROR: 0:86: '##' : unexpected location; end of argument +ERROR: 9 compilation errors. No code generated. Shader version: 450 diff --git a/Test/tokenPaste.vert b/Test/tokenPaste.vert index 7aa113a29249a6a838412a462714b28c694fd4e0..40de6f92199ccf6ed47c0a0c9fa623fa15e0bb75 100644 --- a/Test/tokenPaste.vert +++ b/Test/tokenPaste.vert @@ -79,4 +79,8 @@ uniform M_OUTER(argPaste); uniform M_OUTER2(argPaste); #define rec(x)## -rec(rec()) \ No newline at end of file +rec(rec()) + +#define bax(bay) +#define baz bax(/##) +baz diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 0b72b5b1e75737715827b5786159a04990436ee1..2704df3a21e2018dae6a8f5bb3f127c0fdd9d713 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.1971" +#define GLSLANG_REVISION "Overload400-PrecQual.1974" #define GLSLANG_DATE "04-Apr-2017" diff --git a/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/glslang/MachineIndependent/preprocessor/PpScanner.cpp index b9e7a5b542e888b5a9cdcbad83f0e6cdfc9b8210..dd1626932bb2ec40ea245e9c2d021fcf2b50765c 100644 --- a/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -799,6 +799,7 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken) token = scanToken(&pastedPpToken); assert(token == PpAtomPaste); + // This covers end of macro expansion if (endOfReplacementList()) { parseContext.ppError(ppToken.loc, "unexpected location; end of replacement list", "##", ""); break; @@ -807,6 +808,12 @@ int TPpContext::tokenPaste(int token, TPpToken& ppToken) // get the token after the ## token = scanToken(&pastedPpToken); + // This covers end of argument expansion + if (token == tMarkerInput::marker) { + parseContext.ppError(ppToken.loc, "unexpected location; end of argument", "##", ""); + break; + } + // get the token text switch (resultToken) { case PpAtomIdentifier: