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
d8834df9
Commit
d8834df9
authored
Aug 10, 2019
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web: Optional error management and error tightening.
Saves about 6.5K
parent
fb4f2333
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
10 deletions
+47
-10
ParseContextBase.cpp
glslang/MachineIndependent/ParseContextBase.cpp
+4
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+4
-0
ParseHelper.h
glslang/MachineIndependent/ParseHelper.h
+2
-0
Versions.cpp
glslang/MachineIndependent/Versions.cpp
+3
-4
glslang.m4
glslang/MachineIndependent/glslang.m4
+8
-3
glslang.y
glslang/MachineIndependent/glslang.y
+8
-3
glslang_tab.cpp
glslang/MachineIndependent/glslang_tab.cpp
+0
-0
linkValidate.cpp
glslang/MachineIndependent/linkValidate.cpp
+4
-0
parseVersions.h
glslang/MachineIndependent/parseVersions.h
+12
-0
PpTokens.cpp
glslang/MachineIndependent/preprocessor/PpTokens.cpp
+2
-0
No files found.
glslang/MachineIndependent/ParseContextBase.cpp
View file @
d8834df9
...
...
@@ -67,6 +67,8 @@ void TParseContextBase::outputMessage(const TSourceLoc& loc, const char* szReaso
}
}
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
void
C_DECL
TParseContextBase
::
error
(
const
TSourceLoc
&
loc
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
{
...
...
@@ -113,6 +115,8 @@ void C_DECL TParseContextBase::ppWarn(const TSourceLoc& loc, const char* szReaso
va_end
(
args
);
}
#endif
//
// Both test and if necessary, spit out an error, to see if the node is really
// an l-value that can be operated on this way.
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
d8834df9
...
...
@@ -5813,6 +5813,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
// output block declarations, and output block member declarations."
switch
(
qualifier
.
storage
)
{
#ifndef GLSLANG_WEB
case
EvqVaryingIn
:
{
const
char
*
feature
=
"location qualifier on input"
;
...
...
@@ -5847,6 +5848,7 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
}
break
;
}
#endif
case
EvqUniform
:
case
EvqBuffer
:
{
...
...
@@ -7243,6 +7245,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if
(
memberQualifier
.
hasLocation
())
{
const
char
*
feature
=
"location on block member"
;
switch
(
currentBlockQualifier
.
storage
)
{
#ifndef GLSLANG_WEB
case
EvqVaryingIn
:
case
EvqVaryingOut
:
requireProfile
(
memberLoc
,
ECoreProfile
|
ECompatibilityProfile
|
EEsProfile
,
feature
);
...
...
@@ -7250,6 +7253,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
profileRequires
(
memberLoc
,
EEsProfile
,
320
,
Num_AEP_shader_io_blocks
,
AEP_shader_io_blocks
,
feature
);
memberWithLocation
=
true
;
break
;
#endif
default
:
error
(
memberLoc
,
"can only use in an in/out block"
,
feature
,
""
);
break
;
...
...
glslang/MachineIndependent/ParseHelper.h
View file @
d8834df9
...
...
@@ -97,6 +97,7 @@ public:
}
virtual
~
TParseContextBase
()
{
}
#if !defined(GLSLANG_WEB) || defined(GLSLANG_WEB_DEVEL)
virtual
void
C_DECL
error
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...);
virtual
void
C_DECL
warn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
...
...
@@ -105,6 +106,7 @@ public:
const
char
*
szExtraInfoFormat
,
...);
virtual
void
C_DECL
ppWarn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...);
#endif
virtual
void
setLimits
(
const
TBuiltInResource
&
)
=
0
;
...
...
glslang/MachineIndependent/Versions.cpp
View file @
d8834df9
...
...
@@ -563,9 +563,8 @@ const char* StageName(EShLanguage stage)
void
TParseVersions
::
profileRequires
(
const
TSourceLoc
&
loc
,
int
profileMask
,
int
minVersion
,
int
numExtensions
,
const
char
*
const
extensions
[],
const
char
*
featureDesc
)
{
if
(
profile
&
profileMask
)
{
bool
okay
=
false
;
if
(
minVersion
>
0
&&
version
>=
minVersion
)
okay
=
true
;
bool
okay
=
minVersion
>
0
&&
version
>=
minVersion
;
#ifndef GLSLANG_WEB
for
(
int
i
=
0
;
i
<
numExtensions
;
++
i
)
{
switch
(
getExtensionBehavior
(
extensions
[
i
]))
{
case
EBhWarn
:
...
...
@@ -578,7 +577,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
default
:
break
;
// some compilers want this
}
}
#endif
if
(
!
okay
)
error
(
loc
,
"not supported for this version or the enabled extensions"
,
featureDesc
,
""
);
}
...
...
glslang/MachineIndependent/glslang.m4
View file @
d8834df9
...
...
@@ -300,7 +300,7 @@ GLSLANG_WEB_EXCLUDE_OFF
%type <interm.intermTypedNode> conditional_expression constant_expression
%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
%type <interm.intermTypedNode> function_call initializer
initializer_list
condition conditionopt
%type <interm.intermTypedNode> function_call initializer condition conditionopt
%type <interm.intermNode> translation_unit function_definition
%type <interm.intermNode> statement simple_statement
...
...
@@ -342,6 +342,7 @@ GLSLANG_WEB_EXCLUDE_ON
%type <interm.typeList> type_name_list
%type <interm.attributes> attribute attribute_list single_attribute
%type <interm.intermNode> demote_statement
%type <interm.intermTypedNode> initializer_list
GLSLANG_WEB_EXCLUDE_OFF
%start translation_unit
...
...
@@ -857,7 +858,6 @@ declaration
}
| PRECISION precision_qualifier type_specifier SEMICOLON {
parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
// lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
...
...
@@ -1137,7 +1137,6 @@ fully_specified_type
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
}
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
}
| type_qualifier type_specifier {
...
...
@@ -3339,6 +3338,7 @@ initializer
: assignment_expression {
$$ = $1;
}
GLSLANG_WEB_EXCLUDE_ON
| LEFT_BRACE initializer_list RIGHT_BRACE {
const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
...
...
@@ -3351,8 +3351,10 @@ initializer
parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
$$ = $2;
}
GLSLANG_WEB_EXCLUDE_OFF
;
GLSLANG_WEB_EXCLUDE_ON
initializer_list
: initializer {
$$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
...
...
@@ -3361,6 +3363,7 @@ initializer_list
$$ = parseContext.intermediate.growAggregate($1, $3);
}
;
GLSLANG_WEB_EXCLUDE_OFF
declaration_statement
: declaration { $$ = $1; }
...
...
@@ -3726,11 +3729,13 @@ external_declaration
| declaration {
$$ = $1;
}
GLSLANG_WEB_EXCLUDE_ON
| SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr;
}
GLSLANG_WEB_EXCLUDE_OFF
;
function_definition
...
...
glslang/MachineIndependent/glslang.y
View file @
d8834df9
...
...
@@ -300,7 +300,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm.intermTypedNode> conditional_expression constant_expression
%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
%type <interm.intermTypedNode> function_call initializer
initializer_list
condition conditionopt
%type <interm.intermTypedNode> function_call initializer condition conditionopt
%type <interm.intermNode> translation_unit function_definition
%type <interm.intermNode> statement simple_statement
...
...
@@ -342,6 +342,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%type <interm.typeList> type_name_list
%type <interm.attributes> attribute attribute_list single_attribute
%type <interm.intermNode> demote_statement
%type <interm.intermTypedNode> initializer_list
%start translation_unit
...
...
@@ -857,7 +858,6 @@ declaration
}
| PRECISION precision_qualifier type_specifier SEMICOLON {
parseContext.profileRequires($1.loc, ENoProfile, 130, 0, "precision statement");
// lazy setting of the previous scope's defaults, has effect only the first time it is called in a particular scope
parseContext.symbolTable.setPreviousDefaultPrecisions(&parseContext.defaultPrecision[0]);
parseContext.setDefaultPrecision($1.loc, $3, $2.qualifier.precision);
...
...
@@ -1137,7 +1137,6 @@ fully_specified_type
parseContext.profileRequires($1.loc, ENoProfile, 120, E_GL_3DL_array_objects, "arrayed type");
parseContext.profileRequires($1.loc, EEsProfile, 300, 0, "arrayed type");
}
parseContext.precisionQualifierCheck($$.loc, $$.basicType, $$.qualifier);
}
| type_qualifier type_specifier {
...
...
@@ -3339,6 +3338,7 @@ initializer
: assignment_expression {
$$ = $1;
}
| LEFT_BRACE initializer_list RIGHT_BRACE {
const char* initFeature = "{ } style initializers";
parseContext.requireProfile($1.loc, ~EEsProfile, initFeature);
...
...
@@ -3351,8 +3351,10 @@ initializer
parseContext.profileRequires($1.loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, initFeature);
$$ = $2;
}
;
initializer_list
: initializer {
$$ = parseContext.intermediate.growAggregate(0, $1, $1->getLoc());
...
...
@@ -3362,6 +3364,7 @@ initializer_list
}
;
declaration_statement
: declaration { $$ = $1; }
;
...
...
@@ -3726,11 +3729,13 @@ external_declaration
| declaration {
$$ = $1;
}
| SEMICOLON {
parseContext.requireProfile($1.loc, ~EEsProfile, "extraneous semicolon");
parseContext.profileRequires($1.loc, ~EEsProfile, 460, nullptr, "extraneous semicolon");
$$ = nullptr;
}
;
function_definition
...
...
glslang/MachineIndependent/glslang_tab.cpp
View file @
d8834df9
This source diff could not be displayed because it is too large. You can
view the blob
instead.
glslang/MachineIndependent/linkValidate.cpp
View file @
d8834df9
...
...
@@ -56,8 +56,10 @@ namespace glslang {
//
void
TIntermediate
::
error
(
TInfoSink
&
infoSink
,
const
char
*
message
)
{
#ifndef GLSLANG_WEB
infoSink
.
info
.
prefix
(
EPrefixError
);
infoSink
.
info
<<
"Linking "
<<
StageName
(
language
)
<<
" stage: "
<<
message
<<
"
\n
"
;
#endif
++
numErrors
;
}
...
...
@@ -65,8 +67,10 @@ void TIntermediate::error(TInfoSink& infoSink, const char* message)
// Link-time warning.
void
TIntermediate
::
warn
(
TInfoSink
&
infoSink
,
const
char
*
message
)
{
#ifndef GLSLANG_WEB
infoSink
.
info
.
prefix
(
EPrefixWarning
);
infoSink
.
info
<<
"Linking "
<<
StageName
(
language
)
<<
" stage: "
<<
message
<<
"
\n
"
;
#endif
}
// TODO: 4.4 offset/align: "Two blocks linked together in the same program with the same block
...
...
glslang/MachineIndependent/parseVersions.h
View file @
d8834df9
...
...
@@ -137,6 +137,17 @@ public:
virtual
void
requireVulkan
(
const
TSourceLoc
&
,
const
char
*
op
);
virtual
void
requireSpv
(
const
TSourceLoc
&
,
const
char
*
op
);
#if defined(GLSLANG_WEB) && !defined(GLSLANG_WEB_DEVEL)
void
C_DECL
error
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
{
addError
();
}
void
C_DECL
warn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
{
}
void
C_DECL
ppError
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
{
addError
();
}
void
C_DECL
ppWarn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
{
}
#else
virtual
void
C_DECL
error
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
=
0
;
virtual
void
C_DECL
warn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
...
...
@@ -145,6 +156,7 @@ public:
const
char
*
szExtraInfoFormat
,
...)
=
0
;
virtual
void
C_DECL
ppWarn
(
const
TSourceLoc
&
,
const
char
*
szReason
,
const
char
*
szToken
,
const
char
*
szExtraInfoFormat
,
...)
=
0
;
#endif
void
addError
()
{
++
numErrors
;
}
int
getNumErrors
()
const
{
return
numErrors
;
}
...
...
glslang/MachineIndependent/preprocessor/PpTokens.cpp
View file @
d8834df9
...
...
@@ -116,6 +116,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
int
atom
=
stream
[
currentPos
++
].
get
(
*
ppToken
);
ppToken
->
loc
=
parseContext
.
getCurrentLoc
();
#ifndef GLSLANG_WEB
// Check for ##, unless the current # is the last character
if
(
atom
==
'#'
)
{
if
(
peekToken
(
'#'
))
{
...
...
@@ -125,6 +126,7 @@ int TPpContext::TokenStream::getToken(TParseContextBase& parseContext, TPpToken
atom
=
PpAtomPaste
;
}
}
#endif
return
atom
;
}
...
...
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