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
780a2f44
Commit
780a2f44
authored
Jul 28, 2015
by
Lei Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use requireExtensions() to check extension and turn on more tests.
Use requireExtensions() to check GL_GOOGLE_cpp_style_line_directive is turned on. Add register more tests for running.
parent
5011fbeb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
preprocessor.cpp_style___FILE__.vert.out
Test/baseResults/preprocessor.cpp_style___FILE__.vert.out
+15
-4
test-preprocessor-list
Test/test-preprocessor-list
+1
-0
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+6
-5
No files found.
Test/baseResults/preprocessor.cpp_style___FILE__.vert.out
View file @
780a2f44
#extension GL_GOOGLE_cpp_style_line_directive : enable
#extension GL_GOOGLE_cpp_style_line_directive : enable
0
0
#line 150 a.h
#line 150 "a.h"
"a.h"
"a.h"
#line 24
#line 24
"a.h"
"a.h"
#line 42
#line 42
"a.h"
"a.h"
#line 30 b.cc
#line 30 "b.cc"
"b.cc"
"b.cc"
#line 10 3
#line 10 3
3
3
#line 48
#line 48
3
3
#line 4
#line 4
3
3
#line 55 100
#line 55 100
100
100
#line 1000 c
#line 1000 "c"
"c"
"c"
#line 42 1
#line 42 1
1
1
#line 42 this-is-a-quite-long-name-maybe-i-should-shorten-it
#line 42 "this-is-a-quite-long-name-maybe-i-should-shorten-it"
"this-is-a-quite-long-name-maybe-i-should-shorten-it"
"this-is-a-quite-long-name-maybe-i-should-shorten-it"
Test/test-preprocessor-list
View file @
780a2f44
preprocessor.cpp_style_line_directive.vert
preprocessor.cpp_style_line_directive.vert
preprocessor.cpp_style___FILE__.vert
preprocessor.edge_cases.vert
preprocessor.edge_cases.vert
preprocessor.errors.vert
preprocessor.errors.vert
preprocessor.extensions.vert
preprocessor.extensions.vert
...
...
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
780a2f44
...
@@ -604,7 +604,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
...
@@ -604,7 +604,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
// "#line line source-string-number"
// "#line line source-string-number"
int
token
=
scanToken
(
ppToken
);
int
token
=
scanToken
(
ppToken
);
const
int
directiveLoc
=
ppToken
->
loc
.
line
;
const
TSourceLoc
directiveLoc
=
ppToken
->
loc
;
if
(
token
==
'\n'
)
{
if
(
token
==
'\n'
)
{
parseContext
.
ppError
(
ppToken
->
loc
,
"must by followed by an integral literal"
,
"#line"
,
""
);
parseContext
.
ppError
(
ppToken
->
loc
,
"must by followed by an integral literal"
,
"#line"
,
""
);
return
token
;
return
token
;
...
@@ -628,7 +628,8 @@ int TPpContext::CPPline(TPpToken* ppToken)
...
@@ -628,7 +628,8 @@ int TPpContext::CPPline(TPpToken* ppToken)
parseContext
.
setCurrentLine
(
lineRes
);
parseContext
.
setCurrentLine
(
lineRes
);
if
(
token
!=
'\n'
)
{
if
(
token
!=
'\n'
)
{
if
(
parseContext
.
extensionTurnedOn
(
E_GL_GOOGLE_cpp_style_line_directive
)
&&
token
==
PpAtomConstString
)
{
if
(
token
==
PpAtomConstString
)
{
parseContext
.
requireExtensions
(
directiveLoc
,
1
,
&
E_GL_GOOGLE_cpp_style_line_directive
,
"filename-based #line"
);
// We need to save a copy of the string instead of pointing
// We need to save a copy of the string instead of pointing
// to the name field of the token since the name field
// to the name field of the token since the name field
// will likely be overwritten by the next token scan.
// will likely be overwritten by the next token scan.
...
@@ -646,7 +647,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
...
@@ -646,7 +647,7 @@ int TPpContext::CPPline(TPpToken* ppToken)
}
}
}
}
if
(
!
fileErr
&&
!
lineErr
)
{
if
(
!
fileErr
&&
!
lineErr
)
{
parseContext
.
notifyLineDirective
(
directiveLoc
,
lineToken
,
hasFile
,
fileRes
,
sourceName
);
parseContext
.
notifyLineDirective
(
directiveLoc
.
line
,
lineToken
,
hasFile
,
fileRes
,
sourceName
);
}
}
token
=
extraTokenCheck
(
PpAtomLine
,
ppToken
,
token
);
token
=
extraTokenCheck
(
PpAtomLine
,
ppToken
,
token
);
...
@@ -965,8 +966,8 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool
...
@@ -965,8 +966,8 @@ int TPpContext::MacroExpand(int atom, TPpToken* ppToken, bool expandUndef, bool
return
1
;
return
1
;
case
PpAtomFileMacro
:
{
case
PpAtomFileMacro
:
{
const
char
*
current_file
=
parseContext
.
getCurrentLoc
().
name
;
if
(
const
char
*
current_file
=
parseContext
.
getCurrentLoc
().
name
)
{
if
(
parseContext
.
extensionTurnedOn
(
E_GL_GOOGLE_cpp_style_line_directive
)
&&
current_file
!=
nullptr
)
{
parseContext
.
requireExtensions
(
ppToken
->
loc
,
1
,
&
E_GL_GOOGLE_cpp_style_line_directive
,
"filename-based __FILE__"
);
sprintf
(
ppToken
->
name
,
"
\"
%s
\"
"
,
current_file
);
sprintf
(
ppToken
->
name
,
"
\"
%s
\"
"
,
current_file
);
}
else
{
}
else
{
ppToken
->
ival
=
parseContext
.
getCurrentLoc
().
string
;
ppToken
->
ival
=
parseContext
.
getCurrentLoc
().
string
;
...
...
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