From e030358cc06e1cbce3c2e00ca67c946f9164b2a8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 9 Jan 2010 20:43:19 +0000 Subject: [PATCH] add a bunch of missing prototypes to tests git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93072 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/CFDateGC.m | 12 +++++++----- test/Analysis/PR2599.m | 2 ++ test/Analysis/casts.c | 2 ++ test/Analysis/dead-stores.c | 2 ++ test/Analysis/misc-ps-region-store.m | 6 +++--- test/Analysis/misc-ps.m | 4 ++++ test/Analysis/rdar-6442306-1.m | 2 ++ test/Analysis/retain-release-basic-store.m | 2 ++ test/Analysis/retain-release-region-store.m | 2 ++ test/Analysis/retain-release.m | 2 ++ test/Analysis/uninit-vals-ps-region.c | 1 + test/Lexer/numeric-literal-trash.c | 2 +- test/Sema/attr-noreturn.c | 2 ++ test/Sema/block-labels.c | 2 ++ test/Sema/block-misc.c | 3 +++ test/Sema/block-return.c | 1 + test/Sema/conditional.c | 1 + test/Sema/format-strings.c | 1 + test/Sema/implicit-builtin-decl.c | 3 ++- test/Sema/implicit-decl.c | 3 ++- test/SemaObjC/bad-receiver-1.m | 2 ++ test/SemaObjC/ivar-access-package.m | 2 ++ test/SemaObjC/nonnull.m | 3 +++ test/SemaObjC/protocol-archane.m | 1 + 24 files changed, 52 insertions(+), 11 deletions(-) diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index 01cb4a4613..34bc3c0f19 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=basic %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -analyzer-constraints=range %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=basic -verify -fobjc-gc -disable-free %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=basic -verify -fobjc-gc %s -Wno-implicit-function-declaration +// RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -checker-cfref -analyzer-store=region -analyzer-constraints=range -verify -fobjc-gc %s -Wno-implicit-function-declaration //===----------------------------------------------------------------------===// // The following code is reduced using delta-debugging from @@ -36,6 +36,8 @@ static __inline__ __attribute__((always_inline)) id NSMakeCollectable(CFTypeRef // Test cases. //===----------------------------------------------------------------------===// +CFAbsoluteTime CFAbsoluteTimeGetCurrent(); + CFAbsoluteTime f1_use_after_release() { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); diff --git a/test/Analysis/PR2599.m b/test/Analysis/PR2599.m index e866ee6cb2..d26096129e 100644 --- a/test/Analysis/PR2599.m +++ b/test/Analysis/PR2599.m @@ -53,6 +53,8 @@ extern NSString * const NSXMLParserErrorDomain ; static char *lorem = "fooBarBaz"; +void NSLog(NSString *, ...); + int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *tmp1 = NSSTRINGWRAPPER(lorem, 6); // no-warning diff --git a/test/Analysis/casts.c b/test/Analysis/casts.c index 96c0226a00..4b72916171 100644 --- a/test/Analysis/casts.c +++ b/test/Analysis/casts.c @@ -11,6 +11,8 @@ typedef __darwin_socklen_t socklen_t; struct sockaddr { sa_family_t sa_family; }; struct sockaddr_storage {}; +void getsockname(); + void f(int sock) { struct sockaddr_storage storage; struct sockaddr* sockaddr = (struct sockaddr*)&storage; diff --git a/test/Analysis/dead-stores.c b/test/Analysis/dead-stores.c index 63c9d0d97a..91f2b2afeb 100644 --- a/test/Analysis/dead-stores.c +++ b/test/Analysis/dead-stores.c @@ -17,6 +17,8 @@ void f2(void *b) { // expected-note{{please include the header or explicitly provide a declaration for 'printf'}} } +int f(); + void f3() { int r; if ((r = f()) != 0) { // no-warning diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index 7f29c99a44..06114c2ab0 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -55,7 +55,7 @@ void checkaccess_union() { // Check our handling of fields being invalidated by function calls. struct test2_struct { int x; int y; char* s; }; -void test2_helper(struct test2_struct* p); +void test2_help(struct test2_struct* p); char test2() { struct test2_struct s; @@ -387,7 +387,7 @@ void rdar_7332673_test1() { char value[1]; if ( *(value) != 1 ) {} // expected-warning{{The left operand of '!=' is a garbage value}} } -void rdar_rdar_7332673_test2_aux(char *x); +int rdar_7332673_test2_aux(char *x); void rdar_7332673_test2() { char *value; if ( rdar_7332673_test2_aux(value) != 1 ) {} // expected-warning{{Pass-by-value argument in function call is undefined}} @@ -631,7 +631,7 @@ typedef void (^RDar_7462324_Callback)(id obj); //===----------------------------------------------------------------------===// int rdar7468209_aux(); -void rdar7468209_aux2(); +void rdar7468209_aux_2(); void rdar7468209() { __block int x = 0; diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 53b9b6f4fa..29a27ed623 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -460,6 +460,8 @@ void test_block_cast() { (void (^)(void *))test_block_cast_aux(); // expected-warning{{expression result unused}} } +int OSAtomicCompareAndSwap32Barrier(); + // Test comparison of 'id' instance variable to a null void* constant after // performing an OSAtomicCompareAndSwap32Barrier. // This previously was a crash in RegionStoreManager. @@ -493,6 +495,8 @@ void test_invalidate_cast_int() { return; } +int ivar_getOffset(); + // Reduced from a crash involving the cast of an Objective-C symbolic region to // 'char *' static NSNumber *test_ivar_offset(id self, SEL _cmd, Ivar inIvar) { diff --git a/test/Analysis/rdar-6442306-1.m b/test/Analysis/rdar-6442306-1.m index 1eae5d779d..b3558a6321 100644 --- a/test/Analysis/rdar-6442306-1.m +++ b/test/Analysis/rdar-6442306-1.m @@ -13,6 +13,8 @@ typedef struct { QuxSize size; } __Request__SetPortalSize_t; +double __Foo_READSWAP__double(double*); + static __inline__ bar_return_t __Beeble_check__Request__SetPortalSize_t(__attribute__((__unused__)) __Request__SetPortalSize_t *In0P) { if (In0P->Foo.int_rep != Foo_record.int_rep) { diff --git a/test/Analysis/retain-release-basic-store.m b/test/Analysis/retain-release-basic-store.m index 58321bb388..2ef061a998 100644 --- a/test/Analysis/retain-release-basic-store.m +++ b/test/Analysis/retain-release-basic-store.m @@ -86,6 +86,8 @@ struct foo { NSDate* f; }; +CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); + CFAbsoluteTime f4() { struct foo x; diff --git a/test/Analysis/retain-release-region-store.m b/test/Analysis/retain-release-region-store.m index 35dc6e7110..3a0142b295 100644 --- a/test/Analysis/retain-release-region-store.m +++ b/test/Analysis/retain-release-region-store.m @@ -93,6 +93,8 @@ typedef unsigned long NSUInteger; // Test to see if we *issue* an error when we store the pointer // to a struct. This differs from basic store. +CFAbsoluteTime CFAbsoluteTimeGetCurrent(void); + struct foo { NSDate* f; }; diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index f5d985ebd4..691e2a2f58 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -881,6 +881,8 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort, // Test of handling objects whose references "escape" to containers. //===----------------------------------------------------------------------===// +void CFDictionaryAddValue(); + // void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) { CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); diff --git a/test/Analysis/uninit-vals-ps-region.c b/test/Analysis/uninit-vals-ps-region.c index ce86ad0532..216856e549 100644 --- a/test/Analysis/uninit-vals-ps-region.c +++ b/test/Analysis/uninit-vals-ps-region.c @@ -20,6 +20,7 @@ void f4() { // Test uninitialized value due to part of the structure being uninitialized. struct TestUninit { int x; int y; }; struct TestUninit test_uninit_aux(); +void test_unit_aux2(int); void test_uninit_pos() { struct TestUninit v1 = { 0, 0 }; struct TestUninit v2 = test_uninit_aux(); diff --git a/test/Lexer/numeric-literal-trash.c b/test/Lexer/numeric-literal-trash.c index 1d7c87bfbf..5407ba9824 100644 --- a/test/Lexer/numeric-literal-trash.c +++ b/test/Lexer/numeric-literal-trash.c @@ -4,7 +4,7 @@ - +int ec(int, int); void x() { diff --git a/test/Sema/attr-noreturn.c b/test/Sema/attr-noreturn.c index 0966989bf9..3f064a01c8 100644 --- a/test/Sema/attr-noreturn.c +++ b/test/Sema/attr-noreturn.c @@ -2,6 +2,8 @@ static void (*fp0)(void) __attribute__((noreturn)); +void fatal(); + static void __attribute__((noreturn)) f0(void) { fatal(); } // expected-warning {{function declared 'noreturn' should not return}} diff --git a/test/Sema/block-labels.c b/test/Sema/block-labels.c index af364b4f86..353a5702ea 100644 --- a/test/Sema/block-labels.c +++ b/test/Sema/block-labels.c @@ -1,5 +1,7 @@ // RUN: %clang_cc1 %s -verify -fblocks -fsyntax-only +void xx(); + int a() { A:if (1) xx(); return ^{A:return 1;}(); diff --git a/test/Sema/block-misc.c b/test/Sema/block-misc.c index c1a2f08ff7..52cebfe892 100644 --- a/test/Sema/block-misc.c +++ b/test/Sema/block-misc.c @@ -64,6 +64,7 @@ int test4(int argc) { // rdar://6251437 } +void bar(void*); // rdar://6257721 - reference to static/global is byref by default. static int test5g; void test5() { @@ -157,6 +158,8 @@ void test16(__block int i) { // expected-error {{__block attribute not allowed, __block int (*ap)[size]; // expected-error {{__block attribute not allowed on declaration with a variably modified type}} } +void f(); + void test17() { void (^bp)(int); void (*rp)(int); diff --git a/test/Sema/block-return.c b/test/Sema/block-return.c index 4240b09856..6416545cb7 100644 --- a/test/Sema/block-return.c +++ b/test/Sema/block-return.c @@ -76,6 +76,7 @@ static int funk(char *s) { else return 0; } +void next(); void foo4() { int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(char *)', expected 'int (^)(char const *)'}} int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (char *)', expected 'int (*)(char const *)'}} diff --git a/test/Sema/conditional.c b/test/Sema/conditional.c index e67580ace6..c3dbe1321b 100644 --- a/test/Sema/conditional.c +++ b/test/Sema/conditional.c @@ -3,6 +3,7 @@ const char* test1 = 1 ? "i" : 1 == 1 ? "v" : "r"; void _efree(void *ptr); +void free(void *ptr); int _php_stream_free1() { return (1 ? free(0) : _efree(0)); // expected-error {{incompatible type returning 'void', expected 'int'}} diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 67081b5e26..20e4dcd97f 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -8,6 +8,7 @@ int printf(const char *restrict, ...); int snprintf(char *restrict, size_t, const char *restrict, ...); int sprintf(char *restrict, const char *restrict, ...); int vasprintf(char **, const char *, va_list); +int asprintf(char **, const char *, ...); int vfprintf(FILE *, const char *restrict, va_list); int vprintf(const char *restrict, va_list); int vsnprintf(char *, size_t, const char *, va_list); diff --git a/test/Sema/implicit-builtin-decl.c b/test/Sema/implicit-builtin-decl.c index 09ecd23ca1..3d920389a2 100644 --- a/test/Sema/implicit-builtin-decl.c +++ b/test/Sema/implicit-builtin-decl.c @@ -22,7 +22,8 @@ void h() { } void f2() { - fprintf(0, "foo"); // expected-error{{implicit declaration of 'fprintf' requires inclusion of the header }} + fprintf(0, "foo"); // expected-error{{implicit declaration of 'fprintf' requires inclusion of the header }} \ + expected-warning {{implicit declaration of function 'fprintf' is invalid in C99}} } // PR2892 diff --git a/test/Sema/implicit-decl.c b/test/Sema/implicit-decl.c index fc48895f4e..830cde9b9f 100644 --- a/test/Sema/implicit-decl.c +++ b/test/Sema/implicit-decl.c @@ -7,7 +7,8 @@ void func() { int32_t *vector[16]; const char compDesc[16 + 1]; int32_t compCount = 0; - if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} + if (_CFCalendarDecomposeAbsoluteTimeV(compDesc, vector, compCount)) { // expected-note {{previous implicit declaration is here}} \ + expected-warning {{implicit declaration of function '_CFCalendarDecomposeAbsoluteTimeV' is invalid in C99}} } return ((void *)0); // expected-warning {{void function 'func' should not return a value}} } diff --git a/test/SemaObjC/bad-receiver-1.m b/test/SemaObjC/bad-receiver-1.m index 094c12f7d8..33e1630864 100644 --- a/test/SemaObjC/bad-receiver-1.m +++ b/test/SemaObjC/bad-receiver-1.m @@ -4,6 +4,8 @@ - (id) retain; @end +int objc_lookUpClass(const char*); + void __raiseExc1() { [objc_lookUpClass("NSString") retain]; // expected-warning {{receiver type 'int' is not 'id'}} \ expected-warning {{method '-retain' not found}} diff --git a/test/SemaObjC/ivar-access-package.m b/test/SemaObjC/ivar-access-package.m index 956ae5bdb6..abc3420f1b 100644 --- a/test/SemaObjC/ivar-access-package.m +++ b/test/SemaObjC/ivar-access-package.m @@ -34,6 +34,8 @@ typedef unsigned char BOOL; } @end +void NSLog(id, ...); + int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; A *a = [[A new] autorelease]; diff --git a/test/SemaObjC/nonnull.m b/test/SemaObjC/nonnull.m index c96a91a7f8..642f50f9e4 100644 --- a/test/SemaObjC/nonnull.m +++ b/test/SemaObjC/nonnull.m @@ -19,6 +19,9 @@ __attribute__((nonnull(1,3))); extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1))) __attribute__((nonnull(2))); +void func6(); +void func7(); + void foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)()) { diff --git a/test/SemaObjC/protocol-archane.m b/test/SemaObjC/protocol-archane.m index 108a72988e..138c43d1a8 100644 --- a/test/SemaObjC/protocol-archane.m +++ b/test/SemaObjC/protocol-archane.m @@ -5,6 +5,7 @@ - (void) bar; @end +void bar(); void foo(id x) { bar((short)x); // expected-error {{expected ')'}} expected-note {{to match this '('}} bar(()x); // expected-warning {{protocol qualifiers without 'id' is archaic}} -- 2.50.1