Update rules for "GL_", "gl_", and "__" to match latest specification bug fixes.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25392 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-02-18 21:55:42 +00:00
parent 3bef952d48
commit 52c351442c
7 changed files with 92 additions and 30 deletions

Binary file not shown.

View File

@ -1,8 +1,8 @@
330.frag
Warning, version 330 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:27: 'block declaration' : cannot redeclare block: gl_block
ERROR: 0:31: 'gl_' : reserved built-in name: gl_name
ERROR: 0:32: 'gl_' : reserved built-in name: gl_i
ERROR: 0:31: 'gl_name' : identifiers starting with "gl_" are reserved
ERROR: 0:32: 'gl_i' : identifiers starting with "gl_" are reserved
ERROR: 0:35: 'gl_in' : no declaration found for redeclaration
ERROR: 0:39: 'gl_FragCoord' : cannot redeclare a non block as a block
ERROR: 0:44: 'non-literal layout-id value' : not supported for this version or the enabled extensions

View File

@ -25,11 +25,11 @@ ERROR: 0:136: 'length' : no matching overloaded function found
ERROR: 0:136: '=' : cannot convert from 'const float' to 'int'
ERROR: 0:138: ''' : character literals not supported
ERROR: 0:138: ''' : character literals not supported
ERROR: 0:141: '#define' : can't use with built-in names ("GL_" prefix)
ERROR: 0:142: '#define' : can't use with built-in names ("GL_" prefix)
ERROR: 0:143: '#define' : can't use with built-in names (containing consecutive underscores)
ERROR: 0:144: '#define' : can't use with built-in names (containing consecutive underscores)
ERROR: 0:145: '#define' : can't use with built-in names (containing consecutive underscores)
ERROR: 0:141: '#define' : names beginning with "GL_" can't be defined: GL_
ERROR: 0:142: '#define' : names beginning with "GL_" can't be defined: GL_Macro
WARNING: 0:143: '#define' : names containing consecutive underscores are reserved: __M
WARNING: 0:144: '#define' : names containing consecutive underscores are reserved: M__
WARNING: 0:145: '#define' : names containing consecutive underscores are reserved: ABC__DE
ERROR: 0:148: '#else' : unexpected tokens following directive
ERROR: 0:149: '#elif' : #elif after #else
ERROR: 0:155: '#else' : unexpected tokens following directive
@ -42,8 +42,8 @@ ERROR: 0:182: '#define' : Macro redefined; different number of arguments: m6
ERROR: 0:185: '#define' : Macro redefined; different substitutions: m7
ERROR: 0:192: '#define' : Macro redefined; different substitutions: m8
ERROR: 0:196: '#define' : Macro redefined; different argument names: m9
ERROR: 0:204: '#undef' : can't use with built-in names (containing consecutive underscores)
ERROR: 0:205: '#undef' : can't use with built-in names ("GL_" prefix)
WARNING: 0:204: '#undef' : names containing consecutive underscores are reserved: __VERSION__
ERROR: 0:205: '#undef' : names beginning with "GL_" can't be defined: GL_ARB_texture_rectangle
ERROR: 0:210: '#' : invalid directive
ERROR: 0:211: '#' : invalid directive
ERROR: 0:212: '#' : invalid directive
@ -83,7 +83,7 @@ ERROR: 12:9016: 'macro expansion' : expected '(' following FOOOM
ERROR: 12:9017: 'preprocessor evaluation' : can't evaluate expression
ERROR: 12:9017: 'preprocessor evaluation' : bad expression
ERROR: 12:10003: '' : missing #endif
ERROR: 83 compilation errors. No code generated.
ERROR: 79 compilation errors. No code generated.
ERROR: node is still EOpNull!

View File

