opnsense-src/test/Preprocessor/stringize_misc.c

31 lines
661 B
C
Raw Normal View History

2010-01-01 05:34:51 -05:00
// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
2009-06-02 13:58:47 -04:00
#define M(x, y) #x #y
M( f(1, 2), g((x=y++, y)))
2009-11-04 10:04:32 -05:00
// CHECK: "f(1, 2)" "g((x=y++, y))"
2009-06-02 13:58:47 -04:00
M( {a=1 , b=2;} ) /* A semicolon is not a comma */
2009-11-04 10:04:32 -05:00
// CHECK: "{a=1" "b=2;}"
2009-06-02 13:58:47 -04:00
M( <, [ ) /* Passes the arguments < and [ */
2009-11-04 10:04:32 -05:00
// CHECK: "<" "["
2009-06-02 13:58:47 -04:00
M( (,), (...) ) /* Passes the arguments (,) and (...) */
2009-11-04 10:04:32 -05:00
// CHECK: "(,)" "(...)"
2009-06-02 13:58:47 -04:00
#define START_END(start, end) start c=3; end
START_END( {a=1 , b=2;} ) /* braces are not parentheses */
2009-11-04 10:04:32 -05:00
// CHECK: {a=1 c=3; b=2;}
2009-06-02 13:58:47 -04:00
/*
* To pass a comma token as an argument it is
* necessary to write:
*/
#define COMMA ,
M(a COMMA b, (a, b))
2009-11-04 10:04:32 -05:00
// CHECK: "a COMMA b" "(a, b)"
2009-06-02 13:58:47 -04:00