summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/glcpp/tests')
-rw-r--r--src/glsl/glcpp/tests/125-es-short-circuit-undefined.c27
-rw-r--r--src/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected30
2 files changed, 57 insertions, 0 deletions
diff --git a/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c b/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c
new file mode 100644
index 00000000000..4ee29f6d93f
--- /dev/null
+++ b/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c
@@ -0,0 +1,27 @@
+/* For GLSL in OpenGL ES, an undefined macro appearing in an #if or #elif
+ * expression, (other than as an argument to defined) is an error.
+ *
+ * Except in the case of a short-circuiting && or || operator, where the
+ * specification explicitly mandates that there be no error.
+ */
+#version 300 es
+
+/* These yield errors */
+#if NOT_DEFINED
+#endif
+
+#if 0
+#elif ALSO_NOT_DEFINED
+#endif
+
+/* But these yield no errors */
+#if 1 || STILL_NOT_DEFINED
+Success
+#endif
+
+#if 0
+#elif 0 && WILL_ANYONE_DEFINE_ANYTHING
+#else
+More success
+#endif
+
diff --git a/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected b/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected
new file mode 100644
index 00000000000..a52dae8f76a
--- /dev/null
+++ b/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c.expected
@@ -0,0 +1,30 @@
+0:10(16): preprocessor error: undefined macro in expression (illegal in GLES)
+0:14(23): preprocessor error: undefined macro in expression (illegal in GLES)
+
+
+
+
+
+
+#version 300 es
+
+
+
+
+
+
+
+
+
+
+
+Success
+
+
+
+
+
+More success
+
+
+