PP: Fix #1694: Handle badly formed argument substitution.
Also added a warning for no space after a macro name.
This commit is contained in:
parent
d83344fc4e
commit
9840f11f85
@ -1,9 +1,10 @@
|
|||||||
cppBad.vert
|
cppBad.vert
|
||||||
ERROR: 0:2: 'preprocessor evaluation' : bad expression
|
WARNING: 0:1: '#define' : missing space after macro name
|
||||||
ERROR: 0:2: '#if' : unexpected tokens following directive
|
ERROR: 0:3: 'preprocessor evaluation' : bad expression
|
||||||
ERROR: 0:5: 'string' : End of line in string
|
ERROR: 0:3: '#if' : unexpected tokens following directive
|
||||||
ERROR: 0:5: '""' : string literals not supported
|
ERROR: 0:6: 'string' : End of line in string
|
||||||
ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
|
ERROR: 0:6: '""' : string literals not supported
|
||||||
|
ERROR: 0:6: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
|
||||||
ERROR: 5 compilation errors. No code generated.
|
ERROR: 5 compilation errors. No code generated.
|
||||||
|
|
||||||
|
|
||||||
|
18
Test/baseResults/cppBad3.vert.out
Executable file
18
Test/baseResults/cppBad3.vert.out
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
cppBad3.vert
|
||||||
|
ERROR: 0:3: 'macro expansion' : End of input in macro y
|
||||||
|
ERROR: 1 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 entry point
|
||||||
|
|
||||||
|
Shader version: 100
|
||||||
|
ERROR: node is still EOpNull!
|
||||||
|
0:? Linker Objects
|
||||||
|
|
@ -1,3 +1,4 @@
|
|||||||
|
#define n#0#
|
||||||
#define m #0#
|
#define m #0#
|
||||||
#if m
|
#if m
|
||||||
#endif
|
#endif
|
||||||
|
3
Test/cppBad3.vert
Normal file
3
Test/cppBad3.vert
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#define f =y(.
|
||||||
|
#define y(m)
|
||||||
|
y(f)
|
@ -147,6 +147,10 @@ int TPpContext::CPPdefine(TPpToken* ppToken)
|
|||||||
}
|
}
|
||||||
|
|
||||||
token = scanToken(ppToken);
|
token = scanToken(ppToken);
|
||||||
|
} else if (token != '\n' && token != EndOfInput && !ppToken->space) {
|
||||||
|
parseContext.ppWarn(ppToken->loc, "missing space after macro name", "#define", "");
|
||||||
|
|
||||||
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
// record the definition of the macro
|
// record the definition of the macro
|
||||||
|
@ -1056,7 +1056,7 @@ int TPpContext::tokenize(TPpToken& ppToken)
|
|||||||
// Handle token-pasting logic
|
// Handle token-pasting logic
|
||||||
token = tokenPaste(token, ppToken);
|
token = tokenPaste(token, ppToken);
|
||||||
|
|
||||||
if (token == EndOfInput) {
|
if (token == EndOfInput || token == tMarkerInput::marker) {
|
||||||
missingEndifCheck();
|
missingEndifCheck();
|
||||||
return EndOfInput;
|
return EndOfInput;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
"cppNest.vert",
|
"cppNest.vert",
|
||||||
"cppBad.vert",
|
"cppBad.vert",
|
||||||
"cppBad2.vert",
|
"cppBad2.vert",
|
||||||
|
"cppBad3.vert",
|
||||||
"cppComplexExpr.vert",
|
"cppComplexExpr.vert",
|
||||||
"cppDeepNest.frag",
|
"cppDeepNest.frag",
|
||||||
"cppPassMacroName.frag",
|
"cppPassMacroName.frag",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user