mirror of
https://github.com/KhronosGroup/glslang
synced 2024-11-08 11:30:06 +00:00
Fix issue #391: input stack underflow on too few macro arguments.
This commit is contained in:
parent
f8332509b9
commit
31a51becd2
4
Test/badMacroArgs.frag
Executable file
4
Test/badMacroArgs.frag
Executable file
@ -0,0 +1,4 @@
|
||||
#version 400
|
||||
|
||||
#define m(a) a
|
||||
m()
|
7
Test/baseResults/badMacroArgs.frag.out
Normal file
7
Test/baseResults/badMacroArgs.frag.out
Normal file
@ -0,0 +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: 2 compilation errors. No code generated.
|
||||
|
||||
|
@ -58,4 +58,4 @@ sum += 900000000.0;
|
||||
|
||||
#define FUNC(a,b) a+b
|
||||
// needs to be last test in file due to syntax error
|
||||
void foo986(){ FUNC( (((2)))), 4); } // ERROR, too many )
|
||||
void foo986(){ FUNC( (((2)))), 4); } // ERROR, too few arguments )
|
||||
|
@ -18,6 +18,13 @@ fi
|
||||
|
||||
rm -f comp.spv frag.spv geom.spv tesc.spv tese.spv vert.spv
|
||||
|
||||
#
|
||||
# special tests
|
||||
#
|
||||
|
||||
$EXE badMacroArgs.frag > $TARGETDIR/badMacroArgs.frag.out
|
||||
diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASERROR=1
|
||||
|
||||
#
|
||||
# reflection tests
|
||||
#
|
||||
|
@ -218,7 +218,7 @@ protected:
|
||||
TParseContextBase& parseContext;
|
||||
|
||||
// Get the next token from *stack* of input sources, popping input sources
|
||||
// that are out of tokens, down until an input sources is found that has a token.
|
||||
// that are out of tokens, down until an input source is found that has a token.
|
||||
// Return EndOfInput when there are no more tokens to be found by doing this.
|
||||
int scanToken(TPpToken* ppToken)
|
||||
{
|
||||
@ -226,7 +226,7 @@ protected:
|
||||
|
||||
while (! inputStack.empty()) {
|
||||
token = inputStack.back()->scan(ppToken);
|
||||
if (token != EndOfInput)
|
||||
if (token != EndOfInput || inputStack.empty())
|
||||
break;
|
||||
popInput();
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
|
||||
if (ltoken > 127)
|
||||
ltoken += 128;
|
||||
switch (ltoken) {
|
||||
case '#':
|
||||
case '#':
|
||||
if (lReadByte(pTok) == '#') {
|
||||
parseContext.requireProfile(ppToken->loc, ~EEsProfile, "token pasting (##)");
|
||||
parseContext.profileRequires(ppToken->loc, ~EEsProfile, 130, 0, "token pasting (##)");
|
||||
|
Loading…
Reference in New Issue
Block a user