PP: Fix issue #408: # as last character in macro.
This would look ahead for a second #, for token pasting, and if not found, backup one token. This is fine, unless at the end of line, which would backup the #, rather than the look ahead.
This commit is contained in:
parent
50d4fbe4c7
commit
73d4fb5bc5
20
Test/baseResults/cppBad.vert.out
Executable file
20
Test/baseResults/cppBad.vert.out
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
cppBad.vert
|
||||||
|
ERROR: 0:2: 'preprocessor evaluation' : bad expression
|
||||||
|
ERROR: 0:2: '#if' : unexpected tokens following directive
|
||||||
|
ERROR: 0:3: '' : missing #endif
|
||||||
|
ERROR: 3 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
|
Shader version: 100
|
||||||
|
ERROR: node is still EOpNull!
|
||||||
|
0:? Linker Objects
|
||||||
|
|
||||||
|
|
||||||
|
Linked vertex stage:
|
||||||
|
|
||||||
|
ERROR: Linking vertex stage: Missing entry point: Each stage requires one "void main()" entry point
|
||||||
|
|
||||||
|
Shader version: 100
|
||||||
|
ERROR: node is still EOpNull!
|
||||||
|
0:? Linker Objects
|
||||||
|
|
||||||
2
Test/cppBad.vert
Normal file
2
Test/cppBad.vert
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#define m#0#
|
||||||
|
#if m
|
||||||
@ -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 "SPIRV99.1367"
|
#define GLSLANG_REVISION "SPIRV99.1370"
|
||||||
#define GLSLANG_DATE "30-Jul-2016"
|
#define GLSLANG_DATE "30-Jul-2016"
|
||||||
|
|||||||
@ -180,14 +180,17 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
|||||||
ltoken += 128;
|
ltoken += 128;
|
||||||
switch (ltoken) {
|
switch (ltoken) {
|
||||||
case '#':
|
case '#':
|
||||||
if (lReadByte(pTok) == '#') {
|
// Check for ##, unless the current # is the last character
|
||||||
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
if (pTok->current < pTok->data.size()) {
|
||||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
if (lReadByte(pTok) == '#') {
|
||||||
parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
|
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
||||||
//return PpAtomPaste;
|
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
||||||
return ReadToken(pTok, ppToken);
|
parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
|
||||||
} else
|
//return PpAtomPaste;
|
||||||
lUnreadByte(pTok);
|
return ReadToken(pTok, ppToken);
|
||||||
|
} else
|
||||||
|
lUnreadByte(pTok);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PpAtomConstString:
|
case PpAtomConstString:
|
||||||
case PpAtomIdentifier:
|
case PpAtomIdentifier:
|
||||||
|
|||||||
@ -78,6 +78,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
"cppSimple.vert",
|
"cppSimple.vert",
|
||||||
"cppIndent.vert",
|
"cppIndent.vert",
|
||||||
"cppNest.vert",
|
"cppNest.vert",
|
||||||
|
"cppBad.vert",
|
||||||
"cppComplexExpr.vert",
|
"cppComplexExpr.vert",
|
||||||
"badChars.frag",
|
"badChars.frag",
|
||||||
"pointCoord.frag",
|
"pointCoord.frag",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user