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
88e22a60
Commit
88e22a60
authored
Nov 02, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1079: don't give error when macro() name used without open (.
parent
e8d21388
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
8 deletions
+83
-8
cppBad.vert.out
Test/baseResults/cppBad.vert.out
+1
-2
cppPassMacroName.frag.out
Test/baseResults/cppPassMacroName.frag.out
+67
-0
cppSimple.vert.out
Test/baseResults/cppSimple.vert.out
+1
-3
cppPassMacroName.frag
Test/cppPassMacroName.frag
+12
-0
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+1
-3
AST.FromFile.cpp
gtests/AST.FromFile.cpp
+1
-0
No files found.
Test/baseResults/cppBad.vert.out
View file @
88e22a60
...
@@ -2,10 +2,9 @@ cppBad.vert
...
@@ -2,10 +2,9 @@ cppBad.vert
ERROR: 0:2: 'preprocessor evaluation' : bad expression
ERROR: 0:2: 'preprocessor evaluation' : bad expression
ERROR: 0:2: '#if' : unexpected tokens following directive
ERROR: 0:2: '#if' : unexpected tokens following directive
ERROR: 0:5: 'string' : End of line in string
ERROR: 0:5: 'string' : End of line in string
ERROR: 0:5: 'macro expansion' : expected '(' following n
ERROR: 0:5: '""' : string literals not supported
ERROR: 0:5: '""' : string literals not supported
ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON
ERROR:
6
compilation errors. No code generated.
ERROR:
5
compilation errors. No code generated.
Shader version: 100
Shader version: 100
...
...
Test/baseResults/cppPassMacroName.frag.out
0 → 100755
View file @
88e22a60
cppPassMacroName.frag
Shader version: 100
0:? Sequence
0:5 Function Definition: main( ( global void)
0:5 Function Parameters:
0:7 Sequence
0:7 Sequence
0:7 move second child to first child ( temp mediump int)
0:7 'f1' ( temp mediump int)
0:7 Constant:
0:7 4 (const int)
0:8 Sequence
0:8 move second child to first child ( temp mediump int)
0:8 'f2' ( temp mediump int)
0:8 'f1' ( temp mediump int)
0:9 Sequence
0:9 move second child to first child ( temp mediump int)
0:9 'f3' ( temp mediump int)
0:9 Constant:
0:9 9 (const int)
0:10 Sequence
0:10 move second child to first child ( temp mediump int)
0:10 'f4' ( temp mediump int)
0:10 Constant:
0:10 1 (const int)
0:11 Sequence
0:11 move second child to first child ( temp mediump int)
0:11 'f5' ( temp mediump int)
0:11 Constant:
0:11 5 (const int)
0:? Linker Objects
Linked fragment stage:
Shader version: 100
0:? Sequence
0:5 Function Definition: main( ( global void)
0:5 Function Parameters:
0:7 Sequence
0:7 Sequence
0:7 move second child to first child ( temp mediump int)
0:7 'f1' ( temp mediump int)
0:7 Constant:
0:7 4 (const int)
0:8 Sequence
0:8 move second child to first child ( temp mediump int)
0:8 'f2' ( temp mediump int)
0:8 'f1' ( temp mediump int)
0:9 Sequence
0:9 move second child to first child ( temp mediump int)
0:9 'f3' ( temp mediump int)
0:9 Constant:
0:9 9 (const int)
0:10 Sequence
0:10 move second child to first child ( temp mediump int)
0:10 'f4' ( temp mediump int)
0:10 Constant:
0:10 1 (const int)
0:11 Sequence
0:11 move second child to first child ( temp mediump int)
0:11 'f5' ( temp mediump int)
0:11 Constant:
0:11 5 (const int)
0:? Linker Objects
Test/baseResults/cppSimple.vert.out
View file @
88e22a60
...
@@ -75,10 +75,8 @@ ERROR: 12:20051: '#error' : good evaluation 1
...
@@ -75,10 +75,8 @@ ERROR: 12:20051: '#error' : good evaluation 1
ERROR: 12:20055: '#error' : good evaluation 2
ERROR: 12:20055: '#error' : good evaluation 2
ERROR: 12:9000: 'preprocessor evaluation' : expected ')'
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: 'macro expansion' : expected '(' following FOOOM
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:9015: 'macro expansion' : expected '(' following FOOOM
ERROR: 12:9016: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:9016: '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
...
@@ -93,7 +91,7 @@ ERROR: 12:9508: '#error' : \ 377
...
@@ -93,7 +91,7 @@ ERROR: 12:9508: '#error' : \ 377
ERROR: 12:9602: 'defined' : cannot use in preprocessor expression when expanded from macros
ERROR: 12:9602: 'defined' : cannot use in preprocessor expression when expanded from macros
ERROR: 12:9603: '#error' : DEF_DEFINED then
ERROR: 12:9603: '#error' : DEF_DEFINED then
ERROR: 12:10002: '' : missing #endif
ERROR: 12:10002: '' : missing #endif
ERROR:
90
compilation errors. No code generated.
ERROR:
88
compilation errors. No code generated.
Shader version: 400
Shader version: 400
...
...
Test/cppPassMacroName.frag
0 → 100644
View file @
88e22a60
#define f1(i) ((i)*(i))
#define I2(f, n) f(n) + f(n+1)
#define I3(f, n) I2(f, n) + f(n+2)
void
main
()
{
int
f1
=
4
;
int
f2
=
f1
;
int
f3
=
f1
(
3
);
int
f4
=
I2
(
f1
,
0
);
int
f5
=
I3
(
f1
,
0
);
}
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
88e22a60
...
@@ -1157,7 +1157,6 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
...
@@ -1157,7 +1157,6 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
}
}
MacroSymbol
*
macro
=
macroAtom
==
0
?
nullptr
:
lookupMacroDef
(
macroAtom
);
MacroSymbol
*
macro
=
macroAtom
==
0
?
nullptr
:
lookupMacroDef
(
macroAtom
);
int
token
;
int
depth
=
0
;
int
depth
=
0
;
// no recursive expansions
// no recursive expansions
...
@@ -1179,13 +1178,12 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
...
@@ -1179,13 +1178,12 @@ int TPpContext::MacroExpand(TPpToken* ppToken, bool expandUndef, bool newLineOka
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
->
args
.
size
()
>
0
||
macro
->
emptyArgs
)
{
if
(
macro
->
args
.
size
()
>
0
||
macro
->
emptyArgs
)
{
token
=
scanToken
(
ppToken
);
int
token
=
scanToken
(
ppToken
);
if
(
newLineOkay
)
{
if
(
newLineOkay
)
{
while
(
token
==
'\n'
)
while
(
token
==
'\n'
)
token
=
scanToken
(
ppToken
);
token
=
scanToken
(
ppToken
);
}
}
if
(
token
!=
'('
)
{
if
(
token
!=
'('
)
{
parseContext
.
ppError
(
loc
,
"expected '(' following"
,
"macro expansion"
,
atomStrings
.
getString
(
macroAtom
));
UngetToken
(
token
,
ppToken
);
UngetToken
(
token
,
ppToken
);
delete
in
;
delete
in
;
return
0
;
return
0
;
...
...
gtests/AST.FromFile.cpp
View file @
88e22a60
...
@@ -84,6 +84,7 @@ INSTANTIATE_TEST_CASE_P(
...
@@ -84,6 +84,7 @@ INSTANTIATE_TEST_CASE_P(
"cppBad2.vert"
,
"cppBad2.vert"
,
"cppComplexExpr.vert"
,
"cppComplexExpr.vert"
,
"cppDeepNest.frag"
,
"cppDeepNest.frag"
,
"cppPassMacroName.frag"
,
"badChars.frag"
,
"badChars.frag"
,
"pointCoord.frag"
,
"pointCoord.frag"
,
"array.frag"
,
"array.frag"
,
...
...
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