Home | History | Annotate | Download | only in Preprocessor
      1 // Example from C99 6.10.3.4p9
      2 
      3 // RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
      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__))
      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));
     20 
     21