diff options
Diffstat (limited to 'test/Preprocessor')
-rw-r--r-- | test/Preprocessor/dump_macros.c | 41 | ||||
-rw-r--r-- | test/Preprocessor/header_lookup1.c | 2 | ||||
-rw-r--r-- | test/Preprocessor/macro_fn_disable_expand.c | 27 | ||||
-rw-r--r-- | test/Preprocessor/non_fragile_feature.m | 2 | ||||
-rw-r--r-- | test/Preprocessor/non_fragile_feature1.m | 2 | ||||
-rw-r--r-- | test/Preprocessor/objc-pp.m | 2 |
6 files changed, 51 insertions, 25 deletions
diff --git a/test/Preprocessor/dump_macros.c b/test/Preprocessor/dump_macros.c index bdc6953..5908fec 100644 --- a/test/Preprocessor/dump_macros.c +++ b/test/Preprocessor/dump_macros.c @@ -1,31 +1,38 @@ -// RUN: clang-cc -E -dM %s -o %t +// RUN: clang-cc -E -dM %s -o - | FileCheck %s -strict-whitespace -// Space even without expansion tokens -// RUN: grep "#define A(x) " %t +// Space at end even without expansion tokens +// CHECK: #define A(x) #define A(x) // Space before expansion list. -// RUN: grep "#define B(x,y) x y" %t +// CHECK: #define B(x,y) x y #define B(x,y)x y -// No space in expansion list. -// RUN: grep "#define C(x,y) x y" %t +// No space in argument list. +// CHECK: #define C(x,y) x y #define C(x, y) x y // No paste avoidance. -// RUN: grep "#define X() .." %t -#define X() .. +// CHECK: #define D() .. +#define D() .. // Simple test. -// RUN: grep "#define Y ." %t -// RUN: grep "#define Z X()Y" %t -#define Y . -#define Z X()Y +// CHECK: #define E . +// CHECK: #define F X()Y +#define E . +#define F X()Y // gcc prints macros at end of translation unit, so last one wins. -// RUN: grep "#define foo 2" %t -// RUN: not grep "#define foo 1" %t -#define foo 1 -#undef foo -#define foo 2 +// CHECK: #define G 2 +#define G 1 +#undef G +#define G 2 +// Variadic macros of various sorts. PR5699 + +// CHECK: H(x,...) __VA_ARGS__ +#define H(x, ...) __VA_ARGS__ +// CHECK: I(...) __VA_ARGS__ +#define I(...) __VA_ARGS__ +// CHECK: J(x...) __VA_ARGS__ +#define J(x ...) __VA_ARGS__ diff --git a/test/Preprocessor/header_lookup1.c b/test/Preprocessor/header_lookup1.c index 10049ad..961e551 100644 --- a/test/Preprocessor/header_lookup1.c +++ b/test/Preprocessor/header_lookup1.c @@ -1,2 +1,2 @@ -// RUN: clang -I /usr/include %s -E | grep 'stdio.h.*3.*4' +// RUN: clang -fno-ms-extensions -I /usr/include %s -E | grep 'stdio.h.*3.*4' #include <stdio.h> diff --git a/test/Preprocessor/macro_fn_disable_expand.c b/test/Preprocessor/macro_fn_disable_expand.c index c3b067d..d40ee2a 100644 --- a/test/Preprocessor/macro_fn_disable_expand.c +++ b/test/Preprocessor/macro_fn_disable_expand.c @@ -1,11 +1,30 @@ -// RUN: clang-cc %s -E | grep 'bar foo (2)' -// RUN: clang-cc %s -E | grep 'm(ABCD)' +// RUN: clang-cc %s -E | FileCheck %s #define foo(x) bar x foo(foo) (2) - +// CHECK: bar foo (2) #define m(a) a(w) #define w ABCD -m(m) // m(ABCD) +m(m) +// CHECK: m(ABCD) + + + +// rdar://7466570 PR4438, PR5163 + +// We should get '42' in the argument list for gcc compatibility. +#define A 1 +#define B 2 +#define C(x) (x + 1) +X: C( +#ifdef A +#if A == 1 +#if B + 42 +#endif +#endif +#endif + ) +// CHECK: X: (42 + 1) diff --git a/test/Preprocessor/non_fragile_feature.m b/test/Preprocessor/non_fragile_feature.m index cb6bc01..dbf1f9a 100644 --- a/test/Preprocessor/non_fragile_feature.m +++ b/test/Preprocessor/non_fragile_feature.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -fobjc-nonfragile-abi %s +// RUN: clang -cc1 -fobjc-nonfragile-abi %s #ifndef __has_feature #error Should have __has_feature #endif diff --git a/test/Preprocessor/non_fragile_feature1.m b/test/Preprocessor/non_fragile_feature1.m index 59f665b..5943e01 100644 --- a/test/Preprocessor/non_fragile_feature1.m +++ b/test/Preprocessor/non_fragile_feature1.m @@ -1,4 +1,4 @@ -// RUN: clang-cc -triple i386-unknown-unknown %s +// RUN: clang -cc1 -triple i386-unknown-unknown %s #ifndef __has_feature #error Should have __has_feature #endif diff --git a/test/Preprocessor/objc-pp.m b/test/Preprocessor/objc-pp.m index 977789e..9f375ef 100644 --- a/test/Preprocessor/objc-pp.m +++ b/test/Preprocessor/objc-pp.m @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -fsyntax-only -verify -pedantic +// RUN: clang -cc1 %s -fsyntax-only -verify -pedantic #import <stdint.h> // no warning on #import in objc mode. |