blob: ce7990a4cf3efacdc3e27ce583dfa66dd0a25829 [file] [log] [blame]
Reid Spencer5f016e22007-07-11 17:01:13 +00001// Example from C99 6.10.3.4p6
2
3// RUN: clang -E %s | grep -F 'printf("x" "1" "= %d, x" "2" "= s" x1, x2);' &&
4// RUN: clang -E %s | grep 'fputs("strncmp(\\"abc\\\\0d\\" \\"abc\\", .\\\\4.) == 0" ": @\\n", s);' &&
5// RUN: clang -E %s | grep -F 'include "vers2.h"' &&
6// RUN: clang -E %s | grep -F '"hello";' &&
7// RUN: clang -E %s | grep -F '"hello" ", world"'
8
9#define str(s) # s
10#define xstr(s) str(s)
11#define debug(s, t) printf("x" # s "= %d, x" # t "= s" \
12 x ## s, x ## t)
13#define INCFILE(n) vers ## n
14#define glue(a, b) a ## b
15#define xglue(a, b) glue(a, b)
16#define HIGHLOW "hello"
17#define LOW LOW ", world"
18debug(1, 2);
19fputs(str(strncmp("abc\0d" "abc", '\4') // this goes away
20 == 0) str(: @\n), s);
21include xstr(INCFILE(2).h)
22glue(HIGH, LOW);
23xglue(HIGH, LOW)
24