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:
@@ -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 "SPIRV99.1367"
|
||||
#define GLSLANG_REVISION "SPIRV99.1370"
|
||||
#define GLSLANG_DATE "30-Jul-2016"
|
||||
|
||||
@@ -180,14 +180,17 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
||||
ltoken += 128;
|
||||
switch (ltoken) {
|
||||
case '#':
|
||||
if (lReadByte(pTok) == '#') {
|
||||
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
||||
parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
|
||||
//return PpAtomPaste;
|
||||
return ReadToken(pTok, ppToken);
|
||||
} else
|
||||
lUnreadByte(pTok);
|
||||
// Check for ##, unless the current # is the last character
|
||||
if (pTok->current < pTok->data.size()) {
|
||||
if (lReadByte(pTok) == '#') {
|
||||
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
||||
parseContext.error(ppToken->loc, "token pasting not implemented (internal error)", "##", "");
|
||||
//return PpAtomPaste;
|
||||
return ReadToken(pTok, ppToken);
|
||||
} else
|
||||
lUnreadByte(pTok);
|
||||
}
|
||||
break;
|
||||
case PpAtomConstString:
|
||||
case PpAtomIdentifier:
|
||||
|
||||
Reference in New Issue
Block a user