summaryrefslogtreecommitdiffstats
path: root/src/glsl/glcpp/tests/125-es-short-circuit-undefined.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/glcpp/tests/125-es-short-circuit-undefined.c')
-rw-r--r--src/glsl/glcpp/tests/125-es-short-circuit-undefined.c27
1 files changed, 27 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
+