@ -8,15 +8,22 @@ ERROR: 0:22: 'vn8' : illegal use of type 'void'
ERROR: 0:22: 'vp' : illegal use of type 'void'
ERROR: 0:25: 'cij' : variables with qualifier 'const' must be initialized
ERROR: 0:27: 'cip' : variables with qualifier 'const' must be initialized
ERROR: 0:34: 'gl_' : reserved built-in name: gl_vi4
ERROR: 0:35: 'gl_' : reserved built-in name: gl_vj
ERROR: 0:35: 'gl_' : reserved built-in name: gl_vk5
ERROR: 0:36: 'gl_' : reserved built-in name: gl_vm2
ERROR: 0:36: 'gl_' : reserved built-in name: gl_vm3
ERROR: 0:37: 'gl_' : reserved built-in name: gl_vn8
ERROR: 0:37: 'gl_' : reserved built-in name: gl_vp
ERROR: 0:34: 'gl_vi4' : identifiers starting with "gl_" are reserved
ERROR: 0:35: 'gl_vj' : identifiers starting with "gl_" are reserved
ERROR: 0:35: 'gl_vk5' : identifiers starting with "gl_" are reserved
ERROR: 0:36: 'gl_vm2' : identifiers starting with "gl_" are reserved
ERROR: 0:36: 'gl_vm3' : identifiers starting with "gl_" are reserved
ERROR: 0:37: 'gl_vn8' : identifiers starting with "gl_" are reserved
ERROR: 0:37: 'gl_vp' : identifiers starting with "gl_" are reserved
ERROR: 0:42: '' : boolean expression expected
ERROR: 0:43: 'gl_' : reserved built-in name: gl_cond
ERROR: 0:43: 'gl_cond' : identifiers starting with "gl_" are reserved
WARNING: 0:46: 'foob__vi4' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:47: 'foob__vj' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:47: 'foob__vk5' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:48: '__foobvm2' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:48: '__foobvm3' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:49: 'foob__vn8' : identifiers containing consecutive underscores ("__") are reserved
WARNING: 0:49: 'foob__vp' : identifiers containing consecutive underscores ("__") are reserved
ERROR: 18 compilation errors. No code generated.
@ -135,6 +142,43 @@ ERROR: node is still EOpNull!
0:43 'b' (int)
0:43 'c' (int)
0:43 No loop body
0:46 Sequence
0:46 move second child to first child (4-element array of int)
0:46 'foob__vi4' (4-element array of int)
0:46 Constant:
0:46 1 (const int)
0:46 2 (const int)
0:46 3 (const int)
0:46 4 (const int)
0:47 Sequence
0:47 move second child to first child (5-element array of int)
0:47 'foob__vk5' (5-element array of int)
0:47 Constant:
0:47 5 (const int)
0:47 6 (const int)
0:47 7 (const int)
0:47 8 (const int)
0:47 9 (const int)
0:48 Sequence
0:48 move second child to first child (2-element array of int)
0:48 '__foobvm2' (2-element array of int)
0:48 Constant:
0:48 10 (const int)
0:48 11 (const int)
0:48 move second child to first child (3-element array of int)
0:48 '__foobvm3' (3-element array of int)
0:48 Constant:
0:48 12 (const int)
0:48 13 (const int)
0:48 14 (const int)
0:49 Sequence
0:49 move second child to first child (4-element array of int)
0:49 'foob__vn8' (4-element array of int)
0:49 Constant:
0:49 21 (const int)
0:49 22 (const int)
0:49 23 (const int)
0:49 24 (const int)
0:? Linker Objects
0:? 'a' (int)
0:? 'b' (int)
@ -215,6 +259,13 @@ ERROR: node is still EOpNull!
0:? 'gl_vm3' (3-element array of int)
0:? 'gl_vn8' (4-element array of int)
0:? 'gl_vp' (int)
0:? 'foob__vi4' (4-element array of int)
0:? 'foob__vj' (int)
0:? 'foob__vk5' (5-element array of int)
0:? '__foobvm2' (2-element array of int)
0:? '__foobvm3' (3-element array of int)
0:? 'foob__vn8' (4-element array of int)
0:? 'foob__vp' (int)
Linked fragment stage:

View File

@ -42,3 +42,8 @@ void main()
while (int icond = b);
while (bool gl_cond = b < c);
}
int foob__vi4[4] = int[](1, 2, 3, 4);
int foob__vj, foob__vk5[5] = int[](5, 6, 7, 8, 9);
int __foobvm2[2] = int[](10, 11), __foobvm3[3] = int[](12, 13, 14);
int foob__vn8[4] = int[](21, 22, 23, 24), foob__vp;

View File

@ -9,5 +9,5 @@
// source have to figure out how to create revision.h just to get a build
// going. However, if it is not updated, it can be a version behind.
#define GLSLANG_REVISION "25314"
#define GLSLANG_DATE "2014/02/11 22:15:49"
#define GLSLANG_REVISION "25351"
#define GLSLANG_DATE "2014/02/13 12:14:33"

View File

@ -1486,17 +1486,21 @@ void TParseContext::globalCheck(TSourceLoc loc, const char* token)
}
//
// If it starts "gl_" or has double underscore, it's a reserved name.
// Except, if the symbol table is at a built-in level,
// which is when we are parsing built-ins.
// Reserved errors for GLSL.
//
void TParseContext::reservedErrorCheck(TSourceLoc loc, const TString& identifier)
{
// "Identifiers starting with "gl_" are reserved for use by OpenGL, and may not be
// declared in a shader; this results in a compile-time error."
if (! symbolTable.atBuiltInLevel()) {
if (builtInName(identifier))
error(loc, "reserved built-in name:", "gl_", identifier.c_str());
error(loc, "identifiers starting with \"gl_\" are reserved", identifier.c_str(), "");
// "In addition, all identifiers containing two consecutive underscores (__) are
// reserved; using such a name does not itself result in an error, but may result
// in undefined behavior."
if (identifier.find("__") != TString::npos)
error(loc, "Two consecutive underscores are reserved for future use.", identifier.c_str(), "", "");
warn(loc, "identifiers containing consecutive underscores (\"__\") are reserved", identifier.c_str(), "");
}
}
@ -1505,13 +1509,15 @@ void TParseContext::reservedErrorCheck(TSourceLoc loc, const TString& identifier
//
void TParseContext::reservedPpErrorCheck(TSourceLoc loc, const char* identifier, const char* op)
{
// "All macro names containing two consecutive underscores ( __ ) are reserved for future use as predefined
// macro names. All macro names prefixed with "GL_" ("GL" followed by a single underscore) are also
// reserved."
// "All macro names containing two consecutive underscores ( __ ) are reserved;
// defining such a name does not itself result in an error, but may result in
// undefined behavior. All macro names prefixed with "GL_" ("GL" followed by a
// single underscore) are also reserved, and defining such a name results in a
// compile-time error."
if (strncmp(identifier, "GL_", 3) == 0)
error(loc, "can't use with built-in names (\"GL_\" prefix)", op, "");
error(loc, "names beginning with \"GL_\" can't be defined:", op, identifier);
else if (strstr(identifier, "__") != 0)
error(loc, "can't use with built-in names (containing consecutive underscores)", op, "");
warn(loc, "names containing consecutive underscores are reserved:", op, identifier);
}
//