Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 1 | // Example from C99 6.10.3.4p9 |
| 2 | |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 4 | |
| 5 | #define debug(...) fprintf(stderr, __VA_ARGS__) |
| 6 | #define showlist(...) puts(#__VA_ARGS__) |
| 7 | #define report(test, ...) ((test)?puts(#test):\ |
| 8 | printf(__VA_ARGS__)) |
Edward O'Callaghan | b396a37 | 2009-10-27 02:36:32 +0000 | [diff] [blame] | 9 | debug("Flag"); |
| 10 | // CHECK: fprintf(stderr, "Flag"); |
| 11 | |
| 12 | debug("X = %d\n", x); |
| 13 | // CHECK: fprintf(stderr, "X = %d\n", x); |
| 14 | |
| 15 | showlist(The first, second, and third items.); |
| 16 | // CHECK: puts("The first, second, and third items."); |
| 17 | |
| 18 | report(x>y, "x is %d but y is %d", x, y); |
| 19 | // CHECK: ((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y)); |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 20 | |