[Mesa-dev] [PATCH 20/23] glsl/glcpp: Test that macro parameters substitute immediately after periods

Carl Worth cworth at cworth.org
Thu Jun 26 15:19:20 PDT 2014

At one point while rewriting the lexing rule for pre-processing numbers, I
made it a bit too aggressive and within a replacement list sucked up a
parameter name that appeared immediately after a period. This caused the
parameter name to be unreplaced when the macro was expanded.

It was in some piglit tests that I originally found this issue. Here, I'm
adding a test to "make check" to ensure that this behavior remains correct.
 src/glsl/glcpp/tests/136-expand-macro-after-period.c          | 4 ++++
 src/glsl/glcpp/tests/136-expand-macro-after-period.c.expected | 4 ++++
 2 files changed, 8 insertions(+)
 create mode 100644 src/glsl/glcpp/tests/136-expand-macro-after-period.c
 create mode 100644 src/glsl/glcpp/tests/136-expand-macro-after-period.c.expected

diff --git a/src/glsl/glcpp/tests/136-expand-macro-after-period.c b/src/glsl/glcpp/tests/136-expand-macro-after-period.c
new file mode 100644
index 0000000..c8cd47f
--- /dev/null
+++ b/src/glsl/glcpp/tests/136-expand-macro-after-period.c
@@ -0,0 +1,4 @@
+#define FIELD(x) foo.x
+#define FIELD_OF(s, x) s.x
+FIELD_OF(foo, bar)
diff --git a/src/glsl/glcpp/tests/136-expand-macro-after-period.c.expected b/src/glsl/glcpp/tests/136-expand-macro-after-period.c.expected
new file mode 100644
index 0000000..f9f5be1
--- /dev/null
+++ b/src/glsl/glcpp/tests/136-expand-macro-after-period.c.expected
@@ -0,0 +1,4 @@

More information about the mesa-dev mailing list