Mesa (master): Add an expected file for 094-divide-by-zero-short-circuit
Carl Worth
cworth at kemper.freedesktop.org
Thu Apr 14 21:43:20 UTC 2011
Module: Mesa
Branch: master
Commit: d3c6ed382d8e02cd9f9e2cc77208b800abe17d54
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d3c6ed382d8e02cd9f9e2cc77208b800abe17d54
Author: Carl Worth <cworth at cworth.org>
Date: Thu Apr 14 14:35:11 2011 -0700
Add an expected file for 094-divide-by-zero-short-circuit
The expected file here captures the current behavior of glcpp (which
is to generate a division-by-zero error) for this case.
It's easy to argue that it should be short-circuiting the evaluation
and not generating the diagnostic (which happens to be what gcc does).
But it doesn't seem like we should force this behavior on our
pre-processor, (and, as always, the GLSL specification of the
pre-processor is too vague on this point).
---
.../glcpp/tests/094-divide-by-zero-short-circuit.c | 11 +++++++++++
.../094-divide-by-zero-short-circuit.c.expected | 15 +++++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c b/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
index a9c6f36..04497b1 100644
--- a/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
+++ b/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c
@@ -1,2 +1,13 @@
+/* glcpp is generating a division-by-zero error for this case. It's
+ * easy to argue that it should be short-circuiting the evaluation and
+ * not generating the diagnostic (which happens to be what gcc does).
+ * But it doesn't seem like we should force this behavior on our
+ * pre-processor, (and, as always, the GLSL specification of the
+ * pre-processor is too vague on this point).
+ *
+ * If a short-circuit evaluation optimization does get added to the
+ * pre-processor then it would legitimate to update the expected file
+ * for this test.
+*/
#if 1 || (1 / 0)
#endif
diff --git a/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected b/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected
new file mode 100644
index 0000000..84fdc50
--- /dev/null
+++ b/src/glsl/glcpp/tests/094-divide-by-zero-short-circuit.c.expected
@@ -0,0 +1,15 @@
+0:12(17): preprocessor error: division by 0 in preprocessor directive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
More information about the mesa-commit
mailing list