[Piglit] [PATCH] glsl-1.10: Test that empty declarations are allowed
Chad Versace
chad at chad-versace.us
Fri Aug 5 12:34:17 PDT 2011
This tests that each of the following empty declarations is allowed:
vert, local: float
vert, local: const float
vert, global: float
vert, global: const float
vert, attribute: float
vert, varying: float
vert, uniform: float
Surprisingly, the formal GLSL grammar allows empty declarations. From
page 68 (page 74 of pdf) of the GLSL 1.10 spec:
init_declarator_list:
single_declaration
...
single_declaration:
fully_specified_type
...
fully_specified_type:
type_specifier
type_qualifier type_specifier
Since this property of the grammar is consistent through all versions of
GLSL (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
Moreover, C99 allows empty declarations. The program below successfully
compiles with `gcc --std=c99`.
float;
int main() { return 0; }
CC: Paul Berry <sterotype441 at gmail.com>
CC: Chia-I Wu <olv at lunarg.com>
Signed-off-by: Chad Versace <chad at chad-versace.us>
---
.../empty-declaration-attribute-float.vert | 39 +++++++++++++++++++
.../empty-declaration-global-const-float.vert | 39 +++++++++++++++++++
...mpty-declaration-global-no-qualifier-float.vert | 40 ++++++++++++++++++++
.../empty-declaration-local-const-float.vert | 40 ++++++++++++++++++++
...empty-declaration-local-no-qualifier-float.vert | 40 ++++++++++++++++++++
.../empty-declaration-uniform-float.vert | 39 +++++++++++++++++++
.../empty-declaration-varying-float.vert | 39 +++++++++++++++++++
7 files changed, 276 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-attribute-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-const-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-no-qualifier-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-const-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-no-qualifier-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-uniform-float.vert
create mode 100644 tests/spec/glsl-1.10/compiler/declarations/empty-declaration-varying-float.vert
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-attribute-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-attribute-float.vert
new file mode 100644
index 0000000..33d2fd4
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-attribute-float.vert
@@ -0,0 +1,39 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declrations of attributes are allowed.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+attribute float;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-const-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-const-float.vert
new file mode 100644
index 0000000..0500236
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-const-float.vert
@@ -0,0 +1,39 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declarations of global const variables are allowed.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+const float;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-no-qualifier-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-no-qualifier-float.vert
new file mode 100644
index 0000000..1bf43d7
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-global-no-qualifier-float.vert
@@ -0,0 +1,40 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declarations at global scope are allowed. This specifically
+ * tests types without type qualifiers.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+float;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-const-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-const-float.vert
new file mode 100644
index 0000000..e961c8a
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-const-float.vert
@@ -0,0 +1,40 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declarations of const variables are allowed at function
+ * scope.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+
+void main()
+{
+ const float;
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-no-qualifier-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-no-qualifier-float.vert
new file mode 100644
index 0000000..d24ae91
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-local-no-qualifier-float.vert
@@ -0,0 +1,40 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declarations at function scope are allowed. This specifically
+ * tests types without type qualifiers.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+
+void main()
+{
+ float;
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-uniform-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-uniform-float.vert
new file mode 100644
index 0000000..5e1b43f
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-uniform-float.vert
@@ -0,0 +1,39 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty 'uniform' declarations are allowed.
+
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+uniform float;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-varying-float.vert b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-varying-float.vert
new file mode 100644
index 0000000..26f4d75
--- /dev/null
+++ b/tests/spec/glsl-1.10/compiler/declarations/empty-declaration-varying-float.vert
@@ -0,0 +1,39 @@
+/*
+ * [config]
+ * glsl_version: 1.10
+ * expect_result: pass
+ * [end config]
+ *
+ * Test that empty declrations of varyings are allowed.
+ *
+ * The formal GLSL grammar allows empty declarations. From page 68 (page 74 of
+ * pdf) of the GLSL 1.10 spec:
+ * init_declarator_list:
+ * single_declaration
+ * ...
+ *
+ * single_declaration:
+ * fully_specified_type
+ * ...
+ *
+ * fully_specified_type:
+ * type_specifier
+ * type_qualifier type_specifier
+ *
+ * Since this property of the grammar is consistent through all versions of GLSL
+ * (presently up to GLSL 4.10), this is unlikely to be a grammar bug.
+ *
+ * Moreover, C99 allows empty declarations. The program below successfully
+ * compiles with `gcc --std=c99`.
+ * float;
+ * int main() { return 0; }
+ */
+
+#version 110
+
+varying float;
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
--
1.7.6
More information about the Piglit
mailing list