blob: 6c2c78d17ac3ad35d25f1dbdb3ae4a610bc6a6c2 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -E %s | FileCheck -strict-whitespace %s
Reid Spencer5f016e22007-07-11 17:01:13 +00002
3#define M(x, y) #x #y
4
5M( f(1, 2), g((x=y++, y)))
Edward O'Callaghanb396a372009-10-27 02:36:32 +00006// CHECK: "f(1, 2)" "g((x=y++, y))"
7
Reid Spencer5f016e22007-07-11 17:01:13 +00008M( {a=1 , b=2;} ) /* A semicolon is not a comma */
Edward O'Callaghanb396a372009-10-27 02:36:32 +00009// CHECK: "{a=1" "b=2;}"
10
Reid Spencer5f016e22007-07-11 17:01:13 +000011M( <, [ ) /* Passes the arguments < and [ */
Edward O'Callaghanb396a372009-10-27 02:36:32 +000012// CHECK: "<" "["
13
Reid Spencer5f016e22007-07-11 17:01:13 +000014M( (,), (...) ) /* Passes the arguments (,) and (...) */
Edward O'Callaghanb396a372009-10-27 02:36:32 +000015// CHECK: "(,)" "(...)"
Reid Spencer5f016e22007-07-11 17:01:13 +000016
17#define START_END(start, end) start c=3; end
18
19START_END( {a=1 , b=2;} ) /* braces are not parentheses */
Edward O'Callaghanb396a372009-10-27 02:36:32 +000020// CHECK: {a=1 c=3; b=2;}
Reid Spencer5f016e22007-07-11 17:01:13 +000021
22/*
23 * To pass a comma token as an argument it is
24 * necessary to write:
25 */
26#define COMMA ,
27
28M(a COMMA b, (a, b))
Edward O'Callaghanb396a372009-10-27 02:36:32 +000029// CHECK: "a COMMA b" "(a, b)"
Reid Spencer5f016e22007-07-11 17:01:13 +000030