Author: Aaron Ballman Date: 2022-02-17T15:33:50-05:00 New Revision: f5b85f15510db409277d8492524b2fc040e776d8
URL: https://github.com/llvm/llvm-project/commit/f5b85f15510db409277d8492524b2fc040e776d8 DIFF: https://github.com/llvm/llvm-project/commit/f5b85f15510db409277d8492524b2fc040e776d8.diff LOG: Use functions with prototypes when appropriate; NFC Now that the AST printer properly handles functions with no parameters in C code, all of the tests relying on AST printing can be updated to use prototypes where appropriate. Added: Modified: clang/test/ARCMT/GC-check-warn-nsalloc.m clang/test/ARCMT/autoreleases.m clang/test/ARCMT/autoreleases.m.result clang/test/ARCMT/checking.m clang/test/ARCMT/nonobjc-to-objc-cast-2.m clang/test/ARCMT/objcmt-arc-cf-annotations.m clang/test/ARCMT/objcmt-arc-cf-annotations.m.result clang/test/ARCMT/objcmt-instancetype.m clang/test/ARCMT/objcmt-instancetype.m.result clang/test/ARCMT/objcmt-property-dot-syntax.m clang/test/ARCMT/objcmt-property-dot-syntax.m.result clang/test/ARCMT/objcmt-subscripting-literals.m clang/test/ARCMT/objcmt-subscripting-literals.m.result clang/test/ARCMT/objcmt-with-pch.m clang/test/ARCMT/objcmt-with-pch.m.result clang/test/ARCMT/releases-driver.m clang/test/ARCMT/releases-driver.m.result clang/test/ARCMT/releases.m clang/test/ARCMT/releases.m.result clang/test/ARCMT/retains.m clang/test/ARCMT/retains.m.result clang/test/ARCMT/rewrite-block-var.m clang/test/ARCMT/rewrite-block-var.m.result clang/test/Sema/ast-print.c Removed: ################################################################################ diff --git a/clang/test/ARCMT/GC-check-warn-nsalloc.m b/clang/test/ARCMT/GC-check-warn-nsalloc.m index af17c1d69c5f3..26ead5f6a0907 100644 --- a/clang/test/ARCMT/GC-check-warn-nsalloc.m +++ b/clang/test/ARCMT/GC-check-warn-nsalloc.m @@ -6,6 +6,6 @@ typedef unsigned NSUInteger; void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options); -void test1() { +void test1(void) { NSAllocateCollectable(100, 0); } diff --git a/clang/test/ARCMT/autoreleases.m b/clang/test/ARCMT/autoreleases.m index 91413e51ca66f..4c268c09a715c 100644 --- a/clang/test/ARCMT/autoreleases.m +++ b/clang/test/ARCMT/autoreleases.m @@ -69,7 +69,7 @@ id test2(A* val) { return val; } -id test3() { +id test3(void) { id a = [[A alloc] init]; [a autorelease]; } diff --git a/clang/test/ARCMT/autoreleases.m.result b/clang/test/ARCMT/autoreleases.m.result index 32c7ad3c39710..b3aad804a45be 100644 --- a/clang/test/ARCMT/autoreleases.m.result +++ b/clang/test/ARCMT/autoreleases.m.result @@ -64,6 +64,6 @@ id test2(A* val) { return val; } -id test3() { +id test3(void) { id a = [[A alloc] init]; } diff --git a/clang/test/ARCMT/checking.m b/clang/test/ARCMT/checking.m index bf08ceaa6fe2a..0c69a7ffaad60 100644 --- a/clang/test/ARCMT/checking.m +++ b/clang/test/ARCMT/checking.m @@ -124,7 +124,7 @@ -(id)alloc; - (id)initWithInt: (int) i; @end -void rdar8861761() { +void rdar8861761(void) { B *o1 = [[B alloc] initWithInt:0]; B *o2 = [B alloc]; [o2 initWithInt:0]; diff --git a/clang/test/ARCMT/nonobjc-to-objc-cast-2.m b/clang/test/ARCMT/nonobjc-to-objc-cast-2.m index 2e308a87ba838..b8f562f8a42dd 100644 --- a/clang/test/ARCMT/nonobjc-to-objc-cast-2.m +++ b/clang/test/ARCMT/nonobjc-to-objc-cast-2.m @@ -49,7 +49,7 @@ void f2(NSString *s) { // expected-note{{use CFBridgingRetain call to make an ARC object available as a +1 'CFStringRef' (aka 'const struct __CFString *')}} } -CFStringRef f3() { +CFStringRef f3(void) { return (CFStringRef)[[[NSString alloc] init] autorelease]; // expected-error {{it is not safe to cast to 'CFStringRef' the result of 'autorelease' message; a __bridge cast may result in a pointer to a destroyed object and a __bridge_retained may leak the object}} \ // expected-note {{remove the cast and change return type of function to 'NSString *' to have the object automatically autoreleased}} } diff --git a/clang/test/ARCMT/objcmt-arc-cf-annotations.m b/clang/test/ARCMT/objcmt-arc-cf-annotations.m index e33b8801cd4dc..221a8a9e7d4d0 100644 --- a/clang/test/ARCMT/objcmt-arc-cf-annotations.m +++ b/clang/test/ARCMT/objcmt-arc-cf-annotations.m @@ -335,7 +335,7 @@ + (id)array; // Test cases. //===----------------------------------------------------------------------===// -CFAbsoluteTime f1() { +CFAbsoluteTime f1(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); CFRetain(date); @@ -346,7 +346,7 @@ CFAbsoluteTime f1() { return t; } -CFAbsoluteTime f2() { +CFAbsoluteTime f2(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); [((NSDate*) date) retain]; @@ -363,7 +363,7 @@ CFAbsoluteTime f2() { // Test to see if we suppress an error when we store the pointer // to a global. -CFAbsoluteTime f3() { +CFAbsoluteTime f3(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); [((NSDate*) date) retain]; @@ -402,7 +402,7 @@ CFDateRef f6(int x) { // Test a leak involving an overwrite. -CFDateRef f7() { +CFDateRef f7(void) { CFDateRef date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); //expected-warning{{leak}} CFRetain(date); date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); // expected-warning {{leak}} @@ -411,15 +411,15 @@ CFDateRef f7() { // Generalization of Create rule. MyDateCreate returns a CFXXXTypeRef, and // has the word create. -CFDateRef MyDateCreate(); +CFDateRef MyDateCreate(void); -CFDateRef f8() { +CFDateRef f8(void) { CFDateRef date = MyDateCreate(); // expected-warning{{leak}} CFRetain(date); return date; } -__attribute__((cf_returns_retained)) CFDateRef f9() { +__attribute__((cf_returns_retained)) CFDateRef f9(void) { CFDateRef date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); // no-warning int *p = 0; // When allocations fail, CFDateCreate can return null. @@ -453,7 +453,7 @@ void f10(io_service_t media, DADiskRef d, CFStringRef s) { } // Test retain/release checker with CFString and CFMutableArray. -void f11() { +void f11(void) { // Create the array. CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); @@ -478,32 +478,32 @@ void f11() { } // PR 3337: Handle functions declared using typedefs. -typedef CFTypeRef CREATEFUN(); -CFTypeRef MyCreateFun(); +typedef CFTypeRef CREATEFUN(void); +CFTypeRef MyCreateFun(void); -void f12() { +void f12(void) { CFTypeRef o = MyCreateFun(); // expected-warning {{leak}} } -void f13_autorelease() { +void f13_autorelease(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning [(id) A autorelease]; // no-warning } -void f13_autorelease_b() { +void f13_autorelease_b(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; } // expected-warning{{Object autoreleased too many times}} -CFMutableArrayRef f13_autorelease_c() { +CFMutableArrayRef f13_autorelease_c(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; return A; // expected-warning{{Object autoreleased too many times}} } -CFMutableArrayRef f13_autorelease_d() { +CFMutableArrayRef f13_autorelease_d(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; @@ -514,13 +514,13 @@ CFMutableArrayRef f13_autorelease_d() { // This case exercises the logic where the leak site is the same as the allocation site. -void f14_leakimmediately() { +void f14_leakimmediately(void) { CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{leak}} } // Test that we track an allocated object beyond the point where the *name* // of the variable storing the reference is no longer live. -void f15() { +void f15(void) { // Create the array. CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); CFMutableArrayRef *B = &A; @@ -751,7 +751,7 @@ - (void)radar10102244 { // <rdar://problem/6257780> clang checker fails to catch use-after-release //===----------------------------------------------------------------------===// -int rdar_6257780_Case1() { +int rdar_6257780_Case1(void) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSArray *array = [NSArray array]; [array release]; // expected-warning{{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} @@ -763,7 +763,7 @@ int rdar_6257780_Case1() { // <rdar://problem/10640253> Analyzer is confused about NSAutoreleasePool -allocWithZone:. //===----------------------------------------------------------------------===// -void rdar_10640253_autorelease_allocWithZone() { +void rdar_10640253_autorelease_allocWithZone(void) { NSAutoreleasePool *pool = [[NSAutoreleasePool allocWithZone:(NSZone*)0] init]; (void) pool; } @@ -772,7 +772,7 @@ void rdar_10640253_autorelease_allocWithZone() { // <rdar://problem/6866843> Checker should understand new/setObject:/release constructs //===----------------------------------------------------------------------===// -void rdar_6866843() { +void rdar_6866843(void) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init]; NSArray* array = [[NSArray alloc] init]; @@ -844,7 +844,7 @@ - (id)initReturningNewClassBad2 { @implementation RDar6320065Subclass @end -int RDar6320065_test() { +int RDar6320065_test(void) { RDar6320065 *test = [[RDar6320065 alloc] init]; // no-warning [test release]; return 0; @@ -976,7 +976,7 @@ void IOServiceNameMatching_wrapper(const char * name) { IOServiceNameMatching(name); // expected-warning{{leak}} } -CF_RETURNS_RETAINED CFDictionaryRef CreateDict(); +CF_RETURNS_RETAINED CFDictionaryRef CreateDict(void); void IOServiceAddNotification_wrapper(mach_port_t mainPort, const io_name_t notificationType, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) { @@ -1367,25 +1367,25 @@ void test_attr1c(TestOwnershipAttr *X) { NSString *str4 = [[X newString_auto] retain]; // expected-warning {{leak}} } -void testattr2_a() { +void testattr2_a(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // expected-warning{{leak}} } -void testattr2_b() { +void testattr2_b(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // expected-warning{{leak}} } -void testattr2_b_11358224_self_assign_looses_the_leak() { +void testattr2_b_11358224_self_assign_looses_the_leak(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit];// expected-warning{{leak}} x = x; } -void testattr2_c() { +void testattr2_c(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // no-warning [x release]; } -void testattr3() { +void testattr3(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning [TestOwnershipAttr consume:x]; TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning @@ -1395,7 +1395,7 @@ void testattr3() { void consume_ns(id NS_CONSUMED x); void consume_cf(id CF_CONSUMED x); -void testattr4() { +void testattr4(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning consume_ns(x); TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning @@ -1423,7 +1423,7 @@ - (NSDate*) returnsNSRetained NS_RETURNS_RETAINED; @end CF_RETURNS_RETAINED -CFDateRef returnsRetainedCFDate() { +CFDateRef returnsRetainedCFDate(void) { return CFDateCreate(0, CFAbsoluteTimeGetCurrent()); } @@ -1465,15 +1465,15 @@ - (NSDate*) returnsNSRetained { // to a noreturn or panic function //===----------------------------------------------------------------------===// -void panic() __attribute__((noreturn)); -void panic_not_in_hardcoded_list() __attribute__((noreturn)); +void panic(void) __attribute__((noreturn)); +void panic_not_in_hardcoded_list(void) __attribute__((noreturn)); -void test_panic_negative() { +void test_panic_negative(void) { signed z = 1; CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z); // expected-warning{{leak}} } -void test_panic_positive() { +void test_panic_positive(void) { signed z = 1; CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z); // no-warning panic(); @@ -1545,8 +1545,8 @@ - (id)retain { // detector. @protocol Prot_R8272168 @end -Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(); -void r8272168() { +Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(void); +void r8272168(void) { GetAClassThatImplementsProt_R8272168(); } @@ -1596,7 +1596,7 @@ static void rdar_8724287(CFErrorRef error) // correctly in argument positions besides the first. extern void *CFStringCreate(void); extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value); -void rdar_9234108() { +void rdar_9234108(void) { rdar_9234108_helper(0, CFStringCreate()); } @@ -1619,7 +1619,7 @@ - (id)_prefix_initWithTwoDoubles:(TwoDoubles)twoDoubles } @end -void rdar9726279() { +void rdar9726279(void) { TwoDoubles twoDoubles = { 0.0, 0.0 }; NSValue *value = [[NSValue alloc] _prefix_initWithTwoDoubles:twoDoubles]; [value release]; @@ -1628,52 +1628,52 @@ void rdar9726279() { // <rdar://problem/9732321> // Test camelcase support for CF conventions. While Core Foundation APIs // don't use camel casing, other code is allowed to use it. -CFArrayRef camelcase_create_1() { +CFArrayRef camelcase_create_1(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camelcase_createno() { +CFArrayRef camelcase_createno(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef camelcase_copy() { +CFArrayRef camelcase_copy(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camelcase_copying() { +CFArrayRef camelcase_copying(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef copyCamelCase() { +CFArrayRef copyCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef __copyCamelCase() { +CFArrayRef __copyCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef __createCamelCase() { +CFArrayRef __createCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_create() { +CFArrayRef camel_create(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_creat() { +CFArrayRef camel_creat(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef camel_copy() { +CFArrayRef camel_copy(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_copyMachine() { +CFArrayRef camel_copyMachine(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_copymachine() { +CFArrayRef camel_copymachine(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } @@ -1708,7 +1708,7 @@ void rdar6582778_2(void) { // <rdar://problem/10232019> - Test that objects passed to containers // are marked "escaped". -void rdar10232019() { +void rdar10232019(void) { NSMutableArray *array = [NSMutableArray array]; NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; @@ -1719,7 +1719,7 @@ void rdar10232019() { NSLog(@"%@", otherString); } -void rdar10232019_positive() { +void rdar10232019_positive(void) { NSMutableArray *array = [NSMutableArray array]; NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; @@ -1735,7 +1735,7 @@ void rdar10232019_positive() { xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf); void xpc_release(xpc_object_t object); -void rdar9658496() { +void rdar9658496(void) { CFStringRef cf; xpc_object_t xpc; cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning @@ -1756,7 +1756,7 @@ - (id)initWithObj:(id)obj { } @end -void rdar_10824732() { +void rdar_10824732(void) { @autoreleasepool { NSString *obj = @"test"; RDar10824732 *foo = [[RDar10824732 alloc] initWithObj:obj]; // no-warning @@ -1832,14 +1832,14 @@ - (id)copyAutoreleaseRadar13081402 { //===----------------------------------------------------------------------===// void *malloc(size_t); struct rdar11104566 { CFStringRef myStr; }; -struct rdar11104566 test_rdar11104566() { +struct rdar11104566 test_rdar11104566(void) { CFStringRef cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning struct rdar11104566 V; V.myStr = cf; return V; // no-warning } -struct rdar11104566 *test_2_rdar11104566() { +struct rdar11104566 *test_2_rdar11104566(void) { CFStringRef cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning struct rdar11104566 *V = (struct rdar11104566 *) malloc(sizeof(*V)); V->myStr = cf; @@ -1850,7 +1850,7 @@ struct rdar11104566 test_rdar11104566() { // ObjC literals support. //===----------------------------------------------------------------------===// -void test_objc_arrays() { +void test_objc_arrays(void) { { // CASE ONE -- OBJECT IN ARRAY CREATED DIRECTLY NSObject *o = [[NSObject alloc] init]; NSArray *a = [[NSArray alloc] initWithObjects:o, (void*)0]; // expected-warning {{leak}} @@ -1895,7 +1895,7 @@ void test_objc_arrays() { } } -void test_objc_integer_literals() { +void test_objc_integer_literals(void) { id value = [@1 retain]; // expected-warning {{leak}} [value description]; } @@ -1923,8 +1923,8 @@ void rdar11400885(int y) } } -id makeCollectableNonLeak() { - extern CFTypeRef CFCreateSomething(); +id makeCollectableNonLeak(void) { + extern CFTypeRef CFCreateSomething(void); CFTypeRef object = CFCreateSomething(); // +1 CFRetain(object); // +2 @@ -1937,7 +1937,7 @@ id makeCollectableNonLeak() { void consumeAndStopTracking(id NS_CONSUMED obj, void (^callback)(void)); void CFConsumeAndStopTracking(CFTypeRef CF_CONSUMED obj, void (^callback)(void)); -void testConsumeAndStopTracking() { +void testConsumeAndStopTracking(void) { id retained = [@[] retain]; // +1 consumeAndStopTracking(retained, ^{}); // no-warning @@ -1950,7 +1950,7 @@ void testConsumeAndStopTracking() { consumeAndStopTracking(unretained, ^{}); // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} } -void testCFConsumeAndStopTracking() { +void testCFConsumeAndStopTracking(void) { id retained = [@[] retain]; // +1 CFConsumeAndStopTracking((CFTypeRef)retained, ^{}); // no-warning @@ -1968,10 +1968,10 @@ void testCFConsumeAndStopTracking() { typedef void *MyCFType; #pragma clang arc_cf_code_audited begin -MyCFType CreateMyCFType(); +MyCFType CreateMyCFType(void); #pragma clang arc_cf_code_audited end -void test_custom_cf() { +void test_custom_cf(void) { MyCFType x = CreateMyCFType(); // expected-warning {{leak of an object stored into 'x'}} } @@ -1992,7 +1992,7 @@ @interface PR14927 : NSObject - (void)drain; @end -void test_drain() { +void test_drain(void) { PR14927 *obj = [[PR14927 alloc] init]; [obj drain]; [obj release]; // no-warning @@ -2003,14 +2003,14 @@ void test_drain() { // value as tracked, even if the object isn't a known CF type. //===----------------------------------------------------------------------===// -MyCFType getCustom() __attribute__((cf_returns_not_retained)); -MyCFType makeCustom() __attribute__((cf_returns_retained)); +MyCFType getCustom(void) __attribute__((cf_returns_not_retained)); +MyCFType makeCustom(void) __attribute__((cf_returns_retained)); -void testCustomReturnsRetained() { +void testCustomReturnsRetained(void) { MyCFType obj = makeCustom(); // expected-warning {{leak of an object stored into 'obj'}} } -void testCustomReturnsNotRetained() { +void testCustomReturnsNotRetained(void) { CFRelease(getCustom()); // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} } diff --git a/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result b/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result index d3e56a14eca5d..6621b10ef5d50 100644 --- a/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result +++ b/clang/test/ARCMT/objcmt-arc-cf-annotations.m.result @@ -365,7 +365,7 @@ void *CFPlugInInstanceCreate(CFAllocatorRef allocator, CFUUIDRef factoryUUID, CF // Test cases. //===----------------------------------------------------------------------===// -CFAbsoluteTime f1() { +CFAbsoluteTime f1(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); CFRetain(date); @@ -376,7 +376,7 @@ CFAbsoluteTime f1() { return t; } -CFAbsoluteTime f2() { +CFAbsoluteTime f2(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); [((NSDate*) date) retain]; @@ -393,7 +393,7 @@ NSDate* global_x; // Test to see if we suppress an error when we store the pointer // to a global. -CFAbsoluteTime f3() { +CFAbsoluteTime f3(void) { CFAbsoluteTime t = CFAbsoluteTimeGetCurrent(); CFDateRef date = CFDateCreate(0, t); [((NSDate*) date) retain]; @@ -432,7 +432,7 @@ CFDateRef f6(int x) { // Test a leak involving an overwrite. -CFDateRef f7() { +CFDateRef f7(void) { CFDateRef date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); //expected-warning{{leak}} CFRetain(date); date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); // expected-warning {{leak}} @@ -444,18 +444,18 @@ CFDateRef f7() { CF_IMPLICIT_BRIDGING_ENABLED -CFDateRef MyDateCreate(); +CFDateRef MyDateCreate(void); CF_IMPLICIT_BRIDGING_DISABLED -CFDateRef f8() { +CFDateRef f8(void) { CFDateRef date = MyDateCreate(); // expected-warning{{leak}} CFRetain(date); return date; } -__attribute__((cf_returns_retained)) CFDateRef f9() { +__attribute__((cf_returns_retained)) CFDateRef f9(void) { CFDateRef date = CFDateCreate(0, CFAbsoluteTimeGetCurrent()); // no-warning int *p = 0; // When allocations fail, CFDateCreate can return null. @@ -489,7 +489,7 @@ void f10(io_service_t media, DADiskRef d, CFStringRef s) { } // Test retain/release checker with CFString and CFMutableArray. -void f11() { +void f11(void) { // Create the array. CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); @@ -514,38 +514,38 @@ void f11() { } // PR 3337: Handle functions declared using typedefs. -typedef CFTypeRef CREATEFUN(); +typedef CFTypeRef CREATEFUN(void); CF_IMPLICIT_BRIDGING_ENABLED -CFTypeRef MyCreateFun(); +CFTypeRef MyCreateFun(void); CF_IMPLICIT_BRIDGING_DISABLED -void f12() { +void f12(void) { CFTypeRef o = MyCreateFun(); // expected-warning {{leak}} } -void f13_autorelease() { +void f13_autorelease(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning [(id) A autorelease]; // no-warning } -void f13_autorelease_b() { +void f13_autorelease_b(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; } // expected-warning{{Object autoreleased too many times}} -CFMutableArrayRef f13_autorelease_c() { +CFMutableArrayRef f13_autorelease_c(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; return A; // expected-warning{{Object autoreleased too many times}} } -CFMutableArrayRef f13_autorelease_d() { +CFMutableArrayRef f13_autorelease_d(void) { CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); [(id) A autorelease]; [(id) A autorelease]; @@ -556,13 +556,13 @@ CFMutableArrayRef f13_autorelease_d() { // This case exercises the logic where the leak site is the same as the allocation site. -void f14_leakimmediately() { +void f14_leakimmediately(void) { CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{leak}} } // Test that we track an allocated object beyond the point where the *name* // of the variable storing the reference is no longer live. -void f15() { +void f15(void) { // Create the array. CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); CFMutableArrayRef *B = &A; @@ -793,7 +793,7 @@ void rdar6704930(unsigned char *s, unsigned int length) { // <rdar://problem/6257780> clang checker fails to catch use-after-release //===----------------------------------------------------------------------===// -int rdar_6257780_Case1() { +int rdar_6257780_Case1(void) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSArray *array = [NSArray array]; [array release]; // expected-warning{{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} @@ -805,7 +805,7 @@ int rdar_6257780_Case1() { // <rdar://problem/10640253> Analyzer is confused about NSAutoreleasePool -allocWithZone:. //===----------------------------------------------------------------------===// -void rdar_10640253_autorelease_allocWithZone() { +void rdar_10640253_autorelease_allocWithZone(void) { NSAutoreleasePool *pool = [[NSAutoreleasePool allocWithZone:(NSZone*)0] init]; (void) pool; } @@ -814,7 +814,7 @@ void rdar_10640253_autorelease_allocWithZone() { // <rdar://problem/6866843> Checker should understand new/setObject:/release constructs //===----------------------------------------------------------------------===// -void rdar_6866843() { +void rdar_6866843(void) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSMutableDictionary* dictionary = [[NSMutableDictionary alloc] init]; NSArray* array = [[NSArray alloc] init]; @@ -886,7 +886,7 @@ typedef CFTypeRef OtherRef; @implementation RDar6320065Subclass @end -int RDar6320065_test() { +int RDar6320065_test(void) { RDar6320065 *test = [[RDar6320065 alloc] init]; // no-warning [test release]; return 0; @@ -1018,7 +1018,7 @@ void IOServiceNameMatching_wrapper(const char * name) { IOServiceNameMatching(name); // expected-warning{{leak}} } -CF_RETURNS_RETAINED CFDictionaryRef CreateDict(); +CF_RETURNS_RETAINED CFDictionaryRef CreateDict(void); void IOServiceAddNotification_wrapper(mach_port_t mainPort, const io_name_t notificationType, mach_port_t wakePort, uintptr_t reference, io_iterator_t * notification ) { @@ -1409,25 +1409,25 @@ void test_attr1c(TestOwnershipAttr *X) { NSString *str4 = [[X newString_auto] retain]; // expected-warning {{leak}} } -void testattr2_a() { +void testattr2_a(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // expected-warning{{leak}} } -void testattr2_b() { +void testattr2_b(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // expected-warning{{leak}} } -void testattr2_b_11358224_self_assign_looses_the_leak() { +void testattr2_b_11358224_self_assign_looses_the_leak(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit];// expected-warning{{leak}} x = x; } -void testattr2_c() { +void testattr2_c(void) { TestOwnershipAttr *x = [[TestOwnershipAttr alloc] pseudoInit]; // no-warning [x release]; } -void testattr3() { +void testattr3(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning [TestOwnershipAttr consume:x]; TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning @@ -1437,7 +1437,7 @@ void testattr3() { void consume_ns(id NS_CONSUMED x); void consume_cf(id CF_CONSUMED x); -void testattr4() { +void testattr4(void) { TestOwnershipAttr *x = [TestOwnershipAttr alloc]; // no-warning consume_ns(x); TestOwnershipAttr *y = [TestOwnershipAttr alloc]; // no-warning @@ -1465,7 +1465,7 @@ void testattr4() { @end CF_RETURNS_RETAINED -CFDateRef returnsRetainedCFDate() { +CFDateRef returnsRetainedCFDate(void) { return CFDateCreate(0, CFAbsoluteTimeGetCurrent()); } @@ -1507,15 +1507,15 @@ CFDateRef returnsRetainedCFDate() { // to a noreturn or panic function //===----------------------------------------------------------------------===// -void panic() __attribute__((noreturn)); -void panic_not_in_hardcoded_list() __attribute__((noreturn)); +void panic(void) __attribute__((noreturn)); +void panic_not_in_hardcoded_list(void) __attribute__((noreturn)); -void test_panic_negative() { +void test_panic_negative(void) { signed z = 1; CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z); // expected-warning{{leak}} } -void test_panic_positive() { +void test_panic_positive(void) { signed z = 1; CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z); // no-warning panic(); @@ -1587,8 +1587,8 @@ void test_blocks_1_indirect_retain_via_call(void) { // detector. @protocol Prot_R8272168 @end -Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(); -void r8272168() { +Class <Prot_R8272168> GetAClassThatImplementsProt_R8272168(void); +void r8272168(void) { GetAClassThatImplementsProt_R8272168(); } @@ -1644,7 +1644,7 @@ extern void *CFStringCreate(void); CF_IMPLICIT_BRIDGING_DISABLED extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value); -void rdar_9234108() { +void rdar_9234108(void) { rdar_9234108_helper(0, CFStringCreate()); } @@ -1667,7 +1667,7 @@ typedef struct TwoDoubles TwoDoubles; } @end -void rdar9726279() { +void rdar9726279(void) { TwoDoubles twoDoubles = { 0.0, 0.0 }; NSValue *value = [[NSValue alloc] _prefix_initWithTwoDoubles:twoDoubles]; [value release]; @@ -1676,52 +1676,52 @@ void rdar9726279() { // <rdar://problem/9732321> // Test camelcase support for CF conventions. While Core Foundation APIs // don't use camel casing, other code is allowed to use it. -CFArrayRef camelcase_create_1() { +CFArrayRef camelcase_create_1(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camelcase_createno() { +CFArrayRef camelcase_createno(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef camelcase_copy() { +CFArrayRef camelcase_copy(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camelcase_copying() { +CFArrayRef camelcase_copying(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef copyCamelCase() { +CFArrayRef copyCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef __copyCamelCase() { +CFArrayRef __copyCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef __createCamelCase() { +CFArrayRef __createCamelCase(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_create() { +CFArrayRef camel_create(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_creat() { +CFArrayRef camel_creat(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } -CFArrayRef camel_copy() { +CFArrayRef camel_copy(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_copyMachine() { +CFArrayRef camel_copyMachine(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning } -CFArrayRef camel_copymachine() { +CFArrayRef camel_copymachine(void) { return CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning {{leak}} } @@ -1756,7 +1756,7 @@ void rdar6582778_2(void) { // <rdar://problem/10232019> - Test that objects passed to containers // are marked "escaped". -void rdar10232019() { +void rdar10232019(void) { NSMutableArray *array = [NSMutableArray array]; NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; @@ -1767,7 +1767,7 @@ void rdar10232019() { NSLog(@"%@", otherString); } -void rdar10232019_positive() { +void rdar10232019_positive(void) { NSMutableArray *array = [NSMutableArray array]; NSString *string = [[NSString alloc] initWithUTF8String:"foo"]; @@ -1783,7 +1783,7 @@ typedef void * xpc_object_t; xpc_object_t _CFXPCCreateXPCObjectFromCFObject(CFTypeRef cf); void xpc_release(xpc_object_t object); -void rdar9658496() { +void rdar9658496(void) { CFStringRef cf; xpc_object_t xpc; cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning @@ -1804,7 +1804,7 @@ void rdar9658496() { } @end -void rdar_10824732() { +void rdar_10824732(void) { @autoreleasepool { NSString *obj = @"test"; RDar10824732 *foo = [[RDar10824732 alloc] initWithObj:obj]; // no-warning @@ -1880,14 +1880,14 @@ extern id NSApp; //===----------------------------------------------------------------------===// void *malloc(size_t); struct rdar11104566 { CFStringRef myStr; }; -struct rdar11104566 test_rdar11104566() { +struct rdar11104566 test_rdar11104566(void) { CFStringRef cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning struct rdar11104566 V; V.myStr = cf; return V; // no-warning } -struct rdar11104566 *test_2_rdar11104566() { +struct rdar11104566 *test_2_rdar11104566(void) { CFStringRef cf = CFStringCreateWithCString( ((CFAllocatorRef)0), "test", kCFStringEncodingUTF8 ); // no-warning struct rdar11104566 *V = (struct rdar11104566 *) malloc(sizeof(*V)); V->myStr = cf; @@ -1898,7 +1898,7 @@ struct rdar11104566 *test_2_rdar11104566() { // ObjC literals support. //===----------------------------------------------------------------------===// -void test_objc_arrays() { +void test_objc_arrays(void) { { // CASE ONE -- OBJECT IN ARRAY CREATED DIRECTLY NSObject *o = [[NSObject alloc] init]; NSArray *a = [[NSArray alloc] initWithObjects:o, (void*)0]; // expected-warning {{leak}} @@ -1943,7 +1943,7 @@ void test_objc_arrays() { } } -void test_objc_integer_literals() { +void test_objc_integer_literals(void) { id value = [@1 retain]; // expected-warning {{leak}} [value description]; } @@ -1971,8 +1971,8 @@ void rdar11400885(int y) } } -id makeCollectableNonLeak() { - extern CFTypeRef CFCreateSomething(); +id makeCollectableNonLeak(void) { + extern CFTypeRef CFCreateSomething(void); CFTypeRef object = CFCreateSomething(); // +1 CFRetain(object); // +2 @@ -1985,7 +1985,7 @@ id makeCollectableNonLeak() { void consumeAndStopTracking(id NS_CONSUMED obj, void (^callback)(void)); void CFConsumeAndStopTracking(CFTypeRef CF_CONSUMED obj, void (^callback)(void)); -void testConsumeAndStopTracking() { +void testConsumeAndStopTracking(void) { id retained = [@[] retain]; // +1 consumeAndStopTracking(retained, ^{}); // no-warning @@ -1998,7 +1998,7 @@ void testConsumeAndStopTracking() { consumeAndStopTracking(unretained, ^{}); // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} } -void testCFConsumeAndStopTracking() { +void testCFConsumeAndStopTracking(void) { id retained = [@[] retain]; // +1 CFConsumeAndStopTracking((CFTypeRef)retained, ^{}); // no-warning @@ -2016,10 +2016,10 @@ void testCFConsumeAndStopTracking() { typedef void *MyCFType; #pragma clang arc_cf_code_audited begin -MyCFType CreateMyCFType(); +MyCFType CreateMyCFType(void); #pragma clang arc_cf_code_audited end -void test_custom_cf() { +void test_custom_cf(void) { MyCFType x = CreateMyCFType(); // expected-warning {{leak of an object stored into 'x'}} } @@ -2040,7 +2040,7 @@ void test_CFPlugInInstanceCreate(CFUUIDRef factoryUUID, CFUUIDRef typeUUID) { - (void)drain; @end -void test_drain() { +void test_drain(void) { PR14927 *obj = [[PR14927 alloc] init]; [obj drain]; [obj release]; // no-warning @@ -2051,14 +2051,14 @@ void test_drain() { // value as tracked, even if the object isn't a known CF type. //===----------------------------------------------------------------------===// -MyCFType getCustom() __attribute__((cf_returns_not_retained)); -MyCFType makeCustom() __attribute__((cf_returns_retained)); +MyCFType getCustom(void) __attribute__((cf_returns_not_retained)); +MyCFType makeCustom(void) __attribute__((cf_returns_retained)); -void testCustomReturnsRetained() { +void testCustomReturnsRetained(void) { MyCFType obj = makeCustom(); // expected-warning {{leak of an object stored into 'obj'}} } -void testCustomReturnsNotRetained() { +void testCustomReturnsNotRetained(void) { CFRelease(getCustom()); // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} } diff --git a/clang/test/ARCMT/objcmt-instancetype.m b/clang/test/ARCMT/objcmt-instancetype.m index 47dbd7aeed5a1..17dd5a46b1e78 100644 --- a/clang/test/ARCMT/objcmt-instancetype.m +++ b/clang/test/ARCMT/objcmt-instancetype.m @@ -103,7 +103,7 @@ + (NSNumber *)numberWithInt:(int)value { return 0; } #define PAIR(x) @#x, [NSNumber numberWithInt:(x)] #define TWO(x) ((x), (x)) -void foo() { +void foo(void) { NSString *str = M([NSString stringWithString:@"foo"]); // expected-warning {{redundant}} str = [[NSString alloc] initWithString:@"foo"]; // expected-warning {{redundant}} NSArray *arr = [NSArray arrayWithArray:@[str]]; // expected-warning {{redundant}} diff --git a/clang/test/ARCMT/objcmt-instancetype.m.result b/clang/test/ARCMT/objcmt-instancetype.m.result index ce51678708dd8..5203368aad644 100644 --- a/clang/test/ARCMT/objcmt-instancetype.m.result +++ b/clang/test/ARCMT/objcmt-instancetype.m.result @@ -103,7 +103,7 @@ typedef signed char BOOL; #define PAIR(x) @#x, [NSNumber numberWithInt:(x)] #define TWO(x) ((x), (x)) -void foo() { +void foo(void) { NSString *str = M([NSString stringWithString:@"foo"]); // expected-warning {{redundant}} str = [[NSString alloc] initWithString:@"foo"]; // expected-warning {{redundant}} NSArray *arr = [NSArray arrayWithArray:@[str]]; // expected-warning {{redundant}} diff --git a/clang/test/ARCMT/objcmt-property-dot-syntax.m b/clang/test/ARCMT/objcmt-property-dot-syntax.m index 5c71186b274fa..00426dcbdc33f 100644 --- a/clang/test/ARCMT/objcmt-property-dot-syntax.m +++ b/clang/test/ARCMT/objcmt-property-dot-syntax.m @@ -23,7 +23,7 @@ @interface P : NSObject - (P*) MethodReturnsPObj; @end -P* fun(); +P* fun(void); @implementation P - (int) Meth : (P*)array { diff --git a/clang/test/ARCMT/objcmt-property-dot-syntax.m.result b/clang/test/ARCMT/objcmt-property-dot-syntax.m.result index 09b93f6ff8f2d..43d86a821d7c2 100644 --- a/clang/test/ARCMT/objcmt-property-dot-syntax.m.result +++ b/clang/test/ARCMT/objcmt-property-dot-syntax.m.result @@ -23,7 +23,7 @@ - (P*) MethodReturnsPObj; @end -P* fun(); +P* fun(void); @implementation P - (int) Meth : (P*)array { diff --git a/clang/test/ARCMT/objcmt-subscripting-literals.m b/clang/test/ARCMT/objcmt-subscripting-literals.m index 0974c3b8bb0f5..e2b03e2d7b587 100644 --- a/clang/test/ARCMT/objcmt-subscripting-literals.m +++ b/clang/test/ARCMT/objcmt-subscripting-literals.m @@ -209,7 +209,7 @@ @interface MutableCustomUnavail (Extended) - (void)setObject:(id)obj atIndexedSubscript:(unsigned)idx __attribute__((unavailable)); @end -void test2() { +void test2(void) { MutableCustom *mutc; id o = [mutc objectAtIndex:4]; [mutc replaceObjectAtIndex:2 withObject:@"val"]; diff --git a/clang/test/ARCMT/objcmt-subscripting-literals.m.result b/clang/test/ARCMT/objcmt-subscripting-literals.m.result index ed7879bb139ee..e0b385741f01e 100644 --- a/clang/test/ARCMT/objcmt-subscripting-literals.m.result +++ b/clang/test/ARCMT/objcmt-subscripting-literals.m.result @@ -209,7 +209,7 @@ void test1(NSString *str) { - (void)setObject:(id)obj atIndexedSubscript:(unsigned)idx __attribute__((unavailable)); @end -void test2() { +void test2(void) { MutableCustom *mutc; id o = mutc[4]; mutc[2] = @"val"; diff --git a/clang/test/ARCMT/objcmt-with-pch.m b/clang/test/ARCMT/objcmt-with-pch.m index 61c87a2b007d8..0925442d45eb9 100644 --- a/clang/test/ARCMT/objcmt-with-pch.m +++ b/clang/test/ARCMT/objcmt-with-pch.m @@ -12,6 +12,6 @@ @interface NSNumber (NSNumberCreation) + (NSNumber *)numberWithInt:(int)value; @end -void foo() { +void foo(void) { NSNumber *n = [NSNumber numberWithInt:1]; } diff --git a/clang/test/ARCMT/objcmt-with-pch.m.result b/clang/test/ARCMT/objcmt-with-pch.m.result index 7e2570cfc456c..6d37d11fe480d 100644 --- a/clang/test/ARCMT/objcmt-with-pch.m.result +++ b/clang/test/ARCMT/objcmt-with-pch.m.result @@ -12,6 +12,6 @@ + (NSNumber *)numberWithInt:(int)value; @end -void foo() { +void foo(void) { NSNumber *n = @1; } diff --git a/clang/test/ARCMT/releases-driver.m b/clang/test/ARCMT/releases-driver.m index f2f5b0848e8b4..96f96c1d3b482 100644 --- a/clang/test/ARCMT/releases-driver.m +++ b/clang/test/ARCMT/releases-driver.m @@ -6,7 +6,7 @@ typedef int BOOL; -id IhaveSideEffect(); +id IhaveSideEffect(void); @protocol NSObject - (BOOL)isEqual:(id)object; diff --git a/clang/test/ARCMT/releases-driver.m.result b/clang/test/ARCMT/releases-driver.m.result index e4427e6796e02..e7da9a04fc62a 100644 --- a/clang/test/ARCMT/releases-driver.m.result +++ b/clang/test/ARCMT/releases-driver.m.result @@ -6,7 +6,7 @@ typedef int BOOL; -id IhaveSideEffect(); +id IhaveSideEffect(void); @protocol NSObject - (BOOL)isEqual:(id)object; diff --git a/clang/test/ARCMT/releases.m b/clang/test/ARCMT/releases.m index 55008959efc4e..8636a8a5acea8 100644 --- a/clang/test/ARCMT/releases.m +++ b/clang/test/ARCMT/releases.m @@ -6,7 +6,7 @@ typedef int BOOL; -id IhaveSideEffect(); +id IhaveSideEffect(void); @protocol NSObject - (BOOL)isEqual:(id)object; @@ -64,9 +64,9 @@ - (void) dealloc { @end void block_test(Foo *p) { - id (^B)() = ^() { + id (^B)(void) = ^(void) { if (p) { - id (^IB)() = ^() { + id (^IB)(void) = ^(void) { id bar = [p retain]; [p release]; return bar; diff --git a/clang/test/ARCMT/releases.m.result b/clang/test/ARCMT/releases.m.result index 473750e4e899b..261175362b9bd 100644 --- a/clang/test/ARCMT/releases.m.result +++ b/clang/test/ARCMT/releases.m.result @@ -6,7 +6,7 @@ typedef int BOOL; -id IhaveSideEffect(); +id IhaveSideEffect(void); @protocol NSObject - (BOOL)isEqual:(id)object; @@ -57,9 +57,9 @@ void func(Foo *p) { @end void block_test(Foo *p) { - id (^B)() = ^() { + id (^B)(void) = ^(void) { if (p) { - id (^IB)() = ^() { + id (^IB)(void) = ^(void) { id bar = p; return bar; }; diff --git a/clang/test/ARCMT/retains.m b/clang/test/ARCMT/retains.m index 60283a695ff43..43a94fc16cecf 100644 --- a/clang/test/ARCMT/retains.m +++ b/clang/test/ARCMT/retains.m @@ -4,7 +4,7 @@ #include "Common.h" -id IhaveSideEffect(); +id IhaveSideEffect(void); @interface Foo : NSObject { id bar; @@ -58,9 +58,9 @@ id foo (Foo *p) { } void block_tests(Foo *p) { - id (^B)() = ^() { + id (^B)(void) = ^(void) { if (p) { - id (^IB)() = ^() { + id (^IB)(void) = ^(void) { id bar = [p retain]; return bar; }; diff --git a/clang/test/ARCMT/retains.m.result b/clang/test/ARCMT/retains.m.result index 2011e506360c5..4e720d6bb4c11 100644 --- a/clang/test/ARCMT/retains.m.result +++ b/clang/test/ARCMT/retains.m.result @@ -4,7 +4,7 @@ #include "Common.h" -id IhaveSideEffect(); +id IhaveSideEffect(void); @interface Foo : NSObject { id bar; @@ -52,9 +52,9 @@ id foo (Foo *p) { } void block_tests(Foo *p) { - id (^B)() = ^() { + id (^B)(void) = ^(void) { if (p) { - id (^IB)() = ^() { + id (^IB)(void) = ^(void) { id bar = p; return bar; }; diff --git a/clang/test/ARCMT/rewrite-block-var.m b/clang/test/ARCMT/rewrite-block-var.m index 538f16c255749..eb3c5b6535971 100644 --- a/clang/test/ARCMT/rewrite-block-var.m +++ b/clang/test/ARCMT/rewrite-block-var.m @@ -8,7 +8,7 @@ @interface Foo : NSObject -(Foo *)something; @end -void bar(void (^block)()); +void bar(void (^block)(void)); void test1(Foo *p) { __block Foo *x = p; // __block used just to break cycle. diff --git a/clang/test/ARCMT/rewrite-block-var.m.result b/clang/test/ARCMT/rewrite-block-var.m.result index a9d0b0f7fad80..cf5718fbd7f5d 100644 --- a/clang/test/ARCMT/rewrite-block-var.m.result +++ b/clang/test/ARCMT/rewrite-block-var.m.result @@ -8,7 +8,7 @@ -(Foo *)something; @end -void bar(void (^block)()); +void bar(void (^block)(void)); void test1(Foo *p) { __weak Foo *x = p; // __block used just to break cycle. diff --git a/clang/test/Sema/ast-print.c b/clang/test/Sema/ast-print.c index 7f675206e58b3..2ba5ca34b5134 100644 --- a/clang/test/Sema/ast-print.c +++ b/clang/test/Sema/ast-print.c @@ -10,7 +10,7 @@ // RUN: echo >> %t.c "// expected""-note@* {{'EnumWithAttributes3' has been explicitly marked deprecated here}}" // RUN: %clang_cc1 -fsyntax-only %t.c -verify -typedef void func_typedef(); +typedef void func_typedef(void); func_typedef xxx; typedef void func_t(int x); @@ -69,7 +69,7 @@ struct pair_t { // CHECK: struct pair_t p = {a: 3, .b = 4}; struct pair_t p = {a: 3, .b = 4}; // expected-warning {{use of GNU old-style field designator extension}} -void initializers() { +void initializers(void) { // CHECK: int *x = ((void *)0), *y = ((void *)0); int *x = ((void *)0), *y = ((void *)0); struct Z{}; @@ -94,7 +94,7 @@ enum EnumWithAttributes { // expected-warning {{'EnumWithAttributes' is deprecat enum __attribute__((deprecated)) EnumWithAttributes2 *EnumWithAttributes2Ptr; // CHECK-LABEL: EnumWithAttributes3Fn -void EnumWithAttributes3Fn() { +void EnumWithAttributes3Fn(void) { // CHECK-NEXT: enum __attribute__((deprecated(""))) EnumWithAttributes3 *EnumWithAttributes3Ptr; // expected-warning@+2 {{'EnumWithAttributes3' is deprecated}} // expected-note@+1 {{'EnumWithAttributes3' has been explicitly marked deprecated here}} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits