diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-15 16:31:19 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-15 16:31:19 +0000 |
commit | a505eb93f43fb776fca5b1e021f93e9c05e7b53e (patch) | |
tree | 5ac7cde31c4f9702279d2164f5266e11d3632b77 /test/Sema | |
parent | 98781354c33bdc945ab6ea8c410d36c664ce1f5e (diff) |
Notes
Diffstat (limited to 'test/Sema')
-rw-r--r-- | test/Sema/attr-warn_unused_result.c | 19 | ||||
-rw-r--r-- | test/Sema/block-explicit-return-type.c | 81 | ||||
-rw-r--r-- | test/Sema/carbon-pth.c | 7 | ||||
-rw-r--r-- | test/Sema/nonnull.c | 32 |
4 files changed, 0 insertions, 139 deletions
diff --git a/test/Sema/attr-warn_unused_result.c b/test/Sema/attr-warn_unused_result.c deleted file mode 100644 index b4ef1bbeaf0e..000000000000 --- a/test/Sema/attr-warn_unused_result.c +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: clang-cc %s -fsyntax-only -verify -// rdar://6587766 - -int fn1() __attribute__ ((warn_unused_result)); -int fn2() __attribute__ ((pure)); -int fn3() __attribute__ ((const)); - -int foo() { - if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings - return -1; - - fn1(); // expected-warning {{expression result unused}} - fn2(92, 21); // expected-warning {{expression result unused}} - fn3(42); // expected-warning {{expression result unused}} - return 0; -} - -int bar __attribute__ ((warn_unused_result)); // expected-warning {{warning: 'warn_unused_result' attribute only applies to function types}} - diff --git a/test/Sema/block-explicit-return-type.c b/test/Sema/block-explicit-return-type.c deleted file mode 100644 index c7b26b3d6bf6..000000000000 --- a/test/Sema/block-explicit-return-type.c +++ /dev/null @@ -1,81 +0,0 @@ -// RUN: clang-cc -ObjC -fsyntax-only %s -verify -fblocks -// FIXME: should compile -// Test for blocks with explicit return type specified. - -typedef float * PF; -float gf; - -@interface NSView - - (id) some_method_that_returns_id; -@end - -NSView *some_object; - -void some_func (NSView * (^) (id)); - -typedef struct dispatch_item_s *dispatch_item_t; -typedef void (^completion_block_t)(void); - -typedef double (^myblock)(int); -double test(myblock I); - -int main() -{ - __block int x = 1; - __block int y = 2; - - (void)^void *{ return 0; }; - - (void)^float(float y){ return y; }; - - (void)^double (float y, double d) - { - if (y) - return d; - else - return y; - }; - - const char * (^chb) (int flag, const char *arg, char *arg1) = ^ const char * (int flag, const char *arg, char *arg1) { - if (flag) - return 0; - if (flag == 1) - return arg; - else if (flag == 2) - return ""; - return arg1; - }; - - (void)^PF { return &gf; }; - - some_func(^ NSView * (id whatever) { return [some_object some_method_that_returns_id]; }); - - double res = test(^(int z){x = y+z; return (double)z; }); -} - -void func() -{ - completion_block_t X; - - completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) { - return X; - }; - - completion_block_t (^blocky)(dispatch_item_t) = ^(dispatch_item_t item) { - return X; - }; - - blockx = blocky; - -} - - -// intent: block taking int returning block that takes char,int and returns int -int (^(^block)(double x))(char, short); - -void foo() { - int one = 1; - block = ^(double x){ return ^(char c, short y) { return one + c + y; };}; // expected-error {{returning block that lives on the local stack}} - // or: - block = ^(double x){ return ^(char c, short y) { return one + (int)c + y; };}; // expected-error {{returning block that lives on the local stack}} -} diff --git a/test/Sema/carbon-pth.c b/test/Sema/carbon-pth.c deleted file mode 100644 index c956d2a7a1c8..000000000000 --- a/test/Sema/carbon-pth.c +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: clang-cc -mcpu=pentium4 -emit-pth -o %t %s && -// RUN: clang-cc -mcpu=pentium4 -token-cache %t %s && -// RUN: clang-cc -mcpu=pentium4 -token-cache %t %s -E %s -o /dev/null -#ifdef __APPLE__ -#include <Carbon/Carbon.h> -#endif - diff --git a/test/Sema/nonnull.c b/test/Sema/nonnull.c deleted file mode 100644 index 3bed2feb5012..000000000000 --- a/test/Sema/nonnull.c +++ /dev/null @@ -1,32 +0,0 @@ -// RUN: clang-cc -fblocks -fsyntax-only -verify %s - -int f1(int x) __attribute__((nonnull)); // expected-warning{{'nonnull' attribute applied to function with no pointer arguments}} -int f2(int *x) __attribute__ ((nonnull (1))); -int f3(int *x) __attribute__ ((nonnull (0))); // expected-error {{'nonnull' attribute parameter 1 is out of bounds}} -int f4(int *x, int *y) __attribute__ ((nonnull (1,2))); -int f5(int *x, int *y) __attribute__ ((nonnull (2,1))); - -extern void func1 (void (^block1)(), void (^block2)(), int) __attribute__((nonnull)); - -extern void func3 (void (^block1)(), int, void (^block2)(), int) -__attribute__((nonnull(1,3))); - -extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1))) -__attribute__((nonnull(2))); - -void -foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)()) -{ - func1(cp1, cp2, i1); - - func1(0, cp2, i1); // expected-warning {{null passed to a callee which requires a non-null argument}} - func1(cp1, 0, i1); // expected-warning {{null passed to a callee which requires a non-null argument}} - func1(cp1, cp2, 0); - - - func3(0, i2, cp3, i3); // expected-warning {{null passed to a callee which requires a non-null argument}} - func3(cp3, i2, 0, i3); // expected-warning {{null passed to a callee which requires a non-null argument}} - - func4(0, cp1); // expected-warning {{null passed to a callee which requires a non-null argument}} - func4(cp1, 0); // expected-warning {{null passed to a callee which requires a non-null argument}} -} |