Update rules for "GL_", "gl_", and "__" to match latest specification bug fixes.
authorJohn Kessenich <cepheus@frii.com>
Tue, 18 Feb 2014 21:55:42 +0000 (21:55 +0000)
committerJohn Kessenich <cepheus@frii.com>
Tue, 18 Feb 2014 21:55:42 +0000 (21:55 +0000)
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25392 e7fa87d3-cd2b-0410-9028-fcbf551c1848

Install/Windows/glslangValidator.exe
Test/baseResults/330.frag.out
Test/baseResults/cppSimple.vert.out
Test/baseResults/decls.frag.out
Test/decls.frag
glslang/Include/revision.h
glslang/MachineIndependent/ParseHelper.cpp

index 60c4ad9..75e5e29 100644 (file)
Binary files a/Install/Windows/glslangValidator.exe and b/Install/Windows/glslangValidator.exe differ
index f8e9f2b..aebb3cd 100644 (file)
@@ -1,8 +1,8 @@
 330.frag\r
 Warning, version 330 is not yet complete; some version-specific features are present, but many are missing.\r
 ERROR: 0:27: 'block declaration' : cannot redeclare block:  gl_block\r
-ERROR: 0:31: 'gl_' : reserved built-in name: gl_name\r
-ERROR: 0:32: 'gl_' : reserved built-in name: gl_i\r
+ERROR: 0:31: 'gl_name' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:32: 'gl_i' : identifiers starting with "gl_" are reserved \r
 ERROR: 0:35: 'gl_in' : no declaration found for redeclaration \r
 ERROR: 0:39: 'gl_FragCoord' : cannot redeclare a non block as a block \r
 ERROR: 0:44: 'non-literal layout-id value' : not supported for this version or the enabled extensions \r
index 66f6ddc..640f251 100644 (file)
@@ -25,11 +25,11 @@ ERROR: 0:136: 'length' : no matching overloaded function found
 ERROR: 0:136: '=' :  cannot convert from 'const float' to 'int'\r
 ERROR: 0:138: ''' : character literals not supported \r
 ERROR: 0:138: ''' : character literals not supported \r
-ERROR: 0:141: '#define' : can't use with built-in names ("GL_" prefix) \r
-ERROR: 0:142: '#define' : can't use with built-in names ("GL_" prefix) \r
-ERROR: 0:143: '#define' : can't use with built-in names (containing consecutive underscores) \r
-ERROR: 0:144: '#define' : can't use with built-in names (containing consecutive underscores) \r
-ERROR: 0:145: '#define' : can't use with built-in names (containing consecutive underscores) \r
+ERROR: 0:141: '#define' : names beginning with "GL_" can't be defined: GL_\r
+ERROR: 0:142: '#define' : names beginning with "GL_" can't be defined: GL_Macro\r
+WARNING: 0:143: '#define' : names containing consecutive underscores are reserved: __M\r
+WARNING: 0:144: '#define' : names containing consecutive underscores are reserved: M__\r
+WARNING: 0:145: '#define' : names containing consecutive underscores are reserved: ABC__DE\r
 ERROR: 0:148: '#else' : unexpected tokens following directive \r
 ERROR: 0:149: '#elif' : #elif after #else \r
 ERROR: 0:155: '#else' : unexpected tokens following directive \r
@@ -42,8 +42,8 @@ ERROR: 0:182: '#define' : Macro redefined; different number of arguments: m6
 ERROR: 0:185: '#define' : Macro redefined; different substitutions: m7\r
 ERROR: 0:192: '#define' : Macro redefined; different substitutions: m8\r
 ERROR: 0:196: '#define' : Macro redefined; different argument names: m9\r
-ERROR: 0:204: '#undef' : can't use with built-in names (containing consecutive underscores) \r
-ERROR: 0:205: '#undef' : can't use with built-in names ("GL_" prefix) \r
+WARNING: 0:204: '#undef' : names containing consecutive underscores are reserved: __VERSION__\r
+ERROR: 0:205: '#undef' : names beginning with "GL_" can't be defined: GL_ARB_texture_rectangle\r
 ERROR: 0:210: '#' : invalid directive \r
 ERROR: 0:211: '#' : invalid directive \r
 ERROR: 0:212: '#' : invalid directive \r
@@ -83,7 +83,7 @@ ERROR: 12:9016: 'macro expansion' : expected '(' following FOOOM
 ERROR: 12:9017: 'preprocessor evaluation' : can't evaluate expression \r
 ERROR: 12:9017: 'preprocessor evaluation' : bad expression \r
 ERROR: 12:10003: '' : missing #endif \r
-ERROR: 83 compilation errors.  No code generated.\r
+ERROR: 79 compilation errors.  No code generated.\r
 \r
 \r
 ERROR: node is still EOpNull!\r
index 63b8512..0a72ab7 100644 (file)
@@ -8,15 +8,22 @@ ERROR: 0:22: 'vn8' : illegal use of type 'void'
 ERROR: 0:22: 'vp' : illegal use of type 'void' \r
 ERROR: 0:25: 'cij' : variables with qualifier 'const' must be initialized \r
 ERROR: 0:27: 'cip' : variables with qualifier 'const' must be initialized \r
-ERROR: 0:34: 'gl_' : reserved built-in name: gl_vi4\r
-ERROR: 0:35: 'gl_' : reserved built-in name: gl_vj\r
-ERROR: 0:35: 'gl_' : reserved built-in name: gl_vk5\r
-ERROR: 0:36: 'gl_' : reserved built-in name: gl_vm2\r
-ERROR: 0:36: 'gl_' : reserved built-in name: gl_vm3\r
-ERROR: 0:37: 'gl_' : reserved built-in name: gl_vn8\r
-ERROR: 0:37: 'gl_' : reserved built-in name: gl_vp\r
+ERROR: 0:34: 'gl_vi4' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:35: 'gl_vj' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:35: 'gl_vk5' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:36: 'gl_vm2' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:36: 'gl_vm3' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:37: 'gl_vn8' : identifiers starting with "gl_" are reserved \r
+ERROR: 0:37: 'gl_vp' : identifiers starting with "gl_" are reserved \r
 ERROR: 0:42: '' : boolean expression expected \r
-ERROR: 0:43: 'gl_' : reserved built-in name: gl_cond\r
+ERROR: 0:43: 'gl_cond' : identifiers starting with "gl_" are reserved \r
+WARNING: 0:46: 'foob__vi4' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:47: 'foob__vj' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:47: 'foob__vk5' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:48: '__foobvm2' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:48: '__foobvm3' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:49: 'foob__vn8' : identifiers containing consecutive underscores ("__") are reserved \r
+WARNING: 0:49: 'foob__vp' : identifiers containing consecutive underscores ("__") are reserved \r
 ERROR: 18 compilation errors.  No code generated.\r
 \r
 \r
@@ -135,6 +142,43 @@ ERROR: node is still EOpNull!
 0:43            'b' (int)\r
 0:43            'c' (int)\r
 0:43        No loop body\r
+0:46  Sequence\r
+0:46    move second child to first child (4-element array of int)\r
+0:46      'foob__vi4' (4-element array of int)\r
+0:46      Constant:\r
+0:46        1 (const int)\r
+0:46        2 (const int)\r
+0:46        3 (const int)\r
+0:46        4 (const int)\r
+0:47  Sequence\r
+0:47    move second child to first child (5-element array of int)\r
+0:47      'foob__vk5' (5-element array of int)\r
+0:47      Constant:\r
+0:47        5 (const int)\r
+0:47        6 (const int)\r
+0:47        7 (const int)\r
+0:47        8 (const int)\r
+0:47        9 (const int)\r
+0:48  Sequence\r
+0:48    move second child to first child (2-element array of int)\r
+0:48      '__foobvm2' (2-element array of int)\r
+0:48      Constant:\r
+0:48        10 (const int)\r
+0:48        11 (const int)\r
+0:48    move second child to first child (3-element array of int)\r
+0:48      '__foobvm3' (3-element array of int)\r
+0:48      Constant:\r
+0:48        12 (const int)\r
+0:48        13 (const int)\r
+0:48        14 (const int)\r
+0:49  Sequence\r
+0:49    move second child to first child (4-element array of int)\r
+0:49      'foob__vn8' (4-element array of int)\r
+0:49      Constant:\r
+0:49        21 (const int)\r
+0:49        22 (const int)\r
+0:49        23 (const int)\r
+0:49        24 (const int)\r
 0:?   Linker Objects\r
 0:?     'a' (int)\r
 0:?     'b' (int)\r
@@ -215,6 +259,13 @@ ERROR: node is still EOpNull!
 0:?     'gl_vm3' (3-element array of int)\r
 0:?     'gl_vn8' (4-element array of int)\r
 0:?     'gl_vp' (int)\r
+0:?     'foob__vi4' (4-element array of int)\r
+0:?     'foob__vj' (int)\r
+0:?     'foob__vk5' (5-element array of int)\r
+0:?     '__foobvm2' (2-element array of int)\r
+0:?     '__foobvm3' (3-element array of int)\r
+0:?     'foob__vn8' (4-element array of int)\r
+0:?     'foob__vp' (int)\r
 \r
 \r
 Linked fragment stage:\r
index 0e41f35..486e796 100644 (file)
@@ -42,3 +42,8 @@ void main()
     while (int icond = b);\r
     while (bool gl_cond = b < c);\r
 }\r
+\r
+int foob__vi4[4] = int[](1, 2, 3, 4);\r
+int foob__vj, foob__vk5[5] = int[](5, 6, 7, 8, 9);\r
+int __foobvm2[2] = int[](10, 11), __foobvm3[3] = int[](12, 13, 14);\r
+int foob__vn8[4] = int[](21, 22, 23, 24), foob__vp;\r
index c18f60d..3a7753a 100644 (file)
@@ -9,5 +9,5 @@
 // source have to figure out how to create revision.h just to get a build\r
 // going.  However, if it is not updated, it can be a version behind.\r
 \r
-#define GLSLANG_REVISION "25314"\r
-#define GLSLANG_DATE     "2014/02/11 22:15:49"\r
+#define GLSLANG_REVISION "25351"\r
+#define GLSLANG_DATE     "2014/02/13 12:14:33"\r
index d2b63de..90641a1 100644 (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);
 }
 
 //