From: John Kessenich Date: Tue, 18 Feb 2014 21:55:42 +0000 (+0000) Subject: Update rules for "GL_", "gl_", and "__" to match latest specification bug fixes. X-Git-Tag: upstream/0.1~734 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52c351442ced0424b32da014d84d7ee1e9b2a490;p=platform%2Fupstream%2Fglslang.git 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 --- diff --git a/Install/Windows/glslangValidator.exe b/Install/Windows/glslangValidator.exe index 60c4ad9..75e5e29 100644 Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out index f8e9f2b..aebb3cd 100644 --- a/Test/baseResults/330.frag.out +++ b/Test/baseResults/330.frag.out @@ -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 diff --git a/Test/baseResults/cppSimple.vert.out b/Test/baseResults/cppSimple.vert.out index 66f6ddc..640f251 100644 --- a/Test/baseResults/cppSimple.vert.out +++ b/Test/baseResults/cppSimple.vert.out @@ -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! diff --git a/Test/baseResults/decls.frag.out b/Test/baseResults/decls.frag.out index 63b8512..0a72ab7 100644 --- a/Test/baseResults/decls.frag.out +++ b/Test/baseResults/decls.frag.out @@ -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: diff --git a/Test/decls.frag b/Test/decls.frag index 0e41f35..486e796 100644 --- a/Test/decls.frag +++ b/Test/decls.frag @@ -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; diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index c18f60d..3a7753a 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -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" diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index d2b63de..90641a1 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -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); } //