aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/preprocessor
diff options
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-07 14:00:48 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-12 10:05:31 -0500
commit959bd8973bfcfced69715a522007662929ae6d48 (patch)
tree18c00b9c8fde48546638c613e4db9d0fa84d06c6 /validation/preprocessor
parent15cfba61d99668e9c14782779766f48834490ead (diff)
downloadsparse-dev-959bd8973bfcfced69715a522007662929ae6d48.tar.gz
switch to delayed handling of escape sequences
#define A(x) #x A('\12') should *not* yield "'\\n'"; the problem is that we are doing the conversion too early. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'validation/preprocessor')
-rw-r--r--validation/preprocessor/stringify.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/validation/preprocessor/stringify.c b/validation/preprocessor/stringify.c
new file mode 100644
index 00000000..7fe965d5
--- /dev/null
+++ b/validation/preprocessor/stringify.c
@@ -0,0 +1,29 @@
+#define A(x) #x
+A('a')
+A("a")
+A(a)
+A(\n)
+A('\n')
+A("\n")
+A('"')
+A("a\nb")
+A(L"a\nb")
+A('\12')
+/*
+ * check-name: Preprocessor #14
+ * check-command: sparse -E $file
+ *
+ * check-output-start
+
+"'a'"
+"\"a\""
+"a"
+"\n"
+"'\\n'"
+"\"\\n\""
+"'\"'"
+"\"a\\nb\""
+"L\"a\\nb\""
+"'\\12'"
+ * check-output-end
+ */