diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-15 18:49:47 +0000 |
| commit | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (patch) | |
| tree | 2fd5819f49caecc5f520219b6b9254fe94ebb138 /test/Preprocessor | |
| parent | 1569ce68681d909594d64f9b056d71f5dd7563bf (diff) | |
Notes
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 bdc69536778d..5908fec4b681 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 10049adcd374..961e55161418 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 c3b067dfc965..d40ee2aa6ec7 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 cb6bc012f1c2..dbf1f9a797e2 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 59f665b54649..5943e01b517e 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 977789e38f1c..9f375efec2c0 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. |
