From 959bd8973bfcfced69715a522007662929ae6d48 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 7 Jan 2013 14:00:48 -0500 Subject: 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 --- validation/preprocessor/stringify.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 validation/preprocessor/stringify.c (limited to 'validation/preprocessor') 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 + */ -- cgit 1.2.3-korg