blob: d420eb4066de80133933ad4dc065144bc4723b66 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -E -dM %s -o - | FileCheck %s -strict-whitespace
Chris Lattnerf73903a2009-02-06 06:45:26 +00002
Chris Lattner9944f782009-12-07 01:49:36 +00003// Space at end even without expansion tokens
Daniel Dunbara498ca62009-12-09 00:04:46 +00004// CHECK: #define A(x)
Chris Lattnerf73903a2009-02-06 06:45:26 +00005#define A(x)
6
7// Space before expansion list.
Daniel Dunbara498ca62009-12-09 00:04:46 +00008// CHECK: #define B(x,y) x y
Chris Lattnerf73903a2009-02-06 06:45:26 +00009#define B(x,y)x y
10
Chris Lattner9944f782009-12-07 01:49:36 +000011// No space in argument list.
12// CHECK: #define C(x,y) x y
Chris Lattnerf73903a2009-02-06 06:45:26 +000013#define C(x, y) x y
14
15// No paste avoidance.
Chris Lattner5146b1b2009-12-07 01:57:13 +000016// CHECK: #define D() ..
17#define D() ..
Chris Lattnerf73903a2009-02-06 06:45:26 +000018
19// Simple test.
Chris Lattner5146b1b2009-12-07 01:57:13 +000020// CHECK: #define E .
21// CHECK: #define F X()Y
22#define E .
23#define F X()Y
Chris Lattnerf73903a2009-02-06 06:45:26 +000024
25// gcc prints macros at end of translation unit, so last one wins.
Chris Lattner5146b1b2009-12-07 01:57:13 +000026// CHECK: #define G 2
27#define G 1
28#undef G
29#define G 2
Chris Lattner807b93e2009-12-07 01:58:34 +000030
31// Variadic macros of various sorts. PR5699
32
33// CHECK: H(x,...) __VA_ARGS__
34#define H(x, ...) __VA_ARGS__
35// CHECK: I(...) __VA_ARGS__
36#define I(...) __VA_ARGS__
37// CHECK: J(x...) __VA_ARGS__
38#define J(x ...) __VA_ARGS__