brintos

brintos / llvm-project-archived public Read only

0
0
Text · 864 B · fc7253e Raw
42 lines · c
1#ifdef TEST12// RUN: %clang_cc1 -E %s -DTEST1 | FileCheck -strict-whitespace %s3 4#define M(x, y) #x #y5 6M( f(1, 2), g((x=y++, y))) 7// CHECK: "f(1, 2)" "g((x=y++, y))"8 9M( {a=1 , b=2;} ) /* A semicolon is not a comma */ 10// CHECK: "{a=1" "b=2;}"11 12M( <, [ ) /* Passes the arguments < and [ */ 13// CHECK: "<" "["14 15M( (,), (...) ) /* Passes the arguments (,) and (...) */ 16// CHECK: "(,)" "(...)"17 18#define START_END(start, end) start c=3; end 19 20START_END( {a=1 , b=2;} ) /* braces are not parentheses */ 21// CHECK: {a=1 c=3; b=2;}22 23/* 24 * To pass a comma token as an argument it is 25 * necessary to write: 26 */ 27#define COMMA , 28 29M(a COMMA b, (a, b)) 30// CHECK: "a COMMA b" "(a, b)"31 32#endif33 34#ifdef TEST235// RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST236 37#define HASH #38#define INVALID() #39// expected-error@-1{{'#' is not followed by a macro parameter}}40 41#endif42