Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
4207c97b
Commit
4207c97b
authored
Nov 07, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1563: Corrupt token when an object macro miscalls a function macro
parent
4ee2f752
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
+27
-8
cppBad.vert.out
Test/baseResults/cppBad.vert.out
+2
-0
cppSimple.vert.out
Test/baseResults/cppSimple.vert.out
+1
-1
preprocessor.simple.vert.out
Test/baseResults/preprocessor.simple.vert.out
+7
-1
preprocessor.simple.vert
Test/preprocessor.simple.vert
+8
-2
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+9
-4
No files found.
Test/baseResults/cppBad.vert.out
View file @
4207c97b
...
@@ -10,6 +10,7 @@ ERROR: 5 compilation errors. No code generated.
...
@@ -10,6 +10,7 @@ ERROR: 5 compilation errors. No code generated.
Shader version: 100
Shader version: 100
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:? Linker Objects
0:? Linker Objects
0:? 'n' ( global highp int)
Linked vertex stage:
Linked vertex stage:
...
@@ -19,4 +20,5 @@ ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry
...
@@ -19,4 +20,5 @@ ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry
Shader version: 100
Shader version: 100
ERROR: node is still EOpNull!
ERROR: node is still EOpNull!
0:? Linker Objects
0:? Linker Objects
0:? 'n' ( global highp int)
Test/baseResults/cppSimple.vert.out
View file @
4207c97b
...
@@ -77,7 +77,7 @@ ERROR: 12:9000: 'preprocessor evaluation' : expected ')'
...
@@ -77,7 +77,7 @@ ERROR: 12:9000: 'preprocessor evaluation' : expected ')'
ERROR: 12:9002: '#if' : unexpected tokens following directive
ERROR: 12:9002: '#if' : unexpected tokens following directive
ERROR: 12:9014: 'FOOOM' : undeclared identifier
ERROR: 12:9014: 'FOOOM' : undeclared identifier
ERROR: 12:9014: '=' : cannot convert from ' temp float' to ' global int'
ERROR: 12:9014: '=' : cannot convert from ' temp float' to ' global int'
ERROR: 12:901
6
: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:901
5
: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:9016: 'preprocessor evaluation' : bad expression
ERROR: 12:9016: 'preprocessor evaluation' : bad expression
ERROR: 12:9500: 'preprocessor evaluation' : bad expression
ERROR: 12:9500: 'preprocessor evaluation' : bad expression
ERROR: 12:9500: '#if' : unexpected tokens following directive
ERROR: 12:9500: '#if' : unexpected tokens following directive
...
...
Test/baseResults/preprocessor.simple.vert.out
View file @
4207c97b
...
@@ -55,6 +55,12 @@ void foo()
...
@@ -55,6 +55,12 @@ void foo()
s . member2 . yyz;
s . member2 . yyz;
s . member2 . xxyz();
s . member2 . xxyz();
s . member2 . yzy;
s . member2 . yzy;
vec3 a = vec3(0);vec3 b = a . zxyz;vec3 b = a . xxyz;vec3 b = a . yyz;vec3 b = a . xxyz();vec3 b = a .;vec3 b = a . z;
vec3 a = vec3(0);vec3 b = a . zxyz;vec3 b = a . xxyz;vec3 b = a . yyz;vec3 b = a . xxyz();vec3 b = a . yzy;vec3 b = a . z;
yyz;
yzy
}
}
Test/preprocessor.simple.vert
View file @
4207c97b
...
@@ -37,7 +37,7 @@ struct S {
...
@@ -37,7 +37,7 @@ struct S {
#define xyz xxyz
#define xyz xxyz
#define yzy() yyz
#define yzy() yyz
#define
LIGHTING_COMMON_BRDF
() \
#define
FUN_MAC
() \
vec3
a
=
vec3
(
0
);
\
vec3
a
=
vec3
(
0
);
\
vec3
b
=
a
.
zxyz
;
\
vec3
b
=
a
.
zxyz
;
\
vec3
b
=
a
.
xyz
;
\
vec3
b
=
a
.
xyz
;
\
...
@@ -55,5 +55,11 @@ void foo()
...
@@ -55,5 +55,11 @@ void foo()
s
.
member2
.
yzy
();
s
.
member2
.
yzy
();
s
.
member2
.
xyz
();
s
.
member2
.
xyz
();
s
.
member2
.
yzy
;
s
.
member2
.
yzy
;
LIGHTING_COMMON_BRDF
()
FUN_MAC
()
yzy
();
yzy
}
}
glslang/MachineIndependent/preprocessor/Pp.cpp
100644 → 100755
View file @
4207c97b
...
@@ -1192,14 +1192,19 @@ MacroExpandResult TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, b
...
@@ -1192,14 +1192,19 @@ MacroExpandResult TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, b
TSourceLoc
loc
=
ppToken
->
loc
;
// in case we go to the next line before discovering the error
TSourceLoc
loc
=
ppToken
->
loc
;
// in case we go to the next line before discovering the error
in
->
mac
=
macro
;
in
->
mac
=
macro
;
if
(
macro
->
functionLike
)
{
if
(
macro
->
functionLike
)
{
int
token
=
scanToken
(
ppToken
);
// We don't know yet if this will be a successful call of a
// function-like macro; need to look for a '(', but without trashing
// the passed in ppToken, until we know we are no longer speculative.
TPpToken
parenToken
;
int
token
=
scanToken
(
&
parenToken
);
if
(
newLineOkay
)
{
if
(
newLineOkay
)
{
while
(
token
==
'\n'
)
while
(
token
==
'\n'
)
token
=
scanToken
(
pp
Token
);
token
=
scanToken
(
&
paren
Token
);
}
}
if
(
token
!=
'('
)
{
if
(
token
!=
'('
)
{
// function-like macro called with object-like syntax: okay, don't expand
// Function-like macro called with object-like syntax: okay, don't expand.
UngetToken
(
token
,
ppToken
);
// (We ate exactly one token that might not be white space; put it back.
UngetToken
(
token
,
&
parenToken
);
delete
in
;
delete
in
;
return
MacroExpandNotStarted
;
return
MacroExpandNotStarted
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment