summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-12 12:37:07 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-12 14:33:52 -0700
commit97fc943b476e2482bd1f99c9e76f0dfe8fdd36e0 (patch)
treee1c59d0b48397e8e33428e65a2e0f3c6925c65d9
parente95b6312b6cecd6073f801ad1c9a7ab11d50dfc3 (diff)
Add test case for escaped newlines.
This also serves as a regression test for the recent preprocessor bug fix.
-rw-r--r--tests/preprocessor/escaped-newlines.slang23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/preprocessor/escaped-newlines.slang b/tests/preprocessor/escaped-newlines.slang
new file mode 100644
index 000000000..1c1fa8f10
--- /dev/null
+++ b/tests/preprocessor/escaped-newlines.slang
@@ -0,0 +1,23 @@
+//TEST:SIMPLE:
+
+// Test support for escaped newlines in macro definitions.
+//
+// A complete lexer would handle backslash-escaped newlines
+// in every possible context (including, e.g., in the middle
+// of an identifier), but we are not going to go to such
+// lengths right now.
+
+#define FOO(x, y) \
+ x \
+ y \
+ /* */
+
+FOO(float, bar)(float a)
+{
+ FOO(return, a);
+}
+
+float foo(float x)
+{
+ return bar(x);
+}