зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
7960ec30d7
Коммит
e030358cc0
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -17,6 +17,8 @@ void f2(void *b) {
|
|||
// expected-note{{please include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
|
||||
}
|
||||
|
||||
int f();
|
||||
|
||||
void f3() {
|
||||
int r;
|
||||
if ((r = f()) != 0) { // no-warning
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -86,6 +86,8 @@ struct foo {
|
|||
NSDate* f;
|
||||
};
|
||||
|
||||
CFAbsoluteTime CFAbsoluteTimeGetCurrent(void);
|
||||
|
||||
CFAbsoluteTime f4() {
|
||||
struct foo x;
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -881,6 +881,8 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
|
|||
// Test of handling objects whose references "escape" to containers.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
void CFDictionaryAddValue();
|
||||
|
||||
// <rdar://problem/6539791>
|
||||
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
|
||||
CFMutableDictionaryRef x = CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
int ec(int, int);
|
||||
|
||||
|
||||
void x() {
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// RUN: %clang_cc1 %s -verify -fblocks -fsyntax-only
|
||||
|
||||
void xx();
|
||||
|
||||
int a() {
|
||||
A:if (1) xx();
|
||||
return ^{A:return 1;}();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 *)'}}
|
||||
|
|
|
@ -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'}}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -22,7 +22,8 @@ void h() {
|
|||
}
|
||||
|
||||
void f2() {
|
||||
fprintf(0, "foo"); // expected-error{{implicit declaration of 'fprintf' requires inclusion of the header <stdio.h>}}
|
||||
fprintf(0, "foo"); // expected-error{{implicit declaration of 'fprintf' requires inclusion of the header <stdio.h>}} \
|
||||
expected-warning {{implicit declaration of function 'fprintf' is invalid in C99}}
|
||||
}
|
||||
|
||||
// PR2892
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
|
|
|
@ -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}}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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)())
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
- (void) bar;
|
||||
@end
|
||||
|
||||
void bar();
|
||||
void foo(id x) {
|
||||
bar((short<SomeProtocol>)x); // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
bar((<SomeProtocol>)x); // expected-warning {{protocol qualifiers without 'id' is archaic}}
|
||||
|
|
Загрузка…
Ссылка в новой задаче