summaryrefslogtreecommitdiffstats
path: root/tests/preprocessor/define-function-like.spire
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-06-09 11:34:21 -0700
committerTim Foley <tfoley@nvidia.com>2017-06-09 13:44:59 -0700
commitfcf83dbf9effab3bd98bad2b83b2468b7eb05cfd (patch)
tree41047c94883b86ec085a81597391ce3ef557cd43 /tests/preprocessor/define-function-like.spire
parent52e8d4b9a27ab0060f874c3a63ab531847be35c0 (diff)
Initial import of code.
Diffstat (limited to 'tests/preprocessor/define-function-like.spire')
-rw-r--r--tests/preprocessor/define-function-like.spire19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/preprocessor/define-function-like.spire b/tests/preprocessor/define-function-like.spire
new file mode 100644
index 000000000..f1dd9caa4
--- /dev/null
+++ b/tests/preprocessor/define-function-like.spire
@@ -0,0 +1,19 @@
+//TEST:SIMPLE:
+// support for function-like macros
+
+#define FOO(x) 1.0 + x
+
+float foo(float y) { return FOO(y) * 2.0; }
+
+// simple token pasting
+
+#define PASTE(a,b) a##b
+
+PASTE(flo,at) bar() { return 0.0; }
+
+// no space before parens? not a function-like macro
+
+#define M (x) - (x)
+
+// Error: undefined identifier `x`
+float bar(float a) { return M(a); }