diff --git a/clang/test/Analysis/CFContainers-invalid.c b/clang/test/Analysis/CFContainers-invalid.c index ce1284f75da7e0..a86c3d807edced 100644 --- a/clang/test/Analysis/CFContainers-invalid.c +++ b/clang/test/Analysis/CFContainers-invalid.c @@ -13,7 +13,7 @@ CFArrayRef CFArrayCreate(CFAllocatorRef); CFDictionaryRef CFDictionaryCreate(CFAllocatorRef); CFSetRef CFSetCreate(CFAllocatorRef); -void testNoCrash() { +void testNoCrash(void) { (void)CFArrayCreate(kCFAllocatorDefault); (void)CFDictionaryCreate(kCFAllocatorDefault); (void)CFSetCreate(kCFAllocatorDefault); diff --git a/clang/test/Analysis/CGColorSpace.c b/clang/test/Analysis/CGColorSpace.c index 38f0512b006321..3faf21ae120d54 100644 --- a/clang/test/Analysis/CGColorSpace.c +++ b/clang/test/Analysis/CGColorSpace.c @@ -5,12 +5,12 @@ extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void); extern CGColorSpaceRef CGColorSpaceRetain(CGColorSpaceRef space); extern void CGColorSpaceRelease(CGColorSpaceRef space); -void f() { +void f(void) { CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); // expected-warning{{leak}} CGColorSpaceRetain(X); } -void fb() { +void fb(void) { CGColorSpaceRef X = CGColorSpaceCreateDeviceRGB(); CGColorSpaceRetain(X); CGColorSpaceRelease(X); diff --git a/clang/test/Analysis/Checkers/RunLoopAutoreleaseLeakChecker.m b/clang/test/Analysis/Checkers/RunLoopAutoreleaseLeakChecker.m index 2bf86410f3ff76..d03b761ba0d74b 100644 --- a/clang/test/Analysis/Checkers/RunLoopAutoreleaseLeakChecker.m +++ b/clang/test/Analysis/Checkers/RunLoopAutoreleaseLeakChecker.m @@ -15,19 +15,19 @@ #ifndef EXTRA -void just_runloop() { // No warning: no statements in between +void just_runloop(void) { // No warning: no statements in between @autoreleasepool { [[NSRunLoop mainRunLoop] run]; // no-warning } } -void just_xpcmain() { // No warning: no statements in between +void just_xpcmain(void) { // No warning: no statements in between @autoreleasepool { xpc_main(); // no-warning } } -void runloop_init_before() { // Warning: object created before the loop. +void runloop_init_before(void) { // Warning: object created before the loop. @autoreleasepool { NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool followed by the launch of main run loop may never get released; consider moving them to a separate autorelease pool}} (void) object; @@ -35,7 +35,7 @@ void runloop_init_before() { // Warning: object created before the loop. } } -void runloop_init_before_separate_pool() { // No warning: separate autorelease pool. +void runloop_init_before_separate_pool(void) { // No warning: separate autorelease pool. @autoreleasepool { NSObject *object; @autoreleasepool { @@ -46,7 +46,7 @@ void runloop_init_before_separate_pool() { // No warning: separate autorelease p } } -void xpcmain_init_before() { // Warning: object created before the loop. +void xpcmain_init_before(void) { // Warning: object created before the loop. @autoreleasepool { NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool followed by the launch of xpc_main may never get released; consider moving them to a separate autorelease pool}} (void) object; @@ -54,7 +54,7 @@ void xpcmain_init_before() { // Warning: object created before the loop. } } -void runloop_init_before_two_objects() { // Warning: object created before the loop. +void runloop_init_before_two_objects(void) { // Warning: object created before the loop. @autoreleasepool { NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool followed by the launch of main run loop may never get released; consider moving them to a separate autorelease pool}} NSObject *object2 = [[NSObject alloc] init]; // no-warning, warning on the first one is enough. @@ -64,13 +64,13 @@ void runloop_init_before_two_objects() { // Warning: object created before the l } } -void runloop_no_autoreleasepool() { +void runloop_no_autoreleasepool(void) { NSObject *object = [[NSObject alloc] init]; // no-warning (void)object; [[NSRunLoop mainRunLoop] run]; } -void runloop_init_after() { // No warning: objects created after the loop +void runloop_init_after(void) { // No warning: objects created after the loop @autoreleasepool { [[NSRunLoop mainRunLoop] run]; NSObject *object = [[NSObject alloc] init]; // no-warning @@ -78,7 +78,7 @@ void runloop_init_after() { // No warning: objects created after the loop } } -void no_crash_on_empty_children() { +void no_crash_on_empty_children(void) { @autoreleasepool { for (;;) {} NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool followed by the launch of main run loop may never get released; consider moving them to a separate autorelease pool}} @@ -90,7 +90,7 @@ void no_crash_on_empty_children() { #endif #ifdef AP1 -int main() { +int main(void) { NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool of last resort followed by the launch of main run loop may never get released; consider moving them to a separate autorelease pool}} (void) object; [[NSRunLoop mainRunLoop] run]; @@ -100,7 +100,7 @@ int main() { #ifdef AP2 // expected-no-diagnostics -int main() { +int main(void) { NSObject *object = [[NSObject alloc] init]; // no-warning (void) object; @autoreleasepool { @@ -112,7 +112,7 @@ int main() { #ifdef AP3 // expected-no-diagnostics -int main() { +int main(void) { [[NSRunLoop mainRunLoop] run]; NSObject *object = [[NSObject alloc] init]; // no-warning (void) object; @@ -121,7 +121,7 @@ int main() { #endif #ifdef AP4 -int main() { +int main(void) { NSObject *object = [[NSObject alloc] init]; // expected-warning{{Temporary objects allocated in the autorelease pool of last resort followed by the launch of xpc_main may never get released; consider moving them to a separate autorelease pool}} (void) object; xpc_main(); @@ -148,7 +148,7 @@ @interface I #define CFSTR __builtin___CFStringMakeConstantString -int main() { +int main(void) { I *i; @autoreleasepool { NSString *s1 = (__bridge_transfer NSString *)processString(0, 0); diff --git a/clang/test/Analysis/DeallocUseAfterFreeErrors.m b/clang/test/Analysis/DeallocUseAfterFreeErrors.m index 2e1bdc41bb6e9c..c20aebc89c5c02 100644 --- a/clang/test/Analysis/DeallocUseAfterFreeErrors.m +++ b/clang/test/Analysis/DeallocUseAfterFreeErrors.m @@ -1,6 +1,6 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.SuperDealloc,debug.ExprInspection -analyzer-output=text -verify %s -void clang_analyzer_warnIfReached(); +void clang_analyzer_warnIfReached(void); #define nil ((id)0) diff --git a/clang/test/Analysis/Inputs/ctu-other.c b/clang/test/Analysis/Inputs/ctu-other.c index 48a3f322cbd576..2bb5a04d6c2281 100644 --- a/clang/test/Analysis/Inputs/ctu-other.c +++ b/clang/test/Analysis/Inputs/ctu-other.c @@ -33,7 +33,7 @@ int g(struct S *ctx) { // Test that asm import does not fail. // TODO: Support the GNU extension asm keyword as well. // Example using the GNU extension: asm("mov $42, %0" : "=r"(res)); -int inlineAsm() { +int inlineAsm(void) { int res; __asm__("mov $42, %0" : "=r"(res)); diff --git a/clang/test/Analysis/NSContainers.m b/clang/test/Analysis/NSContainers.m index 74db771a52d0dd..f41189a5e1dcf6 100644 --- a/clang/test/Analysis/NSContainers.m +++ b/clang/test/Analysis/NSContainers.m @@ -112,33 +112,33 @@ + (NSNull *)null; @end // NSMutableArray API -void testNilArgNSMutableArray1() { +void testNilArgNSMutableArray1(void) { NSMutableArray *marray = [[NSMutableArray alloc] init]; [marray addObject:0]; // expected-warning {{Argument to 'NSMutableArray' method 'addObject:' cannot be nil}} } -void testNilArgNSMutableArray2() { +void testNilArgNSMutableArray2(void) { NSMutableArray *marray = [[NSMutableArray alloc] init]; [marray insertObject:0 atIndex:1]; // expected-warning {{Argument to 'NSMutableArray' method 'insertObject:atIndex:' cannot be nil}} } -void testNilArgNSMutableArray3() { +void testNilArgNSMutableArray3(void) { NSMutableArray *marray = [[NSMutableArray alloc] init]; [marray replaceObjectAtIndex:1 withObject:0]; // expected-warning {{Argument to 'NSMutableArray' method 'replaceObjectAtIndex:withObject:' cannot be nil}} } -void testNilArgNSMutableArray4() { +void testNilArgNSMutableArray4(void) { NSMutableArray *marray = [[NSMutableArray alloc] init]; [marray setObject:0 atIndexedSubscript:1]; // expected-warning {{Argument to 'NSMutableArray' method 'setObject:atIndexedSubscript:' cannot be nil}} } -void testNilArgNSMutableArray5() { +void testNilArgNSMutableArray5(void) { NSMutableArray *marray = [[NSMutableArray alloc] init]; marray[1] = 0; // expected-warning {{Array element cannot be nil}} } // NSArray API -void testNilArgNSArray1() { +void testNilArgNSArray1(void) { NSArray *array = [[NSArray alloc] init]; NSArray *copyArray = [array arrayByAddingObject:0]; // expected-warning {{Argument to 'NSArray' method 'arrayByAddingObject:' cannot be nil}} } @@ -224,7 +224,7 @@ void idc2(id x) { if (!x) return; } -Foo *retNil() { +Foo *retNil(void) { return 0; } @@ -282,7 +282,7 @@ void testCountAwareNSOrderedSet(NSOrderedSet *containers, int *validptr) { } } -void testLiteralsNonNil() { +void testLiteralsNonNil(void) { clang_analyzer_eval(!!@[]); // expected-warning{{TRUE}} clang_analyzer_eval(!!@{}); // expected-warning{{TRUE}} } diff --git a/clang/test/Analysis/NSString.m b/clang/test/Analysis/NSString.m index a53fc1e5662401..59e333aea32dfd 100644 --- a/clang/test/Analysis/NSString.m +++ b/clang/test/Analysis/NSString.m @@ -134,7 +134,7 @@ NSComparisonResult f5(NSString* s, NSStringCompareOptions op, NSRange R) { return s4; } -NSMutableArray* f8() { +NSMutableArray* f8(void) { NSString* s = [[NSString alloc] init]; NSMutableArray* a = [[NSMutableArray alloc] initWithCapacity:2]; @@ -143,7 +143,7 @@ NSComparisonResult f5(NSString* s, NSStringCompareOptions op, NSRange R) { return a; } -void f9() { +void f9(void) { NSString* s = [[NSString alloc] init]; NSString* q = s; @@ -151,7 +151,7 @@ void f9() { [q release]; // expected-warning {{used after it is released}} } -NSString* f10() { +NSString* f10(void) { static NSString* s = 0; if (!s) s = [[NSString alloc] init]; return s; // no-warning @@ -172,7 +172,7 @@ void f9() { // Test case for passing a tracked object by-reference to a function we // don't understand. void unknown_function_f12(NSString** s); -void f12() { +void f12(void) { NSString *string = [[NSString alloc] init]; unknown_function_f12(&string); // no-warning } @@ -275,7 +275,7 @@ + (id)sharedInstance { } @end -id testSharedClassFromFunction() { +id testSharedClassFromFunction(void) { return [[SharedClass alloc] _init]; // no-warning } @@ -300,7 +300,7 @@ extern BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile } #endif -void testOSCompareAndSwap() { +void testOSCompareAndSwap(void) { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!OSAtomicCompareAndSwapPtr(0, s, (void**) &old)) @@ -309,7 +309,7 @@ void testOSCompareAndSwap() { [old release]; } -void testOSCompareAndSwapXXBarrier_local() { +void testOSCompareAndSwapXXBarrier_local(void) { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) &old)) @@ -318,7 +318,7 @@ void testOSCompareAndSwapXXBarrier_local() { [old release]; } -void testOSCompareAndSwapXXBarrier_local_no_direct_release() { +void testOSCompareAndSwapXXBarrier_local_no_direct_release(void) { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!COMPARE_SWAP_BARRIER((intptr_t) 0, (intptr_t) s, (intptr_t*) &old)) @@ -333,7 +333,7 @@ int testOSCompareAndSwapXXBarrier_id(Class myclass, id xclass) { return 0; } -void test_objc_atomicCompareAndSwap_local() { +void test_objc_atomicCompareAndSwap_local(void) { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!objc_atomicCompareAndSwapPtr(0, s, &old)) @@ -342,7 +342,7 @@ void test_objc_atomicCompareAndSwap_local() { [old release]; } -void test_objc_atomicCompareAndSwap_local_no_direct_release() { +void test_objc_atomicCompareAndSwap_local_no_direct_release(void) { NSString *old = 0; NSString *s = [[NSString alloc] init]; // no-warning if (!objc_atomicCompareAndSwapPtr(0, s, &old)) @@ -369,13 +369,13 @@ void test_objc_atomicCompareAndSwap_parameter_no_direct_release(NSString **old) // Test stringWithFormat () -void test_stringWithFormat() { +void test_stringWithFormat(void) { NSString *string = [[NSString stringWithFormat:@"%ld", (long) 100] retain]; [string release]; [string release]; // expected-warning{{Incorrect decrement of the reference count}} } -// Test isTrackedObjectType(). +// Test isTrackedObjectType(void). typedef NSString* WonkyTypedef; @interface TestIsTracked + (WonkyTypedef)newString; diff --git a/clang/test/Analysis/NSWindow.m b/clang/test/Analysis/NSWindow.m index e247ff18ceb07c..aa36227f94d223 100644 --- a/clang/test/Analysis/NSWindow.m +++ b/clang/test/Analysis/NSWindow.m @@ -44,7 +44,7 @@ - (void)orderFrontRegardless; // Test cases. -void f1() { +void f1(void) { NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,100,100) styleMask:NSTitledWindowMask|NSClosableWindowMask @@ -54,7 +54,7 @@ void f1() { [window orderFrontRegardless]; // no-warning } -void f2() { +void f2(void) { NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,100,100) styleMask:NSTitledWindowMask|NSClosableWindowMask @@ -65,7 +65,7 @@ void f2() { [window orderFrontRegardless]; // no-warning } -void f2b() { +void f2b(void) { // FIXME: NSWindow doesn't own itself until it is displayed. NSWindow *window = [[NSWindow alloc] // no-warning initWithContentRect:NSMakeRect(0,0,100,100) @@ -80,7 +80,7 @@ void f2b() { } -void f3() { +void f3(void) { // FIXME: For now we don't track NSWindow. NSWindow *window = [NSWindow alloc]; // expected-warning{{never read}} } diff --git a/clang/test/Analysis/NoReturn.m b/clang/test/Analysis/NoReturn.m index c08fd0dc51561a..f7d5cbf3a33ea0 100644 --- a/clang/test/Analysis/NoReturn.m +++ b/clang/test/Analysis/NoReturn.m @@ -95,7 +95,7 @@ + (void) doesNotReturn __attribute__((analyzer_noreturn)); - (void) alsoDoesNotReturn __attribute__((analyzer_noreturn)); @end -void test_rdar11634353() { +void test_rdar11634353(void) { [Radar11634353 doesNotReturn]; int *p = 0; *p = 0xDEADBEEF; // no-warning @@ -107,7 +107,7 @@ void test_rdar11634352_instance(Radar11634353 *o) { *p = 0xDEADBEEF; // no-warning } -void test_rdar11634353_positive() { +void test_rdar11634353_positive(void) { int *p = 0; *p = 0xDEADBEEF; // expected-warning {{null pointer}} } @@ -126,7 +126,7 @@ void PR11959(int *p) { // Test that hard-coded Microsoft _wassert name is recognized as a noreturn #define assert(_Expression) (void)( (!!(_Expression)) || (_wassert(#_Expression, __FILE__, __LINE__), 0) ) extern void _wassert(const char * _Message, const char *_File, unsigned _Line); -void test_wassert() { +void test_wassert(void) { assert(0); int *p = 0; *p = 0xDEADBEEF; // no-warning @@ -137,7 +137,7 @@ void test_wassert() { #define assert(_Expression) ((_Expression) ? (void)0 : __assert2(0, 0, 0, 0)); extern void __assert2(const char *, int, const char *, const char *); extern void _wassert(const char * _Message, const char *_File, unsigned _Line); -void test___assert2() { +void test___assert2(void) { assert(0); int *p = 0; *p = 0xDEADBEEF; // no-warning diff --git a/clang/test/Analysis/OSAtomic_mac.c b/clang/test/Analysis/OSAtomic_mac.c index b09c71f6c6e9de..272aada712e3d4 100644 --- a/clang/test/Analysis/OSAtomic_mac.c +++ b/clang/test/Analysis/OSAtomic_mac.c @@ -7,7 +7,7 @@ int OSAtomicCompareAndSwapPtrBarrier() { // but we should trust our BodyFarm instead. } -int *invalidSLocOnRedecl() { +int *invalidSLocOnRedecl(void) { // Was crashing when trying to throw a report about returning an uninitialized // value to the caller. FIXME: We should probably still throw that report, // something like "The "compare" part of CompareAndSwap depends on an @@ -17,7 +17,7 @@ int *invalidSLocOnRedecl() { return b; } -void testThatItActuallyWorks() { +void testThatItActuallyWorks(void) { void *x = 0; int res = OSAtomicCompareAndSwapPtrBarrier(0, &x, &x); clang_analyzer_eval(res); // expected-warning{{TRUE}} diff --git a/clang/test/Analysis/UserNullabilityAnnotations.m b/clang/test/Analysis/UserNullabilityAnnotations.m index 5e708c7aca5887..cb6c288b67821b 100644 --- a/clang/test/Analysis/UserNullabilityAnnotations.m +++ b/clang/test/Analysis/UserNullabilityAnnotations.m @@ -26,7 +26,7 @@ - (void)method2:(int *)x { int *_Nonnull Value; } NestedNonnullMember; -NestedNonnullMember *foo(); +NestedNonnullMember *foo(void); void f1(NestedNonnullMember *Root) { NestedNonnullMember *Grandson = Root->Child->Child; diff --git a/clang/test/Analysis/_Bool-increment-decrement.c b/clang/test/Analysis/_Bool-increment-decrement.c index 477b6ed43830e7..6e55b0731a6940 100644 --- a/clang/test/Analysis/_Bool-increment-decrement.c +++ b/clang/test/Analysis/_Bool-increment-decrement.c @@ -2,7 +2,7 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c11 -Dbool=_Bool -Dtrue=1 -Dfalse=0 %s extern void clang_analyzer_eval(bool); -void test__Bool_value() { +void test__Bool_value(void) { { bool b = true; clang_analyzer_eval(b == 1); // expected-warning{{TRUE}} @@ -36,7 +36,7 @@ void test__Bool_value() { } } -void test__Bool_increment() { +void test__Bool_increment(void) { { bool b = true; b++; @@ -87,7 +87,7 @@ void test__Bool_increment() { } } -void test__Bool_decrement() { +void test__Bool_decrement(void) { { bool b = true; b--; diff --git a/clang/test/Analysis/analyzer-display-progress.m b/clang/test/Analysis/analyzer-display-progress.m index 8d0b3d6d5679b2..24414f659c39ac 100644 --- a/clang/test/Analysis/analyzer-display-progress.m +++ b/clang/test/Analysis/analyzer-display-progress.m @@ -2,7 +2,7 @@ #include "Inputs/system-header-simulator-objc.h" -static void f() {} +static void f(void) {} @interface I: NSObject -(void)instanceMethod:(int)arg1 with:(int)arg2; diff --git a/clang/test/Analysis/analyzer-stats.c b/clang/test/Analysis/analyzer-stats.c index b58e862f6c6599..69c61e17eb1f9e 100644 --- a/clang/test/Analysis/analyzer-stats.c +++ b/clang/test/Analysis/analyzer-stats.c @@ -1,8 +1,8 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,deadcode.DeadStores,debug.Stats -verify -Wno-unreachable-code -analyzer-opt-analyze-nested-blocks -analyzer-max-loop 4 %s -int foo(); +int foo(void); -int test() { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}} +int test(void) { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: no | Empty WorkList: yes}} int a = 1; a = 34 / 12; @@ -14,7 +14,7 @@ int test() { // expected-warning-re{{test -> Total CFGBlocks: {{[0-9]+}} | Unrea } -int sink() // expected-warning-re{{sink -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 1 | Exhausted Block: yes | Empty WorkList: yes}} +int sink(void) // expected-warning-re{{sink -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 1 | Exhausted Block: yes | Empty WorkList: yes}} { for (int i = 0; i < 10; ++i) // expected-warning {{(sink): The analyzer generated a sink at this point}} ++i; @@ -22,7 +22,7 @@ int sink() // expected-warning-re{{sink -> Total CFGBlocks: {{[0-9]+}} | Unreach return 0; } -int emptyConditionLoop() // expected-warning-re{{emptyConditionLoop -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: yes | Empty WorkList: yes}} +int emptyConditionLoop(void) // expected-warning-re{{emptyConditionLoop -> Total CFGBlocks: {{[0-9]+}} | Unreachable CFGBlocks: 0 | Exhausted Block: yes | Empty WorkList: yes}} { int num = 1; for (;;) diff --git a/clang/test/Analysis/arc-zero-init.m b/clang/test/Analysis/arc-zero-init.m index de1e978cd0d8ec..831d7003cae98c 100644 --- a/clang/test/Analysis/arc-zero-init.m +++ b/clang/test/Analysis/arc-zero-init.m @@ -8,7 +8,7 @@ @interface SomeClass @end -void simpleStrongPointerValue() { +void simpleStrongPointerValue(void) { SomeClass *x; if (x) {} #if !__has_feature(objc_arc) @@ -16,7 +16,7 @@ void simpleStrongPointerValue() { #endif } -void simpleArray() { +void simpleArray(void) { SomeClass *vlaArray[5]; if (vlaArray[0]) {} @@ -25,7 +25,7 @@ void simpleArray() { #endif } -void variableLengthArray() { +void variableLengthArray(void) { int count = 1; SomeClass * vlaArray[count]; @@ -35,7 +35,7 @@ void variableLengthArray() { #endif } -void variableLengthArrayWithExplicitStrongAttribute() { +void variableLengthArrayWithExplicitStrongAttribute(void) { int count = 1; __attribute__((objc_ownership(strong))) SomeClass * vlaArray[count]; diff --git a/clang/test/Analysis/array-struct-region.c b/clang/test/Analysis/array-struct-region.c index c27abfb6ac986c..657be62c94e615 100644 --- a/clang/test/Analysis/array-struct-region.c +++ b/clang/test/Analysis/array-struct-region.c @@ -2,7 +2,7 @@ void clang_analyzer_eval(int); -int string_literal_init() { +int string_literal_init(void) { char a[] = "abc"; char b[2] = "abc"; // expected-warning{{too long}} char c[5] = "abc"; @@ -42,7 +42,7 @@ void nested_compound_literals_float(float rad) { } -void struct_as_array() { +void struct_as_array(void) { struct simple { int x; int y; }; struct simple a; struct simple *p = &a; @@ -60,14 +60,14 @@ void struct_as_array() { // PR13264 / struct point { int x; int y; }; struct circle { struct point o; int r; }; -struct circle get_circle() { +struct circle get_circle(void) { struct circle result; result.r = 5; result.o = (struct point){0, 0}; return result; } -void struct_in_struct() { +void struct_in_struct(void) { struct circle c; c = get_circle(); // This used to think c.r was undefined because c.o is a LazyCompoundVal. @@ -77,14 +77,14 @@ void struct_in_struct() { // We also test with floats because we don't model floats right now, // and the original bug report used a float. struct circle_f { struct point o; float r; }; -struct circle_f get_circle_f() { +struct circle_f get_circle_f(void) { struct circle_f result; result.r = 5.0; result.o = (struct point){0, 0}; return result; } -float struct_in_struct_f() { +float struct_in_struct_f(void) { struct circle_f c; c = get_circle_f(); @@ -92,7 +92,7 @@ float struct_in_struct_f() { } -int randomInt(); +int randomInt(void); int testSymbolicInvalidation(int index) { int vals[10]; @@ -122,7 +122,7 @@ typedef struct { int x, y, z; } S; -S makeS(); +S makeS(void); int testSymbolicInvalidationStruct(int index) { S vals[10]; @@ -183,7 +183,7 @@ int testConcreteInvalidationDoubleStruct(int index) { } -int testNonOverlappingStructFieldsSimple() { +int testNonOverlappingStructFieldsSimple(void) { S val; val.x = 1; @@ -277,7 +277,7 @@ typedef struct { int length; } ShortStringWrapper; -void testArrayStructCopy() { +void testArrayStructCopy(void) { ShortString s = { "abc" }; ShortString s2 = s; ShortString s3 = s2; @@ -294,7 +294,7 @@ void testArrayStructCopy() { clang_analyzer_eval(s4.data[2] == 'c'); // expected-warning{{TRUE}} } -void testArrayStructCopyNested() { +void testArrayStructCopyNested(void) { ShortString s = { "abc" }; ShortString s2 = s; diff --git a/clang/test/Analysis/array-struct-region.cpp b/clang/test/Analysis/array-struct-region.cpp index 1b9fa3e8db55c6..31cbb60ba991e6 100644 --- a/clang/test/Analysis/array-struct-region.cpp +++ b/clang/test/Analysis/array-struct-region.cpp @@ -46,16 +46,16 @@ bool operator ~(const struct S &s) { return (&s) != &s; } #ifdef INLINE -struct S getS() { +struct S getS(void) { struct S s = { 42 }; return s; } #else -struct S getS(); +struct S getS(void); #endif -void testAssignment() { +void testAssignment(void) { struct S s = getS(); if (s.field != 42) return; @@ -78,7 +78,7 @@ void testAssignment() { } -void testImmediateUse() { +void testImmediateUse(void) { int x = getS().field; if (x != 42) return; @@ -105,12 +105,12 @@ int getAssignedField(struct S s) { return s.field; } -void testArgument() { +void testArgument(void) { clang_analyzer_eval(getConstrainedField(getS()) == 42); // expected-warning{{TRUE}} clang_analyzer_eval(getAssignedField(getS()) == 42); // expected-warning{{TRUE}} } -void testImmediateUseParens() { +void testImmediateUseParens(void) { int x = ((getS())).field; if (x != 42) return; diff --git a/clang/test/Analysis/array-struct.c b/clang/test/Analysis/array-struct.c index 45c4c9d4ad1788..a609f9abfa3edc 100644 --- a/clang/test/Analysis/array-struct.c +++ b/clang/test/Analysis/array-struct.c @@ -28,19 +28,19 @@ void f(void) { // StringLiteral in lvalue context and pointer to array type. // p: ElementRegion, q: StringRegion -void f2() { +void f2(void) { char *p = "/usr/local"; char (*q)[4]; q = &"abc"; } // Typedef'ed struct definition. -void f3() { +void f3(void) { STYPE s; } // Initialize array with InitExprList. -void f4() { +void f4(void) { int a[] = { 1, 2, 3}; int b[3] = { 1, 2 }; struct s c[] = {{1,{1}}}; @@ -48,13 +48,13 @@ void f4() { // Struct variable in lvalue context. // Assign UnknownVal to the whole struct. -void f5() { +void f5(void) { struct s data; g1(&data); } // AllocaRegion test. -void f6() { +void f6(void) { char *p; p = __builtin_alloca(10); g(p); @@ -70,30 +70,30 @@ struct s2; void g2(struct s2 *p); // Incomplete struct pointer used as function argument. -void f7() { +void f7(void) { struct s2 *p = __builtin_alloca(10); g2(p); } // sizeof() is unsigned while -1 is signed in array index. -void f8() { +void f8(void) { int a[10]; a[sizeof(a)/sizeof(int) - 1] = 1; // no-warning } // Initialization of struct array elements. -void f9() { +void f9(void) { struct s a[10]; } // Initializing array with string literal. -void f10() { +void f10(void) { char a1[4] = "abc"; char a3[6] = "abc"; } // Retrieve the default value of element/field region. -void f11() { +void f11(void) { struct s a; g1(&a); if (a.data == 0) // no-warning @@ -129,25 +129,25 @@ struct s3 { static struct s3 opt; // Test if the embedded array is retrieved correctly. -void f14() { +void f14(void) { struct s3 my_opt = opt; } void bar(int*); -struct s3 gets3() { +struct s3 gets3(void) { struct s3 s; return s; } -void accessArrayFieldNoCrash() { +void accessArrayFieldNoCrash(void) { bar(gets3().a); bar((gets3().a)); bar(((gets3().a))); } // Test if the array is correctly invalidated. -void f15() { +void f15(void) { int a[10]; bar(a); if (a[1]) // no-warning @@ -167,7 +167,7 @@ void f16(struct s3 *p) { void inv(struct s1 *); // Invalidate the struct field. -void f17() { +void f17(void) { struct s1 t; int x; inv(&t); @@ -177,7 +177,7 @@ void f17() { void read(char*); -void f18() { +void f18(void) { char *q; char *p = (char *) __builtin_alloca(10); read(p); diff --git a/clang/test/Analysis/assume-controlled-environment.c b/clang/test/Analysis/assume-controlled-environment.c index 749b8198f6fb03..fce1a1e7bae330 100644 --- a/clang/test/Analysis/assume-controlled-environment.c +++ b/clang/test/Analysis/assume-controlled-environment.c @@ -16,7 +16,7 @@ char *getenv(const char *name); -void foo() { +void foo(void) { char *p = getenv("FOO"); // untrusted-env-warning {{tainted}} (void)p; // untrusted-env-warning {{tainted}} } diff --git a/clang/test/Analysis/blocks-no-inline.c b/clang/test/Analysis/blocks-no-inline.c index 9fa3138ec277cb..78af92cb499408 100644 --- a/clang/test/Analysis/blocks-no-inline.c +++ b/clang/test/Analysis/blocks-no-inline.c @@ -3,7 +3,7 @@ void clang_analyzer_eval(int); -void testInvalidation() { +void testInvalidation(void) { __block int i = 0; ^{ ++i; @@ -15,7 +15,7 @@ void testInvalidation() { const int globalConstant = 1; -void testCapturedConstants() { +void testCapturedConstants(void) { const int localConstant = 2; static const int staticConstant = 3; @@ -28,7 +28,7 @@ void testCapturedConstants() { typedef const int constInt; constInt anotherGlobalConstant = 1; -void testCapturedConstantsTypedef() { +void testCapturedConstantsTypedef(void) { constInt localConstant = 2; static constInt staticConstant = 3; diff --git a/clang/test/Analysis/blocks-nrvo.c b/clang/test/Analysis/blocks-nrvo.c index bb0be869ee7677..89b7fd39577b30 100644 --- a/clang/test/Analysis/blocks-nrvo.c +++ b/clang/test/Analysis/blocks-nrvo.c @@ -6,7 +6,7 @@ typedef struct { int x; } S; -void foo() { +void foo(void) { ^{ S s; return s; // no-crash diff --git a/clang/test/Analysis/blocks.m b/clang/test/Analysis/blocks.m index a21a605ffa6150..01b0ce6f02b90f 100644 --- a/clang/test/Analysis/blocks.m +++ b/clang/test/Analysis/blocks.m @@ -82,27 +82,27 @@ void test1(NSString *format, ...) { // test2 - Test that captured variables that are uninitialized are flagged // as such. -void test2() { +void test2(void) { static int y = 0; int x; ^{ y = x + 1; }(); // expected-warning{{Variable 'x' is uninitialized when captured by block}} } -void test2_b() { +void test2_b(void) { static int y = 0; __block int x; ^{ y = x + 1; }(); // expected-warning {{left operand of '+' is a garbage value}} } -void test2_c() { +void test2_c(void) { typedef void (^myblock)(void); - myblock f = ^() { f(); }; // expected-warning{{Variable 'f' is uninitialized when captured by block}} + myblock f = ^(void) { f(); }; // expected-warning{{Variable 'f' is uninitialized when captured by block}} } -void testMessaging() { +void testMessaging(void) { // - [[^(){} copy] release]; + [[^(void){} copy] release]; } @@ -133,8 +133,8 @@ - (void)test { } @end -void testReturnVariousSignatures() { - (void)^int(){ +void testReturnVariousSignatures(void) { + (void)^int(void){ return 42; }(); @@ -142,7 +142,7 @@ void testReturnVariousSignatures() { return 42; }(); - (void)^(){ + (void)^(void){ return 42; }(); @@ -173,7 +173,7 @@ void blockCapturesItselfInTheLoop(int x, int m) { void takeNonnullBlock(void (^)(void)) __attribute__((nonnull)); void takeNonnullIntBlock(int (^)(void)) __attribute__((nonnull)); -void testCallContainingWithSignature1() +void testCallContainingWithSignature1(void) { takeNonnullBlock(^{ static const char str[] = "Lost connection to sharingd"; @@ -181,7 +181,7 @@ void testCallContainingWithSignature1() }); } -void testCallContainingWithSignature2() +void testCallContainingWithSignature2(void) { takeNonnullBlock(^void{ static const char str[] = "Lost connection to sharingd"; @@ -189,15 +189,15 @@ void testCallContainingWithSignature2() }); } -void testCallContainingWithSignature3() +void testCallContainingWithSignature3(void) { - takeNonnullBlock(^void(){ + takeNonnullBlock(^void(void){ static const char str[] = "Lost connection to sharingd"; testCallContainingWithSignature3(); }); } -void testCallContainingWithSignature4() +void testCallContainingWithSignature4(void) { takeNonnullBlock(^void(void){ static const char str[] = "Lost connection to sharingd"; @@ -205,7 +205,7 @@ void testCallContainingWithSignature4() }); } -void testCallContainingWithSignature5() +void testCallContainingWithSignature5(void) { takeNonnullIntBlock(^{ static const char str[] = "Lost connection to sharingd"; @@ -240,13 +240,13 @@ -(void)foo; { // The incorrect block variable initialization below is a hard compile-time // error in C++. #if !defined(__cplusplus) -void call_block_with_fewer_arguments() { +void call_block_with_fewer_arguments(void) { void (^b)() = ^(int a) { }; b(); // expected-warning {{Block taking 1 argument is called with fewer (0)}} } #endif -int getBlockFlags() { +int getBlockFlags(void) { int x = 0; return ((struct Block_layout *)^{ (void)x; })->flags; // no-warning } diff --git a/clang/test/Analysis/bsd-string.c b/clang/test/Analysis/bsd-string.c index e4119058507fcf..a7d06e71e97864 100644 --- a/clang/test/Analysis/bsd-string.c +++ b/clang/test/Analysis/bsd-string.c @@ -12,12 +12,12 @@ size_t strlcat(char *dst, const char *src, size_t n); size_t strlen(const char *s); void clang_analyzer_eval(int); -void f1() { +void f1(void) { char overlap[] = "123456789"; strlcpy(overlap, overlap + 1, 3); // expected-warning{{Arguments must not be overlapping buffers}} } -void f2() { +void f2(void) { char buf[5]; size_t len; len = strlcpy(buf, "abcd", sizeof(buf)); // expected-no-warning @@ -26,33 +26,33 @@ void f2() { clang_analyzer_eval(len == 8); // expected-warning{{TRUE}} } -void f3() { +void f3(void) { char dst[2]; const char *src = "abdef"; strlcpy(dst, src, 5); // expected-warning{{String copy function overflows the destination buffer}} } -void f4() { +void f4(void) { strlcpy(NULL, "abcdef", 6); // expected-warning{{Null pointer passed as 1st argument to string copy function}} } -void f5() { +void f5(void) { strlcat(NULL, "abcdef", 6); // expected-warning{{Null pointer passed as 1st argument to string concatenation function}} } -void f6() { +void f6(void) { char buf[8]; strlcpy(buf, "abc", 3); size_t len = strlcat(buf, "defg", 4); clang_analyzer_eval(len == 7); // expected-warning{{TRUE}} } -int f7() { +int f7(void) { char buf[8]; return strlcpy(buf, "1234567", 0); // no-crash } -void f8(){ +void f8(void){ char buf[5]; size_t len; @@ -116,7 +116,7 @@ void f9(int unknown_size, char* unknown_src, char* unknown_dst){ // expected-warning@-1 {{String concatenation function overflows the destination buffer}} } -void f10(){ +void f10(void){ char buf[8]; size_t len; @@ -126,7 +126,7 @@ void f10(){ // expected-warning@-1 {{String concatenation function overflows the destination buffer}} } -void f11() { +void f11(void) { //test for Bug 41729 char a[256], b[256]; strlcpy(a, "world", sizeof(a)); @@ -135,7 +135,7 @@ void f11() { } int a, b; -void unknown_val_crash() { +void unknown_val_crash(void) { // We're unable to evaluate the integer-to-pointer cast. strlcat(&b, a, 0); // no-crash } diff --git a/clang/test/Analysis/bstring.c b/clang/test/Analysis/bstring.c index 0deb4754c3b28f..c88452e49075d4 100644 --- a/clang/test/Analysis/bstring.c +++ b/clang/test/Analysis/bstring.c @@ -71,7 +71,7 @@ void *memcpy(void *restrict s1, const void *restrict s2, size_t n); #endif /* VARIANT */ -void memcpy0 () { +void memcpy0 (void) { char src[] = {1, 2, 3, 4}; char dst[4] = {0}; @@ -84,14 +84,14 @@ void memcpy0 () { clang_analyzer_eval(dst[0] != 0); // expected-warning{{UNKNOWN}} } -void memcpy1 () { +void memcpy1 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; memcpy(dst, src, 5); // expected-warning{{Memory copy function accesses out-of-bound array element}} } -void memcpy2 () { +void memcpy2 (void) { char src[] = {1, 2, 3, 4}; char dst[1]; @@ -101,21 +101,21 @@ void memcpy2 () { #endif } -void memcpy3 () { +void memcpy3 (void) { char src[] = {1, 2, 3, 4}; char dst[3]; memcpy(dst+1, src+2, 2); // no-warning } -void memcpy4 () { +void memcpy4 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; memcpy(dst+2, src+2, 3); // expected-warning{{Memory copy function accesses out-of-bound array element}} } -void memcpy5() { +void memcpy5(void) { char src[] = {1, 2, 3, 4}; char dst[3]; @@ -125,43 +125,43 @@ void memcpy5() { #endif } -void memcpy6() { +void memcpy6(void) { int a[4] = {0}; memcpy(a, a, 8); // expected-warning{{overlapping}} } -void memcpy7() { +void memcpy7(void) { int a[4] = {0}; memcpy(a+2, a+1, 8); // expected-warning{{overlapping}} } -void memcpy8() { +void memcpy8(void) { int a[4] = {0}; memcpy(a+1, a+2, 8); // expected-warning{{overlapping}} } -void memcpy9() { +void memcpy9(void) { int a[4] = {0}; memcpy(a+2, a+1, 4); // no-warning memcpy(a+1, a+2, 4); // no-warning } -void memcpy10() { +void memcpy10(void) { char a[4] = {0}; memcpy(0, a, 4); // expected-warning{{Null pointer passed as 1st argument to memory copy function}} } -void memcpy11() { +void memcpy11(void) { char a[4] = {0}; memcpy(a, 0, 4); // expected-warning{{Null pointer passed as 2nd argument to memory copy function}} } -void memcpy12() { +void memcpy12(void) { char a[4] = {0}; memcpy(0, a, 0); // no-warning } -void memcpy13() { +void memcpy13(void) { char a[4] = {0}; memcpy(a, 0, 0); // no-warning } @@ -197,7 +197,7 @@ void *mempcpy(void *restrict s1, const void *restrict s2, size_t n); #endif /* VARIANT */ -void mempcpy0 () { +void mempcpy0 (void) { char src[] = {1, 2, 3, 4}; char dst[5] = {0}; @@ -210,14 +210,14 @@ void mempcpy0 () { clang_analyzer_eval(dst[0] != 0); // expected-warning{{UNKNOWN}} } -void mempcpy1 () { +void mempcpy1 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; mempcpy(dst, src, 5); // expected-warning{{Memory copy function accesses out-of-bound array element}} } -void mempcpy2 () { +void mempcpy2 (void) { char src[] = {1, 2, 3, 4}; char dst[1]; @@ -227,21 +227,21 @@ void mempcpy2 () { #endif } -void mempcpy3 () { +void mempcpy3 (void) { char src[] = {1, 2, 3, 4}; char dst[3]; mempcpy(dst+1, src+2, 2); // no-warning } -void mempcpy4 () { +void mempcpy4 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; mempcpy(dst+2, src+2, 3); // expected-warning{{Memory copy function accesses out-of-bound array element}} } -void mempcpy5() { +void mempcpy5(void) { char src[] = {1, 2, 3, 4}; char dst[3]; @@ -251,48 +251,48 @@ void mempcpy5() { #endif } -void mempcpy6() { +void mempcpy6(void) { int a[4] = {0}; mempcpy(a, a, 8); // expected-warning{{overlapping}} } -void mempcpy7() { +void mempcpy7(void) { int a[4] = {0}; mempcpy(a+2, a+1, 8); // expected-warning{{overlapping}} } -void mempcpy8() { +void mempcpy8(void) { int a[4] = {0}; mempcpy(a+1, a+2, 8); // expected-warning{{overlapping}} } -void mempcpy9() { +void mempcpy9(void) { int a[4] = {0}; mempcpy(a+2, a+1, 4); // no-warning mempcpy(a+1, a+2, 4); // no-warning } -void mempcpy10() { +void mempcpy10(void) { char a[4] = {0}; mempcpy(0, a, 4); // expected-warning{{Null pointer passed as 1st argument to memory copy function}} } -void mempcpy11() { +void mempcpy11(void) { char a[4] = {0}; mempcpy(a, 0, 4); // expected-warning{{Null pointer passed as 2nd argument to memory copy function}} } -void mempcpy12() { +void mempcpy12(void) { char a[4] = {0}; mempcpy(0, a, 0); // no-warning } -void mempcpy13() { +void mempcpy13(void) { char a[4] = {0}; mempcpy(a, 0, 0); // no-warning } -void mempcpy14() { +void mempcpy14(void) { int src[] = {1, 2, 3, 4}; int dst[5] = {0}; int *p; @@ -307,7 +307,7 @@ struct st { int j; }; -void mempcpy15() { +void mempcpy15(void) { struct st s1 = {0}; struct st s2; struct st *p1; @@ -319,7 +319,7 @@ void mempcpy15() { clang_analyzer_eval(p1 == p2); // expected-warning{{TRUE}} } -void mempcpy16() { +void mempcpy16(void) { struct st s1[10] = {{0}}; struct st s2[10]; struct st *p1; @@ -362,7 +362,7 @@ void *memmove(void *s1, const void *s2, size_t n); #endif /* VARIANT */ -void memmove0 () { +void memmove0 (void) { char src[] = {1, 2, 3, 4}; char dst[4] = {0}; @@ -375,14 +375,14 @@ void memmove0 () { clang_analyzer_eval(dst[0] != 0); // expected-warning{{UNKNOWN}} } -void memmove1 () { +void memmove1 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; memmove(dst, src, 5); // expected-warning{{out-of-bound}} } -void memmove2 () { +void memmove2 (void) { char src[] = {1, 2, 3, 4}; char dst[1]; @@ -410,28 +410,28 @@ int memcmp(const void *s1, const void *s2, size_t n); #endif /* VARIANT */ -void memcmp0 () { +void memcmp0 (void) { char a[] = {1, 2, 3, 4}; char b[4] = { 0 }; memcmp(a, b, 4); // no-warning } -void memcmp1 () { +void memcmp1 (void) { char a[] = {1, 2, 3, 4}; char b[10] = { 0 }; memcmp(a, b, 5); // expected-warning{{out-of-bound}} } -void memcmp2 () { +void memcmp2 (void) { char a[] = {1, 2, 3, 4}; char b[1] = { 0 }; memcmp(a, b, 4); // expected-warning{{out-of-bound}} } -void memcmp3 () { +void memcmp3 (void) { char a[] = {1, 2, 3, 4}; clang_analyzer_eval(memcmp(a, a, 4) == 0); // expected-warning{{TRUE}} @@ -483,7 +483,7 @@ int memcmp8(char *a, size_t n) { void bcopy(/*const*/ void *s1, void *s2, size_t n); -void bcopy0 () { +void bcopy0 (void) { char src[] = {1, 2, 3, 4}; char dst[4] = {0}; @@ -494,14 +494,14 @@ void bcopy0 () { clang_analyzer_eval(dst[0] != 0); // expected-warning{{UNKNOWN}} } -void bcopy1 () { +void bcopy1 (void) { char src[] = {1, 2, 3, 4}; char dst[10]; bcopy(src, dst, 5); // expected-warning{{out-of-bound}} } -void bcopy2 () { +void bcopy2 (void) { char src[] = {1, 2, 3, 4}; char dst[1]; diff --git a/clang/test/Analysis/bug_hash_test.m b/clang/test/Analysis/bug_hash_test.m index fbb70e5d626a3d..1510c12a0ab8db 100644 --- a/clang/test/Analysis/bug_hash_test.m +++ b/clang/test/Analysis/bug_hash_test.m @@ -28,7 +28,7 @@ - (void)method:(int)arg param:(int)arg2 { @end -void testBlocks() { +void testBlocks(void) { int x = 5; ^{ clang_analyzer_hashDump(x); // expected-warning {{debug.ExprInspection$$29$clang_analyzer_hashDump(x);$Category}} diff --git a/clang/test/Analysis/c11lock.c b/clang/test/Analysis/c11lock.c index 78e62982fea145..0e867e9dada369 100644 --- a/clang/test/Analysis/c11lock.c +++ b/clang/test/Analysis/c11lock.c @@ -52,7 +52,7 @@ void bad5(void) { mtx_unlock(&mtx1); // expected-warning {{This lock has already been unlocked}} } -void bad6() { +void bad6(void) { mtx_init(&mtx1, 0); if (mtx_trylock(&mtx1) != thrd_success) mtx_unlock(&mtx1); // expected-warning {{This lock has already been unlocked}} @@ -65,7 +65,7 @@ void bad7(void) { mtx_unlock(&mtx2); } -void good() { +void good(void) { mtx_t mtx; mtx_init(&mtx, 0); mtx_lock(&mtx); @@ -73,7 +73,7 @@ void good() { mtx_destroy(&mtx); } -void good2() { +void good2(void) { mtx_t mtx; mtx_init(&mtx, 0); if (mtx_trylock(&mtx) == thrd_success) @@ -81,7 +81,7 @@ void good2() { mtx_destroy(&mtx); } -void good3() { +void good3(void) { mtx_t mtx; mtx_init(&mtx, 0); if (mtx_timedlock(&mtx, 0) == thrd_success) diff --git a/clang/test/Analysis/call-and-message.c b/clang/test/Analysis/call-and-message.c index da62a6f5071af1..b79ec8c344b6ce 100644 --- a/clang/test/Analysis/call-and-message.c +++ b/clang/test/Analysis/call-and-message.c @@ -11,7 +11,7 @@ // no-pointee-no-diagnostics void doStuff_pointerToConstInt(const int *u){}; -void pointee_uninit() { +void pointee_uninit(void) { int i; int *p = &i; doStuff_pointerToConstInt(p); // expected-warning{{1st function call argument is a pointer to uninitialized value [core.CallAndMessage]}} diff --git a/clang/test/Analysis/call-and-message.m b/clang/test/Analysis/call-and-message.m index cef501400b72a4..b90ef571136c41 100644 --- a/clang/test/Analysis/call-and-message.m +++ b/clang/test/Analysis/call-and-message.m @@ -62,7 +62,7 @@ - (void)addObject:(id)object; // Test cases. //===----------------------------------------------------------------------===// -unsigned f1() { +unsigned f1(void) { NSString *aString; return [aString length]; // expected-warning {{Receiver in message expression is an uninitialized value [core.CallAndMessage]}} } diff --git a/clang/test/Analysis/casts.c b/clang/test/Analysis/casts.c index ce195297874b1a..28667b6a043a6d 100644 --- a/clang/test/Analysis/casts.c +++ b/clang/test/Analysis/casts.c @@ -91,7 +91,7 @@ int foo (int* p) { return 0; } -void castsToBool() { +void castsToBool(void) { clang_analyzer_eval(0); // expected-warning{{FALSE}} clang_analyzer_eval(0U); // expected-warning{{FALSE}} clang_analyzer_eval((void *)0); // expected-warning{{FALSE}} @@ -128,7 +128,7 @@ void locAsIntegerCasts(void *p) { clang_analyzer_eval(++x < 10); // no-crash // expected-warning{{UNKNOWN}} } -void multiDimensionalArrayPointerCasts() { +void multiDimensionalArrayPointerCasts(void) { static int x[10][10]; int *y1 = &(x[3][5]); char *z = ((char *) y1) + 2; @@ -154,15 +154,15 @@ void multiDimensionalArrayPointerCasts() { clang_analyzer_eval(*((char *)y1) == *((char *) y3)); // expected-warning{{TRUE}} } -void *getVoidPtr(); +void *getVoidPtr(void); -void testCastVoidPtrToIntPtrThroughIntTypedAssignment() { +void testCastVoidPtrToIntPtrThroughIntTypedAssignment(void) { int *x; (*((int *)(&x))) = (int)getVoidPtr(); *x = 1; // no-crash } -void testCastUIntPtrToIntPtrThroughIntTypedAssignment() { +void testCastUIntPtrToIntPtrThroughIntTypedAssignment(void) { unsigned u; int *x; (*((int *)(&x))) = (int)&u; @@ -170,7 +170,7 @@ void testCastUIntPtrToIntPtrThroughIntTypedAssignment() { clang_analyzer_eval(u == 1); // expected-warning{{TRUE}} } -void testCastVoidPtrToIntPtrThroughUIntTypedAssignment() { +void testCastVoidPtrToIntPtrThroughUIntTypedAssignment(void) { int *x; (*((int *)(&x))) = (int)(unsigned *)getVoidPtr(); *x = 1; // no-crash @@ -187,7 +187,7 @@ void testLocNonLocSymbolRemainder(int a, int *b) { } } -void testSwitchWithSizeofs() { +void testSwitchWithSizeofs(void) { switch (sizeof(char) == 1) { // expected-warning{{switch condition has boolean value}} case sizeof(char):; // no-crash } @@ -219,8 +219,8 @@ void test_VectorSplat_cast(long x) { #ifdef EAGERLY_ASSUME int globalA; -extern int globalFunc(); -void no_crash_on_symsym_cast_to_long() { +extern int globalFunc(void); +void no_crash_on_symsym_cast_to_long(void) { char c = globalFunc() - 5; c == 0; globalA -= c; @@ -240,7 +240,7 @@ char no_crash_SymbolCast_of_float_type_aux(int *p) { return *p; } -void no_crash_SymbolCast_of_float_type() { +void no_crash_SymbolCast_of_float_type(void) { extern float x; char (*f)() = no_crash_SymbolCast_of_float_type_aux; f(&x); diff --git a/clang/test/Analysis/casts.m b/clang/test/Analysis/casts.m index 5c81ae6ffbe62c..eda26c68d0175b 100644 --- a/clang/test/Analysis/casts.m +++ b/clang/test/Analysis/casts.m @@ -41,6 +41,6 @@ @interface RDR10087620 : NSObject { // PR16690 -_Bool testLocAsIntegerToBool() { +_Bool testLocAsIntegerToBool(void) { return (long long)&testLocAsIntegerToBool; } diff --git a/clang/test/Analysis/cert/env34-c.c b/clang/test/Analysis/cert/env34-c.c index b3b14b0e7c42bc..3c1a3930d6379c 100644 --- a/clang/test/Analysis/cert/env34-c.c +++ b/clang/test/Analysis/cert/env34-c.c @@ -18,10 +18,10 @@ char *asctime(const tm *timeptr); int strcmp(const char*, const char*); extern void foo(char *e); -extern char* bar(); +extern char* bar(void); -void getenv_test1() { +void getenv_test1(void) { char *p; p = getenv("VAR"); @@ -31,7 +31,7 @@ void getenv_test1() { *p; // no-warning, getenv result was assigned to the same pointer } -void getenv_test2() { +void getenv_test2(void) { char *p, *p2; p = getenv("VAR"); @@ -46,7 +46,7 @@ void getenv_test2() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test3() { +void getenv_test3(void) { char *p, *p2, *p3; p = getenv("VAR"); @@ -64,7 +64,7 @@ void getenv_test3() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test4() { +void getenv_test4(void) { char *p, *p2, *p3; p = getenv("VAR"); @@ -78,7 +78,7 @@ void getenv_test4() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test5() { +void getenv_test5(void) { char *p, *p2, *p3; p = getenv("VAR"); @@ -92,7 +92,7 @@ void getenv_test5() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test6() { +void getenv_test6(void) { char *p, *p2; p = getenv("VAR"); *p; // no-warning @@ -120,7 +120,7 @@ void getenv_test6() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test7() { +void getenv_test7(void) { char *p, *p2; p = getenv("VAR"); // expected-note@-1{{previous function call was here}} @@ -134,7 +134,7 @@ void getenv_test7() { // expected-note@-2{{use of invalidated pointer 'p' in a function call}} } -void getenv_test8() { +void getenv_test8(void) { static const char *array[] = { 0, 0, @@ -159,7 +159,7 @@ void getenv_test8() { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test9() { +void getenv_test9(void) { char *p, *p2; p = getenv("something"); p = bar(); @@ -167,7 +167,7 @@ void getenv_test9() { *p; // no-warning: p does not point to getenv anymore } -void getenv_test10() { +void getenv_test10(void) { strcmp(getenv("VAR1"), getenv("VAR2")); // expected-note@-1{{'getenv' call may invalidate the the result of the previous 'getenv'}} // expected-note@-2{{previous function call was here}} @@ -181,7 +181,7 @@ void dereference_pointer(char* a) { // expected-note@-2{{dereferencing an invalid pointer}} } -void getenv_test11() { +void getenv_test11(void) { char *p = getenv("VAR"); // expected-note@-1{{previous function call was here}} @@ -212,7 +212,7 @@ void getenv_test12(int flag1, int flag2) { } } -void setlocale_test1() { +void setlocale_test1(void) { char *p, *p2; p = setlocale(0, "VAR"); *p; // no-warning @@ -250,7 +250,7 @@ void setlocale_test2(int flag) { // expected-note@-2{{dereferencing an invalid pointer}} } -void strerror_test1() { +void strerror_test1(void) { char *p, *p2; p = strerror(0); @@ -298,7 +298,7 @@ void strerror_test2(int errno) { // expected-note@-2{{dereferencing an invalid pointer}} } -void asctime_test() { +void asctime_test(void) { const tm *t; const tm *tt; @@ -312,7 +312,7 @@ void asctime_test() { // expected-note@-2{{dereferencing an invalid pointer}} } -void localeconv_test1() { +void localeconv_test1(void) { lconv *lc1 = localeconv(); // expected-note@-1{{previous function call was here}} lconv *lc2 = localeconv(); @@ -323,7 +323,7 @@ void localeconv_test1() { // expected-note@-2{{dereferencing an invalid pointer}} } -void localeconv_test2() { +void localeconv_test2(void) { // TODO: false negative lconv *lc1 = localeconv(); lconv *lc2 = localeconv(); diff --git a/clang/test/Analysis/cfg.c b/clang/test/Analysis/cfg.c index 429406252538d1..4bd84e689f251e 100644 --- a/clang/test/Analysis/cfg.c +++ b/clang/test/Analysis/cfg.c @@ -50,7 +50,7 @@ void checkWrap(int i) { // CHECK-NEXT: 4: asm ("" : "=r" ([B1.3])); // CHECK-NEXT: 5: arg // CHECK-NEXT: 6: asm ("" : "=r" ([B1.5])); -void checkGCCAsmRValueOutput() { +void checkGCCAsmRValueOutput(void) { int arg; __asm__("" : "=r"((int)arg)); // rvalue output operand __asm__("" : "=r"(arg)); // lvalue output operand diff --git a/clang/test/Analysis/class-object-state-dump.m b/clang/test/Analysis/class-object-state-dump.m index 66519b82adb1d2..740e517b83020d 100644 --- a/clang/test/Analysis/class-object-state-dump.m +++ b/clang/test/Analysis/class-object-state-dump.m @@ -3,7 +3,7 @@ // expected-no-diagnostics -void clang_analyzer_printState(); +void clang_analyzer_printState(void); @interface NSObject { } diff --git a/clang/test/Analysis/compound-literals.c b/clang/test/Analysis/compound-literals.c index 42e6a55a30c7c5..c74eacc3aa6831 100644 --- a/clang/test/Analysis/compound-literals.c +++ b/clang/test/Analysis/compound-literals.c @@ -11,7 +11,7 @@ void foo(void) { } // check that we propagate info through compound literal regions -void bar() { +void bar(void) { int *integers = (int[]){1, 2, 3}; clang_analyzer_eval(integers[0] == 1); // expected-warning{{TRUE}} clang_analyzer_eval(integers[1] == 2); // expected-warning{{TRUE}} diff --git a/clang/test/Analysis/concrete-address.c b/clang/test/Analysis/concrete-address.c index f1608f8a801c3e..fe0de4a1ff257b 100644 --- a/clang/test/Analysis/concrete-address.c +++ b/clang/test/Analysis/concrete-address.c @@ -1,7 +1,7 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s // expected-no-diagnostics -void foo() { +void foo(void) { int *p = (int*) 0x10000; // Should not crash here. *p = 3; } diff --git a/clang/test/Analysis/constant-folding.c b/clang/test/Analysis/constant-folding.c index 116e74b746b4e4..5de4f0ae3cd35a 100644 --- a/clang/test/Analysis/constant-folding.c +++ b/clang/test/Analysis/constant-folding.c @@ -179,7 +179,7 @@ void testBitwiseRules(unsigned int a, int b, int c) { } } -unsigned reset(); +unsigned reset(void); void testCombinedSources(unsigned a, unsigned b) { if (b >= 10 && (a | b) <= 30) { diff --git a/clang/test/Analysis/constraint-assignor.c b/clang/test/Analysis/constraint-assignor.c index 1b9e40e6bf649b..8210e576c98bd2 100644 --- a/clang/test/Analysis/constraint-assignor.c +++ b/clang/test/Analysis/constraint-assignor.c @@ -3,7 +3,7 @@ // RUN: -analyzer-checker=debug.ExprInspection \ // RUN: -verify -void clang_analyzer_warnIfReached(); +void clang_analyzer_warnIfReached(void); void clang_analyzer_eval(int); void rem_constant_rhs_ne_zero(int x, int y) { diff --git a/clang/test/Analysis/conversion-tracking-notes.c b/clang/test/Analysis/conversion-tracking-notes.c index 94b3dc1c8bc40d..d9db5e99200b61 100644 --- a/clang/test/Analysis/conversion-tracking-notes.c +++ b/clang/test/Analysis/conversion-tracking-notes.c @@ -7,7 +7,7 @@ unsigned char U8; signed char S8; -void track_assign() { +void track_assign(void) { unsigned long L = 1000; // expected-note {{'L' initialized to 1000}} int I = -1; // expected-note {{'I' initialized to -1}} U8 *= L; // expected-warning {{Loss of precision in implicit conversion}} diff --git a/clang/test/Analysis/conversion.c b/clang/test/Analysis/conversion.c index f6b0c11a15aea9..78b614516b63ee 100644 --- a/clang/test/Analysis/conversion.c +++ b/clang/test/Analysis/conversion.c @@ -17,21 +17,21 @@ void assign(unsigned U, signed S) { S8 = U; // no-warning } -void addAssign() { +void addAssign(void) { unsigned long L = 1000; int I = -100; U8 += L; // expected-warning {{Loss of precision in implicit conversion}} L += I; // no-warning } -void subAssign() { +void subAssign(void) { unsigned long L = 1000; int I = -100; U8 -= L; // expected-warning {{Loss of precision in implicit conversion}} L -= I; // no-warning } -void mulAssign() { +void mulAssign(void) { unsigned long L = 1000; int I = -1; U8 *= L; // expected-warning {{Loss of precision in implicit conversion}} @@ -40,42 +40,42 @@ void mulAssign() { L *= I; // no-warning } -void divAssign() { +void divAssign(void) { unsigned long L = 1000; int I = -1; U8 /= L; // no-warning L /= I; // expected-warning {{Loss of sign in implicit conversion}} } -void remAssign() { +void remAssign(void) { unsigned long L = 1000; int I = -1; U8 %= L; // no-warning L %= I; // expected-warning {{Loss of sign in implicit conversion}} } -void andAssign() { +void andAssign(void) { unsigned long L = 1000; int I = -1; U8 &= L; // no-warning L &= I; // expected-warning {{Loss of sign in implicit conversion}} } -void orAssign() { +void orAssign(void) { unsigned long L = 1000; int I = -1; U8 |= L; // expected-warning {{Loss of precision in implicit conversion}} L |= I; // expected-warning {{Loss of sign in implicit conversion}} } -void xorAssign() { +void xorAssign(void) { unsigned long L = 1000; int I = -1; U8 ^= L; // expected-warning {{Loss of precision in implicit conversion}} L ^= I; // expected-warning {{Loss of sign in implicit conversion}} } -void init1() { +void init1(void) { long long A = 1LL << 60; short X = A; // expected-warning {{Loss of precision in implicit conversion}} } @@ -108,7 +108,7 @@ void division(unsigned U, signed S) { void f(unsigned x) {} void g(unsigned x) {} -void functioncall1() { +void functioncall1(void) { long x = -1; int y = 0; f(x); // expected-warning {{Loss of sign in implicit conversion}} @@ -145,11 +145,11 @@ void dontwarn3(int X) { // don't warn for macros #define DOSTUFF ({ unsigned X = 1000; U8 = X; }) -void dontwarn4() { +void dontwarn4(void) { DOSTUFF; } -void dontwarn5() { +void dontwarn5(void) { unsigned char c1 = 'A'; c1 = (c1 >= 'A' && c1 <= 'Z') ? c1 - 'A' + 'a' : c1; unsigned char c2 = 0; @@ -162,7 +162,7 @@ void dontwarn5() { c5 = (c5 >= 'A' && c5 <= 'Z') ? c5 - 'A' + 'a' : c5; } -void dontwarn6() { +void dontwarn6(void) { int x = ~0; unsigned y = ~0; } @@ -172,11 +172,11 @@ void dontwarn7(unsigned x) { } } -void dontwarn8() { +void dontwarn8(void) { unsigned x = (unsigned)-1; } -unsigned dontwarn9() { +unsigned dontwarn9(void) { return ~0; } @@ -190,7 +190,7 @@ char dontwarn10(long long x) { // C library functions, handled via apiModeling.StdCLibraryFunctions int isascii(int c); -void libraryFunction1() { +void libraryFunction1(void) { char kb2[5]; int X = 1000; if (isascii(X)) { @@ -204,7 +204,7 @@ typedef struct FILE {} FILE; int getc(FILE *stream); char reply_string[8192]; FILE *cin; extern int dostuff(void); -int libraryFunction2() { +int libraryFunction2(void) { int c, n; int dig; char *cp = reply_string; @@ -239,7 +239,7 @@ double floating_point(long long a, int b) { return 137; } -double floating_point2() { +double floating_point2(void) { int a = 1 << 24; long long b = 1LL << 53; float f = a; // no-warning diff --git a/clang/test/Analysis/copypaste/generic.c b/clang/test/Analysis/copypaste/generic.c index 2fa6c302da1711..4c265b2d68b166 100644 --- a/clang/test/Analysis/copypaste/generic.c +++ b/clang/test/Analysis/copypaste/generic.c @@ -4,7 +4,7 @@ int global; -int foo1() { +int foo1(void) { if (global > 0) return 0; else if (global < 0) @@ -13,7 +13,7 @@ int foo1() { } // Different associated type (int instead of float) -int foo2() { +int foo2(void) { if (global > 0) return 0; else if (global < 0) @@ -22,7 +22,7 @@ int foo2() { } // Different number of associated types. -int foo3() { +int foo3(void) { if (global > 0) return 0; else if (global < 0) diff --git a/clang/test/Analysis/coverage.c b/clang/test/Analysis/coverage.c index b819f10edc1384..f0fa1d40c39d16 100644 --- a/clang/test/Analysis/coverage.c +++ b/clang/test/Analysis/coverage.c @@ -93,7 +93,7 @@ void coverage9(int *x) { y = (*x); // no warning } -static void empty_function(){ +static void empty_function(void){ } int use_empty_function(int x) { x = 0; diff --git a/clang/test/Analysis/crash-trace.c b/clang/test/Analysis/crash-trace.c index f00db3a74ab990..857b3a228d07f6 100644 --- a/clang/test/Analysis/crash-trace.c +++ b/clang/test/Analysis/crash-trace.c @@ -13,7 +13,7 @@ void inlined(int x, float y) { clang_analyzer_crash(); } -void test() { +void test(void) { inlined(0, 0); } diff --git a/clang/test/Analysis/cstring-plist.c b/clang/test/Analysis/cstring-plist.c index 65fa9fe74d1d31..3851a5469376ca 100644 --- a/clang/test/Analysis/cstring-plist.c +++ b/clang/test/Analysis/cstring-plist.c @@ -14,7 +14,7 @@ char *strncpy(char *restrict s1, const char *restrict s2, size_t n); -void cstringchecker_bounds_nocrash() { +void cstringchecker_bounds_nocrash(void) { char *p = malloc(2); strncpy(p, "AAA", sizeof("AAA")); // we don't expect warning as the checker is disabled free(p); diff --git a/clang/test/Analysis/cstring-ranges.c b/clang/test/Analysis/cstring-ranges.c index dc6bb67e6de561..27f90cc888bde1 100644 --- a/clang/test/Analysis/cstring-ranges.c +++ b/clang/test/Analysis/cstring-ranges.c @@ -7,7 +7,7 @@ char *strcpy(char *, const char *); -void foo() { +void foo(void) { char *a = 0, *b = 0; strcpy(a, b); } diff --git a/clang/test/Analysis/cstring-syntax-weird2.c b/clang/test/Analysis/cstring-syntax-weird2.c index a0f28536d4a387..0250d69d994ef5 100644 --- a/clang/test/Analysis/cstring-syntax-weird2.c +++ b/clang/test/Analysis/cstring-syntax-weird2.c @@ -6,9 +6,9 @@ typedef __SIZE_TYPE__ size_t; // The last parameter is normally size_t but the test is about the abnormal // situation when it's not a size_t. -size_t strlcpy(char *, const char *, void (*)()); +size_t strlcpy(char *, const char *, void (*)(void)); -void foo(); +void foo(void); void testWeirdDecls(const char *src) { char dst[10]; diff --git a/clang/test/Analysis/ctu-main.c b/clang/test/Analysis/ctu-main.c index 1415490668ba59..00ee7e414e2cfb 100644 --- a/clang/test/Analysis/ctu-main.c +++ b/clang/test/Analysis/ctu-main.c @@ -18,7 +18,7 @@ typedef struct { } FooBar; extern FooBar fb; int f(int); -void testGlobalVariable() { +void testGlobalVariable(void) { clang_analyzer_eval(f(5) == 1); // expected-warning{{TRUE}} } @@ -27,14 +27,14 @@ int enumCheck(void); enum A { x, y, z }; -void testEnum() { +void testEnum(void) { clang_analyzer_eval(x == 0); // expected-warning{{TRUE}} clang_analyzer_eval(enumCheck() == 42); // expected-warning{{TRUE}} } // Test that asm import does not fail. -int inlineAsm(); -int testInlineAsm() { +int inlineAsm(void); +int testInlineAsm(void) { return inlineAsm(); } @@ -47,7 +47,7 @@ void testMacro(void) { // The external function prototype is incomplete. // warning:implicit functions are prohibited by c99 -void testImplicit() { +void testImplicit(void) { int res = identImplicit(6); // external implicit functions are not inlined clang_analyzer_eval(res == 6); // expected-warning{{TRUE}} // Call something with uninitialized from the same function in which the implicit was called. @@ -63,7 +63,7 @@ struct DataType { int b; }; int structInProto(struct DataType *d); -void testStructDefInArgument() { +void testStructDefInArgument(void) { struct DataType d; d.a = 1; d.b = 0; diff --git a/clang/test/Analysis/dead-stores.c b/clang/test/Analysis/dead-stores.c index 2ce94eb31b198b..701e0a58b84ed7 100644 --- a/clang/test/Analysis/dead-stores.c +++ b/clang/test/Analysis/dead-stores.c @@ -12,7 +12,7 @@ // RUN: -analyzer-config deadcode.DeadStores:ShowFixIts=true \ // RUN: -verify=non-nested,nested -void f1() { +void f1(void) { int k, y; // non-nested-warning {{unused variable 'k'}} // non-nested-warning@-1 {{unused variable 'y'}} int abc = 1; @@ -34,8 +34,8 @@ void f2(void *b) { // non-nested-note@-2 {{include the header or explicitly provide a declaration for 'printf'}} } -int f(); -void f3() { +int f(void); +void f3(void) { int r; if ((r = f()) != 0) { // no-warning int y = r; // no-warning @@ -50,7 +50,7 @@ void f4(int k) { k = 2; // non-nested-warning {{never read}} } -void f5() { +void f5(void) { int x = 4; // no-warning int *p = &x; // non-nested-warning {{never read}} // non-nested-warning@-1 {{unused variable 'p'}} @@ -58,7 +58,7 @@ void f5() { // CHECK-FIXES-NEXT: int *p; } -int f6() { +int f6(void) { int x = 4; ++x; // no-warning return 1; @@ -90,30 +90,30 @@ int f7d(int *p) { // Warn for dead stores in nested expressions. int f8(int *p) { - extern int *baz(); + extern int *baz(void); if ((p = baz())) // nested-warning {{Although the value stored}} return 1; return 0; } -int f9() { +int f9(void) { int x = 4; x = x + 10; // non-nested-warning {{never read}} return 1; } -int f10() { +int f10(void) { int x = 4; x = 10 + x; // non-nested-warning {{never read}} return 1; } -int f11() { +int f11(void) { int x = 4; return x++; // non-nested-warning {{never read}} } -int f11b() { +int f11b(void) { int x = 4; return ((((++x)))); // no-warning } @@ -171,7 +171,7 @@ int f16(int x) { } // Self-assignments should not be flagged as dead stores. -void f17() { +void f17(void) { int x = 1; x = x; } @@ -180,7 +180,7 @@ void f17() { // The values of dead stores are only "consumed" in an enclosing expression // what that value is actually used. In other words, don't say "Although the // value stored to 'x' is used...". -int f18() { +int f18(void) { int x = 0; // no-warning if (1) x = 10; // non-nested-warning {{Value stored to 'x' is never read}} @@ -193,24 +193,24 @@ int f18() { return (x = 10); // no-warning } -int f18_a() { +int f18_a(void) { int x = 0; // no-warning return (x = 10); // nested-warning {{Although the value stored}} } -void f18_b() { +void f18_b(void) { int x = 0; // no-warning if (1) x = 10; // non-nested-warning {{Value stored to 'x' is never read}} } -void f18_c() { +void f18_c(void) { int x = 0; while (1) x = 10; // non-nested-warning {{Value stored to 'x' is never read}} } -void f18_d() { +void f18_d(void) { int x = 0; // no-warning do x = 10; // non-nested-warning {{Value stored to 'x' is never read}} @@ -238,8 +238,8 @@ void f20(void) { #pragma unused(x) } -void halt() __attribute__((noreturn)); -int f21() { +void halt(void) __attribute__((noreturn)); +int f21(void) { int x = 4; x = x + 1; // non-nested-warning {{never read}} if (1) { @@ -250,7 +250,7 @@ int f21() { } int j; -void f22() { +void f22(void) { int x = 4; int y1 = 4; int y2 = 4; @@ -473,7 +473,7 @@ int f24_D(int y) { int f25(int y) { __block int x = (y > 2); __block int z = 0; - void (^foo)() = ^{ + void (^foo)(void) = ^{ z = x + y; }; x = 4; // no-warning @@ -492,7 +492,7 @@ int f25_b(int y) { return z; } -int f26_nestedblocks() { +int f26_nestedblocks(void) { int z; z = 1; __block int y = 0; @@ -508,7 +508,7 @@ int f26_nestedblocks() { // The FOREACH macro in QT uses 'break' statements within statement expressions // placed within the increment code of for loops. -void rdar8014335() { +void rdar8014335(void) { for (int i = 0 ; i != 10 ; ({ break; })) { for (;; ({ ++i; break; })) ; @@ -546,7 +546,7 @@ void rdar8320674(s_rdar8320674 *z, unsigned y, s2_rdar8320674 *st, int m) // Avoid dead stores resulting from an assignment (and use) being unreachable. void rdar8405222_aux(int i); -void rdar8405222() { +void rdar8405222(void) { const int show = 0; int i = 0; if (show) @@ -557,13 +557,13 @@ void rdar8405222() { // Look through chains of assignments, e.g.: int x = y = 0, when employing // silencing heuristics. -int radar11185138_foo() { +int radar11185138_foo(void) { int x, y; x = y = 0; // non-nested-warning {{never read}} return y; } -int rdar11185138_bar() { +int rdar11185138_bar(void) { int y; int x = y = 0; // nested-warning {{Although the value stored}} x = 2; @@ -571,15 +571,15 @@ int rdar11185138_bar() { return x + y; } -int *radar11185138_baz() { +int *radar11185138_baz(void) { int *x, *y; x = y = 0; // no-warning return y; } -int getInt(); -int *getPtr(); -void testBOComma() { +int getInt(void); +int *getPtr(void); +void testBOComma(void) { int x0 = (getInt(), 0); // non-nested-warning {{unused variable 'x0'}} int x1 = (getInt(), getInt()); // non-nested-warning@-1 {{Value stored to 'x1' during its initialization is never read}} @@ -631,7 +631,7 @@ void testBOComma() { p = (getPtr(), (int *)0); // no warning } -void testVolatile() { +void testVolatile(void) { volatile int v; v = 0; // no warning } @@ -654,7 +654,7 @@ int rdar34122265_test(int input) { return foo.x + foo.y; } -void rdar34122265_test_cast() { +void rdar34122265_test_cast(void) { // This is allowed for defensive programming. struct Foo foo = {0, 0}; (void)foo; diff --git a/clang/test/Analysis/dead-stores.m b/clang/test/Analysis/dead-stores.m index 27543ab38139bd..240479b8dc7584 100644 --- a/clang/test/Analysis/dead-stores.m +++ b/clang/test/Analysis/dead-stores.m @@ -45,8 +45,8 @@ void rdar_7631278(NSObject *x) { // This test case issuing a bogus warning for the declaration of 'isExec' // because the compound statement for the @synchronized was being visited // twice by the LiveVariables analysis. -BOOL baz_rdar8527823(); -void foo_rdar8527823(); +BOOL baz_rdar8527823(void); +void foo_rdar8527823(void); @interface RDar8527823 - (void) bar_rbar8527823; @end @@ -83,9 +83,9 @@ @interface RDar10591355 @property (assign) int x; @end -RDar10591355 *rdar10591355_aux(); +RDar10591355 *rdar10591355_aux(void); -void rdar10591355() { +void rdar10591355(void) { RDar10591355 *p = rdar10591355_aux(); ^{ (void) p.x; }(); } @@ -110,8 +110,8 @@ - (int*)usePath { } @end -id test_objc_precise_lifetime_foo(); -void test_objc_precise_lifetime() { +id test_objc_precise_lifetime_foo(void); +void test_objc_precise_lifetime(void) { __attribute__((objc_precise_lifetime)) id dead = test_objc_precise_lifetime_foo(); // no-warning dead = 0; dead = test_objc_precise_lifetime_foo(); // no-warning diff --git a/clang/test/Analysis/debug-exprinspection-istainted.c b/clang/test/Analysis/debug-exprinspection-istainted.c index e2f6821e4aa9ab..8d1ebca930885d 100644 --- a/clang/test/Analysis/debug-exprinspection-istainted.c +++ b/clang/test/Analysis/debug-exprinspection-istainted.c @@ -8,7 +8,7 @@ void clang_analyzer_isTainted(char); void clang_analyzer_isTainted_any_suffix(char); void clang_analyzer_isTainted_many_arguments(char, int, int); -void foo() { +void foo(void) { char buf[32] = ""; clang_analyzer_isTainted(buf[0]); // expected-warning {{NO}} clang_analyzer_isTainted_any_suffix(buf[0]); // expected-warning {{NO}} @@ -19,7 +19,7 @@ void foo() { int tainted_value = buf[0]; // no-warning } -void exactly_one_argument_required() { +void exactly_one_argument_required(void) { char buf[32] = ""; scanf("%s", buf); clang_analyzer_isTainted_many_arguments(buf[0], 42, 42); diff --git a/clang/test/Analysis/default-analyze.m b/clang/test/Analysis/default-analyze.m index e2f7297884d76a..7c3d6b99a22800 100644 --- a/clang/test/Analysis/default-analyze.m +++ b/clang/test/Analysis/default-analyze.m @@ -52,9 +52,9 @@ static __inline__ __attribute__((always_inline)) CGFloat NSHeight(NSRect aRect) return (aRect.size.height); } -NSSize rdar880566_size(); +NSSize rdar880566_size(void); -double rdar8808566() { +double rdar8808566(void) { NSRect myRect; myRect.size = rdar880566_size(); double x = NSWidth(myRect) + NSHeight(myRect); // no-warning diff --git a/clang/test/Analysis/default-diagnostic-visitors.c b/clang/test/Analysis/default-diagnostic-visitors.c index c8f64bc6d7f483..894684c9c504c0 100644 --- a/clang/test/Analysis/default-diagnostic-visitors.c +++ b/clang/test/Analysis/default-diagnostic-visitors.c @@ -2,7 +2,7 @@ // This file is for testing enhanced diagnostics produced by the default BugReporterVisitors. -int getPasswordAndItem() +int getPasswordAndItem(void) { int err = 0; int *password; // expected-note {{'password' declared without an initial value}} diff --git a/clang/test/Analysis/designated-initializer-values.c b/clang/test/Analysis/designated-initializer-values.c index 1efc10aece60f6..ebe6cd9797517e 100644 --- a/clang/test/Analysis/designated-initializer-values.c +++ b/clang/test/Analysis/designated-initializer-values.c @@ -2,7 +2,7 @@ void clang_analyzer_eval(int); -void array_init() { +void array_init(void) { int a[5] = {[4] = 29, [2] = 15, [0] = 4}; clang_analyzer_eval(a[0] == 4); // expected-warning{{TRUE}} clang_analyzer_eval(a[1] == 0); // expected-warning{{TRUE}} @@ -21,13 +21,13 @@ struct point { int x, y; }; -void struct_init() { +void struct_init(void) { struct point p = {.y = 5, .x = 3}; clang_analyzer_eval(p.x == 3); // expected-warning{{TRUE}} clang_analyzer_eval(p.y == 5); // expected-warning{{TRUE}} } -void array_of_struct() { +void array_of_struct(void) { struct point ptarray[3] = { [2].y = 1, [2].x = 2, [0].x = 3 }; clang_analyzer_eval(ptarray[0].x == 3); // expected-warning{{TRUE}} clang_analyzer_eval(ptarray[0].y == 0); // expected-warning{{TRUE}} diff --git a/clang/test/Analysis/designated-initializer.c b/clang/test/Analysis/designated-initializer.c index adca0ab6c87540..aba037a3f49bb7 100644 --- a/clang/test/Analysis/designated-initializer.c +++ b/clang/test/Analysis/designated-initializer.c @@ -3,12 +3,12 @@ struct Q { int a, b, c; }; union UQ { struct Q q; }; -union UQ getUQ() { +union UQ getUQ(void) { union UQ u = { { 1, 2, 3 } }; return u; } -void test() { +void test(void) { struct LUQ { union UQ uq; } var = { getUQ(), .uq.q.a = 100 }; struct Q s[] = { [0] = (struct Q){1, 2}, @@ -19,7 +19,7 @@ void test() { // CHECK: void test() // CHECK: [B1] // CHECK: 1: getUQ -// CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)()) +// CHECK: 2: [B1.1] (ImplicitCastExpr, FunctionToPointerDecay, union UQ (*)(void)) // CHECK: 3: [B1.2]() // CHECK: 4: 100 // CHECK: 5: /*no init*/ diff --git a/clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif b/clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif index a54c4539708caf..0f479418495007 100644 --- a/clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif +++ b/clang/test/Analysis/diagnostics/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif @@ -4,7 +4,7 @@ { "artifacts": [ { - "length": 1077, + "length": 1081, "location": { }, "mimeType": "text/plain", diff --git a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c index 597ad4fabbc4d7..ab1a8a814ee173 100644 --- a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c +++ b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.c @@ -7,7 +7,7 @@ struct S { int y; }; -int *foo(); +int *foo(void); void test(struct S syz, int *pp) { int m = 0; diff --git a/clang/test/Analysis/diagnostics/false-positive-suppression.c b/clang/test/Analysis/diagnostics/false-positive-suppression.c index 87c04cbcdc0749..248b8154dced5d 100644 --- a/clang/test/Analysis/diagnostics/false-positive-suppression.c +++ b/clang/test/Analysis/diagnostics/false-positive-suppression.c @@ -6,7 +6,7 @@ typedef __typeof(sizeof(int)) size_t; void *malloc(size_t); -int radar12491259() { +int radar12491259(void) { int *p = malloc(12); FREE_POINTER(p); FREE_POINTER(p); // no-warning: we are suppressing errors coming from sys/queue macros. @@ -15,7 +15,7 @@ int radar12491259() { #define MYMACRO(p) FREE_POINTER(p) -int radar12491259_inside_macro() { +int radar12491259_inside_macro(void) { int *p = malloc(12); MYMACRO(p); MYMACRO(p); // no-warning: we are suppressing errors coming from sys/queue macros. diff --git a/clang/test/Analysis/diagnostics/find_last_store.c b/clang/test/Analysis/diagnostics/find_last_store.c index 486e4ec64d1691..e6162f5472cf21 100644 --- a/clang/test/Analysis/diagnostics/find_last_store.c +++ b/clang/test/Analysis/diagnostics/find_last_store.c @@ -1,11 +1,11 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-output=text -verify %s typedef struct { float b; } c; -void *a(); -void *d() { +void *a(void); +void *d(void) { return a(); } -void no_find_last_store() { +void no_find_last_store(void) { c *e = d(); // expected-note{{'e' initialized here}} (void)(e || e->b); // expected-note{{Assuming 'e' is null}} diff --git a/clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp b/clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp index a2928f15c1e33d..06a2e895bc9a0d 100644 --- a/clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp +++ b/clang/test/Analysis/diagnostics/macro-null-return-suppression.cpp @@ -2,7 +2,7 @@ #define NULL 0 -int test_noparammacro() { +int test_noparammacro(void) { int *x = NULL; // expected-note{{'x' initialized to a null pointer value}} return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} // expected-note@-1{{Dereference of null pointer (loaded from variable 'x')}} @@ -22,7 +22,7 @@ char test_declaration(int *param) { return *param2; } -int coin(); +int coin(void); int test_multi_decl(int *paramA, int *paramB) { char *param1 = DYN_CAST(paramA), *param2 = DYN_CAST(paramB); @@ -38,7 +38,7 @@ int testDivision(int a) { } // Warning should not be suppressed if it happens in the same macro. -#define DEREF_IN_MACRO(X) int fn() {int *p = 0; return *p; } +#define DEREF_IN_MACRO(X) int fn(void) {int *p = 0; return *p; } DEREF_IN_MACRO(0) // expected-warning{{Dereference of null pointer}} // expected-note@-1{{'p' initialized to a null}} @@ -47,8 +47,8 @@ DEREF_IN_MACRO(0) // expected-warning{{Dereference of null pointer}} // Warning should not be suppressed if the null returned by the macro // is not related to the warning. #define RETURN_NULL() (0) -extern int* returnFreshPointer(); -int noSuppressMacroUnrelated() { +extern int* returnFreshPointer(void); +int noSuppressMacroUnrelated(void) { int *x = RETURN_NULL(); x = returnFreshPointer(); // expected-note{{Value assigned to 'x'}} if (x) {} // expected-note{{Taking false branch}} @@ -59,7 +59,7 @@ int noSuppressMacroUnrelated() { // Value haven't changed by the assignment, but the null pointer // did not come from the macro. -int noSuppressMacroUnrelatedOtherReason() { +int noSuppressMacroUnrelatedOtherReason(void) { int *x = RETURN_NULL(); x = returnFreshPointer(); x = 0; // expected-note{{Null pointer value stored to 'x'}} diff --git a/clang/test/Analysis/diagnostics/no-prune-paths.c b/clang/test/Analysis/diagnostics/no-prune-paths.c index 6e9e45766bf5a7..8f807922176e12 100644 --- a/clang/test/Analysis/diagnostics/no-prune-paths.c +++ b/clang/test/Analysis/diagnostics/no-prune-paths.c @@ -4,12 +4,12 @@ // "prune-paths" is a debug option only; this is just a simple test to see that // it's being honored. -void helper() { - extern void foo(); +void helper(void) { + extern void foo(void); foo(); } -void test() { +void test(void) { helper(); #if NPRUNE // expected-note@-2 {{Calling 'helper'}} diff --git a/clang/test/Analysis/diagnostics/no-store-func-path-notes.c b/clang/test/Analysis/diagnostics/no-store-func-path-notes.c index fd0a90e85e2912..2aa95fe2d6175a 100644 --- a/clang/test/Analysis/diagnostics/no-store-func-path-notes.c +++ b/clang/test/Analysis/diagnostics/no-store-func-path-notes.c @@ -14,7 +14,7 @@ int initializer1(int *p, int x) { } } -int param_not_initialized_by_func() { +int param_not_initialized_by_func(void) { int p; // expected-note {{'p' declared without an initial value}} int out = initializer1(&p, 0); // expected-note{{Calling 'initializer1'}} // expected-note@-1{{Returning from 'initializer1'}} @@ -22,7 +22,7 @@ int param_not_initialized_by_func() { // expected-warning@-1{{Undefined or garbage value returned to caller}} } -int param_initialized_properly() { +int param_initialized_properly(void) { int p; int out = initializer1(&p, 1); return p; //no-warning @@ -40,7 +40,7 @@ int initializer2(int **p, int x) { } } -int param_not_written_into_by_func() { +int param_not_written_into_by_func(void) { int *p = 0; // expected-note{{'p' initialized to a null pointer value}} int out = initializer2(&p, 0); // expected-note{{Calling 'initializer2'}} // expected-note@-1{{Returning from 'initializer2'}} @@ -54,7 +54,7 @@ void initializer3(int *p, int param) { *p = 0; } // expected-note{{Returning without writing to '*p'}} -int param_written_into_by_void_func() { +int param_written_into_by_void_func(void) { int p; // expected-note{{'p' declared without an initial value}} initializer3(&p, 0); // expected-note{{Calling 'initializer3'}} // expected-note@-1{{Returning from 'initializer3'}} @@ -74,7 +74,7 @@ void initializer5(int *p, int param) { *p = 0; } // expected-note{{Returning without writing to '*p'}} -int multi_init_tries_func() { +int multi_init_tries_func(void) { int p; // expected-note{{'p' declared without an initial value}} initializer4(&p, 0); // expected-note{{Calling 'initializer4'}} // expected-note@-1{{Returning from 'initializer4'}} @@ -88,7 +88,7 @@ int initializer6(const int *p) { return 0; } -int no_msg_on_const() { +int no_msg_on_const(void) { int p; // expected-note{{'p' declared without an initial value}} initializer6(&p); return p; // expected-warning{{Undefined or garbage value returned to caller}} @@ -108,7 +108,7 @@ int initializer7(S *s, int param) { return 1; // expected-note{{Returning without writing to 's->x'}} } -int initialize_struct_field() { +int initialize_struct_field(void) { S local; initializer7(&local, 0); // expected-note{{Calling 'initializer7'}} // expected-note@-1{{Returning from 'initializer7'}} @@ -120,7 +120,7 @@ void nullwriter(int **p) { *p = 0; // expected-note{{Null pointer value stored to 'p'}} } // no extra note -int usage() { +int usage(void) { int x = 0; int *p = &x; nullwriter(&p); // expected-note{{Calling 'nullwriter'}} @@ -138,7 +138,7 @@ void partial_initializer(A *a) { a->x = 0; } // expected-note{{Returning without writing to 'a->y'}} -int use_partial_initializer() { +int use_partial_initializer(void) { A a; partial_initializer(&a); // expected-note{{Calling 'partial_initializer'}} // expected-note@-1{{Returning from 'partial_initializer'}} @@ -159,7 +159,7 @@ void partial_nested_initializer(C *c) { c->b.x = 0; } // expected-note{{Returning without writing to 'c->b.y'}} -int use_partial_nested_initializer() { +int use_partial_nested_initializer(void) { B localB; C localC; localC.b = localB; @@ -174,7 +174,7 @@ void test_subregion_assignment(C* c) { c->b = b; } -int use_subregion_assignment() { +int use_subregion_assignment(void) { C c; test_subregion_assignment(&c); // expected-note{{Calling 'test_subregion_assignment'}} // expected-note@-1{{Returning from 'test_subregion_assignment'}} @@ -187,7 +187,7 @@ int confusing_signature(int *p) { return 0; // expected-note{{Returning without writing to '*p'}} } -int use_confusing_signature() { +int use_confusing_signature(void) { int a; // expected-note {{'a' declared without an initial value}} confusing_signature(&a); // expected-note{{Calling 'confusing_signature'}} // expected-note@-1{{Returning from 'confusing_signature'}} @@ -195,7 +195,7 @@ int use_confusing_signature() { // expected-warning@-1{{Undefined or garbage value returned to caller}} } -int coin(); +int coin(void); int multiindirection(int **p) { if (coin()) // expected-note{{Assuming the condition is true}} @@ -205,7 +205,7 @@ int multiindirection(int **p) { return 0; } -int usemultiindirection() { +int usemultiindirection(void) { int a; // expected-note {{'a' declared without an initial value}} int *b = &a; multiindirection(&b); // expected-note{{Calling 'multiindirection'}} @@ -223,7 +223,7 @@ int indirectingstruct(S** s) { return 0; } -int useindirectingstruct() { +int useindirectingstruct(void) { S s; S* p = &s; indirectingstruct(&p); //expected-note{{Calling 'indirectingstruct'}} @@ -242,7 +242,7 @@ void initializeMaybeInStruct(D* pD) { *pD->x = 120; } // expected-note{{Returning without writing to 'pD->x'}} -int useInitializeMaybeInStruct() { +int useInitializeMaybeInStruct(void) { int z; // expected-note{{'z' declared without an initial value}} D d; d.x = &z; diff --git a/clang/test/Analysis/diagnostics/no-store-func-path-notes.m b/clang/test/Analysis/diagnostics/no-store-func-path-notes.m index 6ef162e4ecd50a..4826b38b98a56b 100644 --- a/clang/test/Analysis/diagnostics/no-store-func-path-notes.m +++ b/clang/test/Analysis/diagnostics/no-store-func-path-notes.m @@ -2,7 +2,7 @@ #include "../Inputs/system-header-simulator-for-nullability.h" -extern int coin(); +extern int coin(void); @interface I : NSObject - (int)initVar:(int *)var param:(int)param; @@ -41,7 +41,7 @@ int initializer1(int *p, int x) { } } -int initFromBlock() { +int initFromBlock(void) { __block int z; ^{ // expected-note {{Calling anonymous block}} int p; // expected-note{{'p' declared without an initial value}} diff --git a/clang/test/Analysis/diagnostics/plist-multi-file.c b/clang/test/Analysis/diagnostics/plist-multi-file.c index fc1d581562bd6c..8473d6bf02017e 100644 --- a/clang/test/Analysis/diagnostics/plist-multi-file.c +++ b/clang/test/Analysis/diagnostics/plist-multi-file.c @@ -3,6 +3,6 @@ #include "plist-multi-file.h" -void bar() { +void bar(void) { foo(0); } diff --git a/clang/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c b/clang/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c index 542a8087c4f2de..61d19817407e27 100644 --- a/clang/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c +++ b/clang/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c @@ -30,7 +30,7 @@ int leak(int i) { return 0; } -int unicode() { +int unicode(void) { int løçål = 0; /* ☃ */ return 1 / løçål; // expected-warning {{Division by zero}} } diff --git a/clang/test/Analysis/diagnostics/shortest-path-suppression.c b/clang/test/Analysis/diagnostics/shortest-path-suppression.c index d0fa4b51ef4489..8f8a803854ad9d 100644 --- a/clang/test/Analysis/diagnostics/shortest-path-suppression.c +++ b/clang/test/Analysis/diagnostics/shortest-path-suppression.c @@ -1,8 +1,8 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core -analyzer-config suppress-null-return-paths=true -analyzer-output=text -verify %s // expected-no-diagnostics -int *returnNull() { return 0; } -int coin(); +int *returnNull(void) { return 0; } +int coin(void); // Use a float parameter to ensure that the value is unknown. This will create // a cycle in the generated ExplodedGraph. diff --git a/clang/test/Analysis/diagnostics/text-diagnostics.c b/clang/test/Analysis/diagnostics/text-diagnostics.c index 01946476e099f0..35167b85b24028 100644 --- a/clang/test/Analysis/diagnostics/text-diagnostics.c +++ b/clang/test/Analysis/diagnostics/text-diagnostics.c @@ -1,6 +1,6 @@ // RUN: %clang_analyze_cc1 -analyzer-checker=core.NullDereference -analyzer-output=text -fno-caret-diagnostics %s 2>&1 | FileCheck %s -void testA() { +void testA(void) { int *p = 0; *p = 1; diff --git a/clang/test/Analysis/diagnostics/undef-value-callee.h b/clang/test/Analysis/diagnostics/undef-value-callee.h index ea48c46a62c123..9fbff259204030 100644 --- a/clang/test/Analysis/diagnostics/undef-value-callee.h +++ b/clang/test/Analysis/diagnostics/undef-value-callee.h @@ -1,4 +1,4 @@ -void callee() { +void callee(void) { ; } diff --git a/clang/test/Analysis/diagnostics/undef-value-param.c b/clang/test/Analysis/diagnostics/undef-value-param.c index 1c755157e1eb2b..e88e3c98ecfc59 100644 --- a/clang/test/Analysis/diagnostics/undef-value-param.c +++ b/clang/test/Analysis/diagnostics/undef-value-param.c @@ -43,7 +43,7 @@ int testPassingParentRegionArray(int x) { //expected-note@-1 {{The right operand of '*' is a garbage value}} } -double *getValidPtr(); +double *getValidPtr(void); struct WithFields { double *f1; }; diff --git a/clang/test/Analysis/disable-all-checks.c b/clang/test/Analysis/disable-all-checks.c index 4d1c625ef1f1ab..be56ffa4045e92 100644 --- a/clang/test/Analysis/disable-all-checks.c +++ b/clang/test/Analysis/disable-all-checks.c @@ -14,7 +14,7 @@ // CHECK: no analyzer checkers or packages are associated with 'non.existant.Checker' // CHECK: use -analyzer-disable-all-checks to disable all static analyzer checkers -int buggy() { +int buggy(void) { int x = 0; return 5/x; // no warning } diff --git a/clang/test/Analysis/dispatch-once.m b/clang/test/Analysis/dispatch-once.m index b8cf582ba468e3..fa84f563815dd6 100644 --- a/clang/test/Analysis/dispatch-once.m +++ b/clang/test/Analysis/dispatch-once.m @@ -19,17 +19,17 @@ typedef long dispatch_once_t; void dispatch_once(dispatch_once_t *predicate, dispatch_block_t block); -void test_stack() { +void test_stack(void) { dispatch_once_t once; dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the local variable 'once' for the predicate value. Using such transient memory for the predicate is potentially dangerous. Perhaps you intended to declare the variable as 'static'?}} } -void test_static_local() { +void test_static_local(void) { static dispatch_once_t once; dispatch_once(&once, ^{}); // no-warning } -void test_heap_var() { +void test_heap_var(void) { dispatch_once_t *once = calloc(1, sizeof(dispatch_once_t)); // Use regexps to check that we're NOT suggesting to make this static. dispatch_once(once, ^{}); // expected-warning-re{{{{^Call to 'dispatch_once' uses heap-allocated memory for the predicate value. Using such transient memory for the predicate is potentially dangerous$}}}} @@ -44,12 +44,12 @@ void test_external_pointer(dispatch_once_t *once) { dispatch_once_t once; } Struct; -void test_local_struct() { +void test_local_struct(void) { Struct s; dispatch_once(&s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the local variable 's' for the predicate value.}} } -void test_heap_struct() { +void test_heap_struct(void) { Struct *s = calloc(1, sizeof(Struct)); dispatch_once(&s->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses heap-allocated memory for the predicate value.}} } @@ -76,15 +76,15 @@ - (void)test_ivar_array_from_inside { } @end -void test_ivar_from_alloc_init() { +void test_ivar_from_alloc_init(void) { Object *o = [[Object alloc] init]; dispatch_once(&o->once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the instance variable 'once' for the predicate value.}} } -void test_ivar_struct_from_alloc_init() { +void test_ivar_struct_from_alloc_init(void) { Object *o = [[Object alloc] init]; dispatch_once(&o->s.once, ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 's' for the predicate value.}} } -void test_ivar_array_from_alloc_init() { +void test_ivar_array_from_alloc_init(void) { Object *o = [[Object alloc] init]; dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}} } @@ -100,7 +100,7 @@ void test_ivar_array_from_external_obj(Object *o) { dispatch_once(&o->once_array[1], ^{}); // expected-warning{{Call to 'dispatch_once' uses memory within the instance variable 'once_array' for the predicate value.}} } -void test_block_var_from_block() { +void test_block_var_from_block(void) { __block dispatch_once_t once; ^{ dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}} @@ -109,7 +109,7 @@ void test_block_var_from_block() { void use_block_var(dispatch_once_t *once); -void test_block_var_from_outside_block() { +void test_block_var_from_outside_block(void) { __block dispatch_once_t once; ^{ use_block_var(&once); @@ -117,7 +117,7 @@ void test_block_var_from_outside_block() { dispatch_once(&once, ^{}); // expected-warning{{Call to 'dispatch_once' uses the block variable 'once' for the predicate value.}} } -void test_static_var_from_outside_block() { +void test_static_var_from_outside_block(void) { static dispatch_once_t once; ^{ dispatch_once(&once, ^{}); // no-warning diff --git a/clang/test/Analysis/domtest.c b/clang/test/Analysis/domtest.c index b642bd35319cf2..77b2685e98c9e8 100644 --- a/clang/test/Analysis/domtest.c +++ b/clang/test/Analysis/domtest.c @@ -5,7 +5,7 @@ // RUN: 2>&1 | FileCheck %s // Test the DominatorsTree implementation with various control flows -int test1() +int test1(void) { int x = 6; int y = x/2; @@ -65,7 +65,7 @@ int test1() // CHECK-NEXT: (8,7) // CHECK-NEXT: (9,8) -int test2() +int test2(void) { int x,y,z; @@ -117,7 +117,7 @@ int test2() // CHECK-NEXT: (6,1) // CHECK-NEXT: (7,6) -int test3() +int test3(void) { int x,y,z; @@ -178,7 +178,7 @@ int test3() // CHECK-NEXT: (7,1) // CHECK-NEXT: (8,7) -int test4() +int test4(void) { int y = 3; while(y > 0) { @@ -257,7 +257,7 @@ int test4() // CHECK-NEXT: (11,10) // CHECK-NEXT: (12,11) -int test5() +int test5(void) { int x,y,z,a,b,c; x = 1; diff --git a/clang/test/Analysis/double-ranges-bug.c b/clang/test/Analysis/double-ranges-bug.c index aa3dde29303486..a73d2ff949eda9 100644 --- a/clang/test/Analysis/double-ranges-bug.c +++ b/clang/test/Analysis/double-ranges-bug.c @@ -6,7 +6,7 @@ typedef unsigned long int A; extern int fill(A **values, int *nvalues); -void foo() { +void foo(void) { A *values; int nvalues; fill(&values, &nvalues); diff --git a/clang/test/Analysis/dump_egraph.c b/clang/test/Analysis/dump_egraph.c index d6f252af8e765d..a2a916d0f00857 100644 --- a/clang/test/Analysis/dump_egraph.c +++ b/clang/test/Analysis/dump_egraph.c @@ -9,9 +9,9 @@ // REQUIRES: asserts -int getJ(); +int getJ(void); -int foo() { +int foo(void) { int *x = 0, *y = 0; char c = '\x13'; diff --git a/clang/test/Analysis/elementtype.c b/clang/test/Analysis/elementtype.c index 7eba8e14b3a7f4..47f2ca1d90820e 100644 --- a/clang/test/Analysis/elementtype.c +++ b/clang/test/Analysis/elementtype.c @@ -5,7 +5,7 @@ typedef struct added_obj_st { } ADDED_OBJ; // Test if we are using the canonical type for ElementRegion. -void f() { +void f(void) { ADDED_OBJ *ao[4]={((void*)0),((void*)0),((void*)0),((void*)0)}; if (ao[0] != ((void*)0)) { ao[0]->type=0; diff --git a/clang/test/Analysis/enum-cast-out-of-range.c b/clang/test/Analysis/enum-cast-out-of-range.c index 03e1100c38f497..3282cba653d712 100644 --- a/clang/test/Analysis/enum-cast-out-of-range.c +++ b/clang/test/Analysis/enum-cast-out-of-range.c @@ -10,7 +10,7 @@ enum En_t { En_4 = 4 }; -void unscopedUnspecifiedCStyle() { +void unscopedUnspecifiedCStyle(void) { enum En_t Below = (enum En_t)(-5); // expected-warning {{not in the valid range}} enum En_t NegVal1 = (enum En_t)(-4); // OK. enum En_t NegVal2 = (enum En_t)(-3); // OK. @@ -25,7 +25,7 @@ void unscopedUnspecifiedCStyle() { } enum En_t unused; -void unusedExpr() { +void unusedExpr(void) { // Following line is not something that EnumCastOutOfRangeChecker should // evaluate. Checker should either ignore this line or process it without // producing any warnings. However, compilation will (and should) still diff --git a/clang/test/Analysis/equality_tracking.c b/clang/test/Analysis/equality_tracking.c index bf84e51ce7023f..681453b1fe29bf 100644 --- a/clang/test/Analysis/equality_tracking.c +++ b/clang/test/Analysis/equality_tracking.c @@ -9,9 +9,9 @@ #define CHAR_MIN (char)(UCHAR_MAX & ~(UCHAR_MAX >> 1)) void clang_analyzer_eval(int); -void clang_analyzer_warnIfReached(); +void clang_analyzer_warnIfReached(void); -int getInt(); +int getInt(void); void zeroImpliesEquality(int a, int b) { clang_analyzer_eval((a - b) == 0); // expected-warning{{UNKNOWN}} diff --git a/clang/test/Analysis/exercise-ps.c b/clang/test/Analysis/exercise-ps.c index 9bcda12b0b26df..6d1b40f13cd33e 100644 --- a/clang/test/Analysis/exercise-ps.c +++ b/clang/test/Analysis/exercise-ps.c @@ -15,7 +15,7 @@ static void f1(const char *x, char *y) { // the RvalueType of an ElementRegion. typedef struct F12_struct {} F12_typedef; typedef void* void_typedef; -void_typedef f2_helper(); +void_typedef f2_helper(void); static void f2(void *buf) { F12_typedef* x; x = f2_helper(); diff --git a/clang/test/Analysis/explain-svals.m b/clang/test/Analysis/explain-svals.m index 52f48c5e504f23..e93258b3626a56 100644 --- a/clang/test/Analysis/explain-svals.m +++ b/clang/test/Analysis/explain-svals.m @@ -21,7 +21,7 @@ void test_1(Object *p) { clang_analyzer_explain(q->x); // expected-warning-re{{{{^initial value of instance variable 'x' of object at symbol of type 'Object \*' conjured at statement '\[\[Object alloc\] init\]'$}}}} } -void test_2() { +void test_2(void) { __block int x; ^{ clang_analyzer_explain(&x); // expected-warning-re{{{{^pointer to block variable 'x'$}}}} diff --git a/clang/test/PCH/decl-in-prototype.c b/clang/test/PCH/decl-in-prototype.c index a291bf2df839f5..865775a8fdbddb 100644 --- a/clang/test/PCH/decl-in-prototype.c +++ b/clang/test/PCH/decl-in-prototype.c @@ -20,7 +20,7 @@ static inline __attribute__((always_inline)) f(enum { x, y } p) { #else -int main() { +int main(void) { return f(0); } diff --git a/clang/test/PCH/designated-init.c.h b/clang/test/PCH/designated-init.c.h index 18216279c2e9f2..8a524ae1e971fa 100644 --- a/clang/test/PCH/designated-init.c.h +++ b/clang/test/PCH/designated-init.c.h @@ -54,8 +54,8 @@ struct P1 l1 = { .q.b = { [1] = 'x' } }; -extern struct Q1 *foo(); -static struct P1 test_foo() { +extern struct Q1 *foo(void); +static struct P1 test_foo(void) { struct P1 l = { *foo(), .q.b = { "boo" }, .q.b = { [1] = 'x' } diff --git a/clang/test/PCH/different-diagnostic-level.c b/clang/test/PCH/different-diagnostic-level.c index ac1a0daab164f7..22093baf5c545c 100644 --- a/clang/test/PCH/different-diagnostic-level.c +++ b/clang/test/PCH/different-diagnostic-level.c @@ -8,7 +8,7 @@ extern int foo; #else -void f() { +void f(void) { int a = foo; // Make sure we parsed this by getting an error. int b = bar; // expected-error {{undeclared}} diff --git a/clang/test/PCH/different-linker-version.c b/clang/test/PCH/different-linker-version.c index 9e2f38f674a4ae..4ffcd99a3de846 100644 --- a/clang/test/PCH/different-linker-version.c +++ b/clang/test/PCH/different-linker-version.c @@ -8,7 +8,7 @@ extern int foo; #else -void f() { +void f(void) { int a = foo; // Make sure we parsed this by getting an error. int b = bar; // expected-error {{undeclared}} diff --git a/clang/test/PCH/emit-dependencies.c b/clang/test/PCH/emit-dependencies.c index c4bccf8bb1a69c..8f44e61433ac53 100644 --- a/clang/test/PCH/emit-dependencies.c +++ b/clang/test/PCH/emit-dependencies.c @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -include-pch %t.pch -fsyntax-only -MT %s.o -dependency-file - %s | FileCheck %s // CHECK: chain-decls1.h -int main() { +int main(void) { f(); return 0; } diff --git a/clang/test/PCH/enum.c b/clang/test/PCH/enum.c index 81dbd907ac786a..9e7fbe92c25f3a 100644 --- a/clang/test/PCH/enum.c +++ b/clang/test/PCH/enum.c @@ -9,7 +9,7 @@ int i = Red; -int return_enum_constant() { +int return_enum_constant(void) { int result = aRoundShape; return result; } diff --git a/clang/test/PCH/exprs.c b/clang/test/PCH/exprs.c index c0b279f88a381f..1244b2faaf7f26 100644 --- a/clang/test/PCH/exprs.c +++ b/clang/test/PCH/exprs.c @@ -30,7 +30,7 @@ floating_literal *double_ptr = &floating; imaginary_literal *cdouble_ptr = &floating_complex; // StringLiteral -const char* printHello() { +const char* printHello(void) { return hello; } diff --git a/clang/test/PCH/externally-retained.m b/clang/test/PCH/externally-retained.m index 6442c5181ee3fa..1c5d985a286580 100644 --- a/clang/test/PCH/externally-retained.m +++ b/clang/test/PCH/externally-retained.m @@ -23,7 +23,7 @@ #else //===----------------------------------------------------------------------===// -void callDoSomething() { +void callDoSomething(void) { doSomething(sharedObject); } diff --git a/clang/test/PCH/field-designator.c b/clang/test/PCH/field-designator.c index 6f318fd3c82aa7..f0486ec162d5f5 100644 --- a/clang/test/PCH/field-designator.c +++ b/clang/test/PCH/field-designator.c @@ -27,7 +27,7 @@ struct U { #endif //===----------------------------------------------------------------------===// -void bar() { +void bar(void) { static const struct U plan = { .e = 1 }; } diff --git a/clang/test/PCH/format-strings.c b/clang/test/PCH/format-strings.c index 7198c4d3a2638c..679d1cf53d083c 100644 --- a/clang/test/PCH/format-strings.c +++ b/clang/test/PCH/format-strings.c @@ -11,7 +11,7 @@ extern int printf(const char *restrict, ...); #else -void foo() { +void foo(void) { LOG; } diff --git a/clang/test/PCH/multiple-include-pch.c b/clang/test/PCH/multiple-include-pch.c index 1ef17b9c675004..1e07b4f5ebce61 100644 --- a/clang/test/PCH/multiple-include-pch.c +++ b/clang/test/PCH/multiple-include-pch.c @@ -11,7 +11,7 @@ extern int x; #warning parsed this // expected-warning@-1 {{parsed this}} -int foo() { +int foo(void) { return x; } diff --git a/clang/test/PCH/nonvisible-external-defs.h b/clang/test/PCH/nonvisible-external-defs.h index a36fc2ea468c16..bb25a3d884267b 100644 --- a/clang/test/PCH/nonvisible-external-defs.h +++ b/clang/test/PCH/nonvisible-external-defs.h @@ -6,6 +6,6 @@ -void f() { +void f(void) { extern int g(int, int); } diff --git a/clang/test/PCH/objc_container.h b/clang/test/PCH/objc_container.h index c83f90238b6efa..51f42d146ce259 100644 --- a/clang/test/PCH/objc_container.h +++ b/clang/test/PCH/objc_container.h @@ -10,7 +10,7 @@ - (void)setObject:(id)object forKeyedSubscript:(id)key; @end -void all() { +void all(void) { NSMutableArray *array; id oldObject = array[10]; diff --git a/clang/test/PCH/objc_import.m b/clang/test/PCH/objc_import.m index 724c8221848b42..bdba92c0c805d3 100644 --- a/clang/test/PCH/objc_import.m +++ b/clang/test/PCH/objc_import.m @@ -9,7 +9,7 @@ #import "objc_import.h" -void func() { +void func(void) { TestPCH *xx; xx = [TestPCH alloc]; diff --git a/clang/test/PCH/objc_literals.m b/clang/test/PCH/objc_literals.m index df3d4ba745d739..3efef199626514 100644 --- a/clang/test/PCH/objc_literals.m +++ b/clang/test/PCH/objc_literals.m @@ -41,7 +41,7 @@ + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count @end // CHECK-IR: define internal {{.*}}void @test_numeric_literals() -static inline void test_numeric_literals() { +static inline void test_numeric_literals(void) { // CHECK-PRINT: id intlit = @17 // CHECK-IR: {{call.*17}} id intlit = @17; @@ -50,18 +50,18 @@ static inline void test_numeric_literals() { id floatlit = @17.45; } -static inline void test_array_literals() { +static inline void test_array_literals(void) { // CHECK-PRINT: id arraylit = @[ @17, @17.449999999999999 id arraylit = @[@17, @17.45]; } -static inline void test_dictionary_literals() { +static inline void test_dictionary_literals(void) { // CHECK-PRINT: id dictlit = @{ @17 : {{@17.449999999999999[^,]*}}, @"hello" : @"world" }; id dictlit = @{@17 : @17.45, @"hello" : @"world" }; } #else -void test_all() { +void test_all(void) { test_numeric_literals(); test_array_literals(); test_dictionary_literals(); diff --git a/clang/test/PCH/objc_methods.m b/clang/test/PCH/objc_methods.m index ea40460fb8df1f..1543e022f1992f 100644 --- a/clang/test/PCH/objc_methods.m +++ b/clang/test/PCH/objc_methods.m @@ -7,7 +7,7 @@ // expected-no-diagnostics -void func() { +void func(void) { TestPCH *xx; TestForwardClassDecl *yy; // FIXME: diff --git a/clang/test/PCH/objc_property.m b/clang/test/PCH/objc_property.m index 88a091928050f7..67f2e20a783674 100644 --- a/clang/test/PCH/objc_property.m +++ b/clang/test/PCH/objc_property.m @@ -7,7 +7,7 @@ // expected-no-diagnostics -void func() { +void func(void) { TestProperties *xx = [TestProperties alloc]; xx.value = 5; } diff --git a/clang/test/PCH/pch-dir.c b/clang/test/PCH/pch-dir.c index 944753c9c9c0e3..f8b8c05878f454 100644 --- a/clang/test/PCH/pch-dir.c +++ b/clang/test/PCH/pch-dir.c @@ -21,7 +21,7 @@ // CHECK-CBAR: int bar int FOO; -int get() { +int get(void) { #ifdef __cplusplus // CHECK-CPP: .h.gch{{[/\\]}}cpp.gch return i; diff --git a/clang/test/PCH/pragma-diag.c b/clang/test/PCH/pragma-diag.c index 601c940cee9b3b..8758442ecaa499 100644 --- a/clang/test/PCH/pragma-diag.c +++ b/clang/test/PCH/pragma-diag.c @@ -14,7 +14,7 @@ #else -void f() { +void f(void) { int a = 0; int b = a==a; } diff --git a/clang/test/PCH/pragma-optimize.c b/clang/test/PCH/pragma-optimize.c index 9570117448e2a0..ae5ff10a8d31b0 100644 --- a/clang/test/PCH/pragma-optimize.c +++ b/clang/test/PCH/pragma-optimize.c @@ -21,7 +21,7 @@ int a; -void f() { +void f(void) { a = 12345; } diff --git a/clang/test/PCH/rdar8852495.c b/clang/test/PCH/rdar8852495.c index 7639f1f0db6598..9ad4402429800d 100644 --- a/clang/test/PCH/rdar8852495.c +++ b/clang/test/PCH/rdar8852495.c @@ -17,7 +17,7 @@ #else -int f() { +int f(void) { int a; int b = a==a; unsigned x; diff --git a/clang/test/PCH/struct.c b/clang/test/PCH/struct.c index 3e9d1883323462..3a78e077c116ee 100644 --- a/clang/test/PCH/struct.c +++ b/clang/test/PCH/struct.c @@ -11,7 +11,7 @@ float getX(struct Point *p1) { return p1->x; } -void *get_fun_ptr() { +void *get_fun_ptr(void) { return fun->is_ptr? fun->ptr : 0; } @@ -19,7 +19,7 @@ struct Fun2 { int very_fun; }; -int get_very_fun() { +int get_very_fun(void) { return fun2->very_fun; } diff --git a/clang/test/PCH/subscripting-literals.m b/clang/test/PCH/subscripting-literals.m index 52491dbc2008f3..d9f848d183b876 100644 --- a/clang/test/PCH/subscripting-literals.m +++ b/clang/test/PCH/subscripting-literals.m @@ -53,7 +53,7 @@ void testDict(NSString *key, id newObject, id oldObject) { NSDictionary *dict = @{ key: newObject, key: oldObject }; } -void testBoxableValue() { +void testBoxableValue(void) { some_struct ss; id value = @(ss); } diff --git a/clang/test/PCH/typo.m b/clang/test/PCH/typo.m index 876b9438d1b7cd..857ae543f0736d 100644 --- a/clang/test/PCH/typo.m +++ b/clang/test/PCH/typo.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -x objective-c-header -emit-pch -o %t %S/Inputs/typo.h // RUN: %clang_cc1 -include-pch %t -verify %s -void f() { +void f(void) { [NSstring alloc]; // expected-error{{unknown receiver 'NSstring'; did you mean 'NSString'?}} // expected-note@Inputs/typo.h:3{{declared here}} } diff --git a/clang/test/PCH/undefined-internal.c b/clang/test/PCH/undefined-internal.c index ef514606dcbb49..242b1074e282a6 100644 --- a/clang/test/PCH/undefined-internal.c +++ b/clang/test/PCH/undefined-internal.c @@ -2,14 +2,14 @@ // RUN: %clang_cc1 -include-pch %t %s -verify #ifndef HEADER_H #define HEADER_H -static void f(); -static void g(); -void h() { +static void f(void); +static void g(void); +void h(void) { f(); g(); } #else -static void g() {} +static void g(void) {} // expected-warning@5{{function 'f' has internal linkage but is not defined}} // expected-note@8{{used here}} #endif diff --git a/clang/test/Preprocessor/extension-warning.c b/clang/test/Preprocessor/extension-warning.c index 4ba57f78f77d39..5fe905c8435dfd 100644 --- a/clang/test/Preprocessor/extension-warning.c +++ b/clang/test/Preprocessor/extension-warning.c @@ -15,4 +15,4 @@ TY(1) x; // FIXME: And we should warn here // Current list of keywords this can trigger on: // inline, restrict, asm, typeof, _asm -void whatever() {} +void whatever(void) {} diff --git a/clang/test/Preprocessor/macro_raw_string.cpp b/clang/test/Preprocessor/macro_raw_string.cpp index d56894888d1f89..95f83807d15934 100644 --- a/clang/test/Preprocessor/macro_raw_string.cpp +++ b/clang/test/Preprocessor/macro_raw_string.cpp @@ -5,7 +5,7 @@ extern void foo(const char *str); -void bar() { +void bar(void) { FOO(R"(foo bar)"); } diff --git a/clang/test/Preprocessor/pragma_assume_nonnull.c b/clang/test/Preprocessor/pragma_assume_nonnull.c index 4aa124113e2d1c..1aec2120fd167e 100644 --- a/clang/test/Preprocessor/pragma_assume_nonnull.c +++ b/clang/test/Preprocessor/pragma_assume_nonnull.c @@ -11,6 +11,6 @@ int bar(int * ip) { return *ip; } int foo(int * _Nonnull ip) { return *ip; } -int main() { +int main(void) { return bar(0) + foo(0); // expected-warning 2 {{null passed to a callee that requires a non-null argument}} } diff --git a/clang/test/Preprocessor/pragma_microsoft.c b/clang/test/Preprocessor/pragma_microsoft.c index 020292a4b25663..ea246c2e6891e2 100644 --- a/clang/test/Preprocessor/pragma_microsoft.c +++ b/clang/test/Preprocessor/pragma_microsoft.c @@ -53,7 +53,7 @@ __pragma(comment(linker," bar=" BAR)) #define PRAGMA_IN_ARGS(p) p -void f() +void f(void) { __pragma() // expected-warning{{unknown pragma ignored}} // CHECK: #pragma @@ -112,7 +112,7 @@ void test( void ) { // Test to make sure there are no use-after-free problems #define B "pp-record.h" #pragma include_alias("quux.h", B) -void g() {} +void g(int k) {} #include "quux.h" // Make sure that empty includes don't work diff --git a/clang/test/Preprocessor/user_defined_system_framework.c b/clang/test/Preprocessor/user_defined_system_framework.c index 2ab2a297ecbce9..c321058ce87e55 100644 --- a/clang/test/Preprocessor/user_defined_system_framework.c +++ b/clang/test/Preprocessor/user_defined_system_framework.c @@ -4,6 +4,6 @@ // Check that TestFramework is treated as a system header. #include -int f1() { +int f1(void) { return test_framework_func(1) + another_test_framework_func(2); } diff --git a/clang/test/Profile/c-captured.c b/clang/test/Profile/c-captured.c index f34f0cb8d46580..c19ecd181c34d3 100644 --- a/clang/test/Profile/c-captured.c +++ b/clang/test/Profile/c-captured.c @@ -9,7 +9,7 @@ // PGOALL-LABEL: define{{.*}} void @debug_captured() // PGOGEN: store {{.*}} @[[DCC]], i32 0, i32 0 -void debug_captured() { +void debug_captured(void) { int x = 10; // Check both debug_captured counters, so we can do this all in one pass diff --git a/clang/test/Profile/c-collision.c b/clang/test/Profile/c-collision.c index fabecd752b4ef6..6c779c6facaa26 100644 --- a/clang/test/Profile/c-collision.c +++ b/clang/test/Profile/c-collision.c @@ -6,7 +6,7 @@ // CHECK-EXTRA: @__profd_foo = private global { {{.*}} } { i64 6699318081062747564, i64 -4383447408116050035, extern int bar; -void foo() { +void foo(void) { if (bar) { } if (bar) { diff --git a/clang/test/Profile/c-general.c b/clang/test/Profile/c-general.c index 91e5984272d0b2..67095b7bc7d01d 100644 --- a/clang/test/Profile/c-general.c +++ b/clang/test/Profile/c-general.c @@ -25,7 +25,7 @@ // PGOGEN-LABEL: @simple_loops() // PGOUSE-LABEL: @simple_loops() // PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 0 -void simple_loops() { +void simple_loops(void) { int i; // PGOGEN: store {{.*}} @[[SLC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[SL1:[0-9]+]] @@ -46,7 +46,7 @@ void simple_loops() { // PGOGEN-LABEL: @conditionals() // PGOUSE-LABEL: @conditionals() // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 0 -void conditionals() { +void conditionals(void) { // PGOGEN: store {{.*}} @[[IFC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[IF1:[0-9]+]] for (int i = 0; i < 100; ++i) { @@ -87,7 +87,7 @@ void conditionals() { // PGOGEN-LABEL: @early_exits() // PGOUSE-LABEL: @early_exits() // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 0 -void early_exits() { +void early_exits(void) { int i = 0; // PGOGEN: store {{.*}} @[[EEC]], i32 0, i32 1 @@ -134,7 +134,7 @@ void early_exits() { // PGOGEN-LABEL: @jumps() // PGOUSE-LABEL: @jumps() // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 0 -void jumps() { +void jumps(void) { int i; // PGOGEN: store {{.*}} @[[JMC]], i32 0, i32 1 @@ -216,7 +216,7 @@ void jumps() { // PGOGEN-LABEL: @switches() // PGOUSE-LABEL: @switches() // PGOGEN: store {{.*}} @[[SWC]], i32 0, i32 0 -void switches() { +void switches(void) { static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5}; // No cases -> no weights @@ -289,7 +289,7 @@ void switches() { // PGOGEN-LABEL: @big_switch() // PGOUSE-LABEL: @big_switch() // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 0 -void big_switch() { +void big_switch(void) { // PGOGEN: store {{.*}} @[[BSC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BS1:[0-9]+]] for (int i = 0; i < 32; ++i) { @@ -356,7 +356,7 @@ void big_switch() { // PGOGEN-LABEL: @boolean_operators() // PGOUSE-LABEL: @boolean_operators() // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 0 -void boolean_operators() { +void boolean_operators(void) { int v; // PGOGEN: store {{.*}} @[[BOC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[BO1:[0-9]+]] @@ -395,7 +395,7 @@ void boolean_operators() { // PGOGEN-LABEL: @boolop_loops() // PGOUSE-LABEL: @boolop_loops() // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 0 -void boolop_loops() { +void boolop_loops(void) { int i = 100; // PGOGEN: store {{.*}} @[[BLC]], i32 0, i32 2 @@ -435,7 +435,7 @@ void boolop_loops() { // PGOGEN-LABEL: @conditional_operator() // PGOUSE-LABEL: @conditional_operator() // PGOGEN: store {{.*}} @[[COC]], i32 0, i32 0 -void conditional_operator() { +void conditional_operator(void) { int i = 100; // PGOGEN: store {{.*}} @[[COC]], i32 0, i32 1 @@ -453,7 +453,7 @@ void conditional_operator() { // PGOGEN-LABEL: @do_fallthrough() // PGOUSE-LABEL: @do_fallthrough() // PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 0 -void do_fallthrough() { +void do_fallthrough(void) { // PGOGEN: store {{.*}} @[[DFC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[DF1:[0-9]+]] for (int i = 0; i < 10; ++i) { @@ -475,7 +475,7 @@ void do_fallthrough() { // PGOGEN-LABEL: @static_func() // PGOUSE-LABEL: @static_func() // PGOGEN: store {{.*}} @[[STC]], i32 0, i32 0 -static void static_func() { +static void static_func(void) { // PGOGEN: store {{.*}} @[[STC]], i32 0, i32 1 // PGOUSE: br {{.*}} !prof ![[ST1:[0-9]+]] for (int i = 0; i < 10; ++i) { diff --git a/clang/test/Profile/c-outdated-data.c b/clang/test/Profile/c-outdated-data.c index 2b9773478930fb..454e4d799e0bb3 100644 --- a/clang/test/Profile/c-outdated-data.c +++ b/clang/test/Profile/c-outdated-data.c @@ -13,13 +13,13 @@ // WITH_MISSING: warning: profile data may be out of date: of 3 functions, 2 have mismatched data that will be ignored // WITH_MISSING: warning: profile data may be incomplete: of 3 functions, 1 has no data -void no_usable_data() { +void no_usable_data(void) { int i = 0; if (i) {} } -void no_data() { +void no_data(void) { } int main(int argc, const char *argv[]) { diff --git a/clang/test/Profile/c-unreachable-after-switch.c b/clang/test/Profile/c-unreachable-after-switch.c index cfc111b2752e01..1764c27f0cdd09 100644 --- a/clang/test/Profile/c-unreachable-after-switch.c +++ b/clang/test/Profile/c-unreachable-after-switch.c @@ -4,7 +4,7 @@ // CHECK-LABEL: @foo() // CHECK: store {{.*}} @[[C]], i64 0, i64 0 -void foo() { +void foo(void) { // CHECK: store {{.*}} @[[C]], i64 0, i64 2 switch (0) { default: diff --git a/clang/test/Profile/coverage-prefix-map.c b/clang/test/Profile/coverage-prefix-map.c index b16fd2a2c8f392..6f2c0fba0b09f9 100644 --- a/clang/test/Profile/coverage-prefix-map.c +++ b/clang/test/Profile/coverage-prefix-map.c @@ -2,7 +2,7 @@ // clean directory, put the source there, and cd into it. // RUN: rm -rf %t // RUN: mkdir -p %t/root/nested -// RUN: echo "void f1() {}" > %t/root/nested/coverage-prefix-map.c +// RUN: echo "void f1(void) {}" > %t/root/nested/coverage-prefix-map.c // RUN: cd %t/root // RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -mllvm -enable-name-compression=false -main-file-name coverage-prefix-map.c %t/root/nested/coverage-prefix-map.c -o - | FileCheck --check-prefix=ABSOLUTE %s diff --git a/clang/test/Profile/gcc-flag-compatibility-aix.c b/clang/test/Profile/gcc-flag-compatibility-aix.c index db12e05c247b57..ba889312ce4eb8 100644 --- a/clang/test/Profile/gcc-flag-compatibility-aix.c +++ b/clang/test/Profile/gcc-flag-compatibility-aix.c @@ -54,7 +54,7 @@ int X = 0; -int main() { +int main(void) { int i; for (i = 0; i < 100; i++) X += i; diff --git a/clang/test/Profile/gcc-flag-compatibility.c b/clang/test/Profile/gcc-flag-compatibility.c index 9f83117c1ccdfa..674e92647dcb0a 100644 --- a/clang/test/Profile/gcc-flag-compatibility.c +++ b/clang/test/Profile/gcc-flag-compatibility.c @@ -52,7 +52,7 @@ int X = 0; -int main() { +int main(void) { int i; for (i = 0; i < 100; i++) X += i; diff --git a/clang/test/Refactor/Extract/ExtractionSemicolonPolicy.m b/clang/test/Refactor/Extract/ExtractionSemicolonPolicy.m index 10e6a164f248c9..26f601a2d1502d 100644 --- a/clang/test/Refactor/Extract/ExtractionSemicolonPolicy.m +++ b/clang/test/Refactor/Extract/ExtractionSemicolonPolicy.m @@ -16,7 +16,7 @@ void extractStatementNoSemiObjCFor(NSArray *array) { // CHECK-NEXT: }{{$}} // CHECK-NEXT: }{{[[:space:]].*}} -void extractStatementNoSemiSync() { +void extractStatementNoSemiSync(void) { id lock; /*range bstmt=->+2:4*/@synchronized(lock) { int x = 0; @@ -29,7 +29,7 @@ void extractStatementNoSemiSync() { // CHECK-NEXT: }{{$}} // CHECK-NEXT: }{{[[:space:]].*}} -void extractStatementNoSemiAutorel() { +void extractStatementNoSemiAutorel(void) { /*range cstmt=->+2:4*/@autoreleasepool { int x = 0; } @@ -41,7 +41,7 @@ void extractStatementNoSemiAutorel() { // CHECK-NEXT: }{{$}} // CHECK-NEXT: }{{[[:space:]].*}} -void extractStatementNoSemiTryFinalllllly() { +void extractStatementNoSemiTryFinalllllly(void) { /*range dstmt=->+3:4*/@try { int x = 0; } @finally { diff --git a/clang/test/Rewriter/blockstruct.m b/clang/test/Rewriter/blockstruct.m index 2c443616cf863d..477afb45824b61 100644 --- a/clang/test/Rewriter/blockstruct.m +++ b/clang/test/Rewriter/blockstruct.m @@ -7,9 +7,9 @@ void a(b_t work) { } struct _s { int a; }; -struct _s *r(); +struct _s *r(void); -void f() { +void f(void) { __block struct _s *s = 0; a(^{ s = (struct _s *)r(); diff --git a/clang/test/Rewriter/crash.m b/clang/test/Rewriter/crash.m index 7908d9fea5e281..55d7a03fffc947 100644 --- a/clang/test/Rewriter/crash.m +++ b/clang/test/Rewriter/crash.m @@ -7,7 +7,7 @@ + (id)arrayWithObjects:(id)firstObj, ...; @interface NSConstantString {} @end -int main() { +int main(void) { id foo = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", @"11", @"12", 0]; return 0; } @@ -19,7 +19,7 @@ @protocol A @interface Foo @end -void func() { +void func(void) { id obj = (id )[Foo bar]; } diff --git a/clang/test/Rewriter/finally.m b/clang/test/Rewriter/finally.m index e60ba9ec852633..33b919e4b3efb4 100644 --- a/clang/test/Rewriter/finally.m +++ b/clang/test/Rewriter/finally.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o - -int main() { +int main(void) { @try { printf("executing try"); // expected-warning{{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}} \ // expected-note{{include the header or explicitly provide a declaration for 'printf'}} @@ -25,14 +25,14 @@ int main() { return 0; } -void test_sync_with_implicit_finally() { +void test_sync_with_implicit_finally(void) { id foo; @synchronized (foo) { return; // The rewriter knows how to generate code for implicit finally } } -void test2_try_with_implicit_finally() { +void test2_try_with_implicit_finally(void) { @try { return; // The rewriter knows how to generate code for implicit finally } @catch (id e) { diff --git a/clang/test/Rewriter/objc-synchronized-1.m b/clang/test/Rewriter/objc-synchronized-1.m index 0e985ab67f2b3b..9172a1316cb0f5 100644 --- a/clang/test/Rewriter/objc-synchronized-1.m +++ b/clang/test/Rewriter/objc-synchronized-1.m @@ -1,9 +1,9 @@ // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - -id SYNCH_EXPR(); -void SYNCH_BODY(); -void SYNCH_BEFORE(); -void SYNC_AFTER(); +id SYNCH_EXPR(void); +void SYNCH_BODY(void); +void SYNCH_BEFORE(void); +void SYNC_AFTER(void); void foo(id sem) { diff --git a/clang/test/Rewriter/rewrite-captured-nested-bvar.c b/clang/test/Rewriter/rewrite-captured-nested-bvar.c index 1b624e0ca9c7ab..60029e7c9fc0e1 100644 --- a/clang/test/Rewriter/rewrite-captured-nested-bvar.c +++ b/clang/test/Rewriter/rewrite-captured-nested-bvar.c @@ -6,7 +6,7 @@ void q(void (^p)(void)) { p(); } -void f() { +void f(void) { __block char BYREF_VAR_CHECK = 'a'; __block char d = 'd'; q(^{ @@ -25,7 +25,7 @@ void f() { }); } -int main() { +int main(void) { f(); return 0; } diff --git a/clang/test/Rewriter/rewrite-foreach-1.m b/clang/test/Rewriter/rewrite-foreach-1.m index 5263fffbe7dd14..dcfa6e8a1afeef 100644 --- a/clang/test/Rewriter/rewrite-foreach-1.m +++ b/clang/test/Rewriter/rewrite-foreach-1.m @@ -16,7 +16,7 @@ @interface MyList (BasicTest) - (void)compilerTestAgainst; @end -int LOOP(); +int LOOP(void); @implementation MyList (BasicTest) - (void)compilerTestAgainst { id el; diff --git a/clang/test/Rewriter/rewrite-foreach-2.m b/clang/test/Rewriter/rewrite-foreach-2.m index 120d7d7e79858c..a0f7db301dd0a7 100644 --- a/clang/test/Rewriter/rewrite-foreach-2.m +++ b/clang/test/Rewriter/rewrite-foreach-2.m @@ -16,9 +16,9 @@ @interface MyList (BasicTest) - (void)compilerTestAgainst; @end -int LOOP(); -int INNERLOOP(); -void END_LOOP(); +int LOOP(void); +int INNERLOOP(void); +void END_LOOP(void); @implementation MyList (BasicTest) - (void)compilerTestAgainst { id el; diff --git a/clang/test/Rewriter/rewrite-foreach-3.m b/clang/test/Rewriter/rewrite-foreach-3.m index 6e67415002a312..4edbe80f2212bd 100644 --- a/clang/test/Rewriter/rewrite-foreach-3.m +++ b/clang/test/Rewriter/rewrite-foreach-3.m @@ -16,7 +16,7 @@ @interface MyList (BasicTest) - (void)compilerTestAgainst; @end -int LOOP(); +int LOOP(void); @implementation MyList (BasicTest) - (void)compilerTestAgainst { MyList * el; diff --git a/clang/test/Rewriter/rewrite-foreach-4.m b/clang/test/Rewriter/rewrite-foreach-4.m index e852c75cd2ef7e..50f95e4eb56dd7 100644 --- a/clang/test/Rewriter/rewrite-foreach-4.m +++ b/clang/test/Rewriter/rewrite-foreach-4.m @@ -16,7 +16,7 @@ @interface MyList (BasicTest) - (void)compilerTestAgainst; @end -int LOOP(); +int LOOP(void); @implementation MyList (BasicTest) - (void)compilerTestAgainst { MyList * el; diff --git a/clang/test/Rewriter/rewrite-foreach-7.m b/clang/test/Rewriter/rewrite-foreach-7.m index 8f3a7c8819fa20..079825b01ea377 100644 --- a/clang/test/Rewriter/rewrite-foreach-7.m +++ b/clang/test/Rewriter/rewrite-foreach-7.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - @class NSArray; -int main() { +int main(void) { NSArray *foo; for (Class c in foo) { } } diff --git a/clang/test/Rewriter/rewrite-modern-synchronized.m b/clang/test/Rewriter/rewrite-modern-synchronized.m index 17c8e9a4ad4f8b..59bc87d503f63e 100644 --- a/clang/test/Rewriter/rewrite-modern-synchronized.m +++ b/clang/test/Rewriter/rewrite-modern-synchronized.m @@ -7,10 +7,10 @@ void *sel_registerName(const char *); -id SYNCH_EXPR(); -void SYNCH_BODY(); -void SYNCH_BEFORE(); -void SYNC_AFTER(); +id SYNCH_EXPR(void); +void SYNCH_BODY(void); +void SYNCH_BEFORE(void); +void SYNC_AFTER(void); void foo(id sem) { @@ -26,7 +26,7 @@ void foo(id sem) } } -void test_sync_with_implicit_finally() { +void test_sync_with_implicit_finally(void) { id foo; @synchronized (foo) { return; // The rewriter knows how to generate code for implicit finally diff --git a/clang/test/Rewriter/rewrite-modern-throw.m b/clang/test/Rewriter/rewrite-modern-throw.m index 19d6b1f6d3c6ab..e2a2acd647b608 100644 --- a/clang/test/Rewriter/rewrite-modern-throw.m +++ b/clang/test/Rewriter/rewrite-modern-throw.m @@ -9,17 +9,17 @@ void *sel_registerName(const char *); @interface Foo @end -void TRY(); -void SPLATCH(); -void MYTRY(); -void MYCATCH(); +void TRY(void); +void SPLATCH(void); +void MYTRY(void); +void MYCATCH(void); -void foo() { +void foo(void) { @try { TRY(); } @catch (...) { SPLATCH(); @throw; } } -int main() +int main(void) { @try { diff --git a/clang/test/Rewriter/rewrite-modern-try-catch-finally.m b/clang/test/Rewriter/rewrite-modern-try-catch-finally.m index 9beab7d751006c..cdf79dbd306a97 100644 --- a/clang/test/Rewriter/rewrite-modern-try-catch-finally.m +++ b/clang/test/Rewriter/rewrite-modern-try-catch-finally.m @@ -8,7 +8,7 @@ extern int printf(const char *, ...); -int main() { +int main(void) { @try { } @finally { @@ -30,7 +30,7 @@ int main() { return 0; } -void test2_try_with_implicit_finally() { +void test2_try_with_implicit_finally(void) { @try { return; } @catch (id e) { @@ -38,9 +38,9 @@ void test2_try_with_implicit_finally() { } } -void FINALLY(); -void TRY(); -void CATCH(); +void FINALLY(void); +void TRY(void); +void CATCH(void); @interface NSException @end diff --git a/clang/test/Rewriter/rewrite-modern-try-finally.m b/clang/test/Rewriter/rewrite-modern-try-finally.m index 41737e95f0cd51..b964c6f52927dc 100644 --- a/clang/test/Rewriter/rewrite-modern-try-finally.m +++ b/clang/test/Rewriter/rewrite-modern-try-finally.m @@ -6,11 +6,11 @@ Class isa; } *id; -void FINALLY(); -void TRY(); -void INNER_FINALLY(); -void INNER_TRY(); -void CHECK(); +void FINALLY(void); +void TRY(void); +void INNER_FINALLY(void); +void INNER_TRY(void); +void CHECK(void); @interface Foo @end diff --git a/clang/test/Rewriter/rewrite-try-catch.m b/clang/test/Rewriter/rewrite-try-catch.m index 8720d0c9b91b7e..8ac87f59f2724b 100644 --- a/clang/test/Rewriter/rewrite-try-catch.m +++ b/clang/test/Rewriter/rewrite-try-catch.m @@ -3,12 +3,12 @@ @interface Foo @end @interface GARF @end -void foo() { +void foo(void) { @try { TRY(); } @catch (...) { SPLATCH(); @throw; } } -int main() +int main(void) { @try { diff --git a/clang/test/Rewriter/rewrite-weak-attr.m b/clang/test/Rewriter/rewrite-weak-attr.m index f8eb3b727e0f9e..196f1d3c6e952f 100644 --- a/clang/test/Rewriter/rewrite-weak-attr.m +++ b/clang/test/Rewriter/rewrite-weak-attr.m @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -fblocks -Dnil=0 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s -int main() { +int main(void) { __weak __block id foo = nil; __block id foo2 = nil; id foo3 = nil; - void (^myblock)() = ^{ + void (^myblock)(void) = ^{ foo = nil; foo2 = nil; [foo3 bar]; diff --git a/clang/test/Rewriter/undef-field-reference-1.m b/clang/test/Rewriter/undef-field-reference-1.m index 07bd21b756c93d..3bffd3897ed25e 100644 --- a/clang/test/Rewriter/undef-field-reference-1.m +++ b/clang/test/Rewriter/undef-field-reference-1.m @@ -8,7 +8,7 @@ @interface MyDerived @end MyDerived *pd; -int main() { +int main(void) { return pd->IVAR; } diff --git a/clang/test/Rewriter/weak_byref_objects.m b/clang/test/Rewriter/weak_byref_objects.m index 09d30ed268b065..52111c10edc017 100644 --- a/clang/test/Rewriter/weak_byref_objects.m +++ b/clang/test/Rewriter/weak_byref_objects.m @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -fblocks -triple i386-apple-darwin9 -fobjc-gc -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o - #define nil 0 -int main() { +int main(void) { __weak __block id foo = nil; __block id foo2 = nil; id foo3 = nil; - void (^myblock)() = ^{ + void (^myblock)(void) = ^{ foo = nil; foo2 = nil; [foo3 bar]; diff --git a/clang/test/VFS/framework-import.m b/clang/test/VFS/framework-import.m index cd923c1dbe0fb8..b745b56f55bf99 100644 --- a/clang/test/VFS/framework-import.m +++ b/clang/test/VFS/framework-import.m @@ -3,6 +3,6 @@ #import -void foo() { +void foo(void) { from_framework(); } diff --git a/clang/test/VFS/implicit-include.c b/clang/test/VFS/implicit-include.c index 06bff4b962dbc1..f7cd1822cfde3b 100644 --- a/clang/test/VFS/implicit-include.c +++ b/clang/test/VFS/implicit-include.c @@ -1,6 +1,6 @@ // RUN: sed -e "s@INPUT_DIR@%{/S:regex_replacement}/Inputs@g" -e "s@OUT_DIR@%{/t:regex_replacement}@g" %S/Inputs/vfsoverlay.yaml > %t.yaml // RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -include "not_real.h" -fsyntax-only %s -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/VFS/include-mixed-real-and-virtual.c b/clang/test/VFS/include-mixed-real-and-virtual.c index b46ee9af99905d..0999d8562e8e24 100644 --- a/clang/test/VFS/include-mixed-real-and-virtual.c +++ b/clang/test/VFS/include-mixed-real-and-virtual.c @@ -7,7 +7,7 @@ #include "not_real.h" #include "real.h" -void foo() { +void foo(void) { bar(); baz(); } diff --git a/clang/test/VFS/include-real-from-virtual.c b/clang/test/VFS/include-real-from-virtual.c index 7398be735c5fec..4344619e09e18c 100644 --- a/clang/test/VFS/include-real-from-virtual.c +++ b/clang/test/VFS/include-real-from-virtual.c @@ -6,6 +6,6 @@ #include "include_real.h" -void foo() { +void foo(void) { baz(); } diff --git a/clang/test/VFS/include-virtual-from-real.c b/clang/test/VFS/include-virtual-from-real.c index b50d5b7292532f..200afe9d081355 100644 --- a/clang/test/VFS/include-virtual-from-real.c +++ b/clang/test/VFS/include-virtual-from-real.c @@ -6,6 +6,6 @@ #include "include_not_real.h" -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/VFS/include.c b/clang/test/VFS/include.c index a55e73a38178f5..88d221798f7d85 100644 --- a/clang/test/VFS/include.c +++ b/clang/test/VFS/include.c @@ -3,6 +3,6 @@ #include "not_real.h" -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/VFS/module-import.m b/clang/test/VFS/module-import.m index 25d37bbf0a77bb..e3f250c55ff933 100644 --- a/clang/test/VFS/module-import.m +++ b/clang/test/VFS/module-import.m @@ -4,7 +4,7 @@ @import not_real; -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/VFS/relative-path.c b/clang/test/VFS/relative-path.c index 24313affc69d8d..ab207d096848b1 100644 --- a/clang/test/VFS/relative-path.c +++ b/clang/test/VFS/relative-path.c @@ -5,6 +5,6 @@ #include "not_real.h" -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/VFS/vfsroot-with-overlay.c b/clang/test/VFS/vfsroot-with-overlay.c index d181f4d8382c92..1a44c523aaac23 100644 --- a/clang/test/VFS/vfsroot-with-overlay.c +++ b/clang/test/VFS/vfsroot-with-overlay.c @@ -6,6 +6,6 @@ #include "not_real.h" -void foo() { +void foo(void) { bar(); } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/check-globals.c b/clang/test/utils/update_cc_test_checks/Inputs/check-globals.c index a63cec246e4681..fae086256ce229 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/check-globals.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/check-globals.c @@ -2,9 +2,9 @@ // RUN: true // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s -void foo() { +void foo(void) { static int i, j; } -void bar() { +void bar(void) { static int i, j; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c index 7fc539347e6c11..f1c95c445c2f32 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c @@ -5,7 +5,7 @@ int foo(int arg); void empty_function(void); -int main() { +int main(void) { empty_function(); return foo(1); } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected index 135f3bc28dee43..fd9bcde01ac712 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/def-and-decl.c.expected @@ -14,7 +14,7 @@ void empty_function(void); // CHECK-NEXT: [[CALL:%.*]] = call i32 @foo(i32 noundef 1) // CHECK-NEXT: ret i32 [[CALL]] // -int main() { +int main(void) { empty_function(); return foo(1); } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c index 39e7a207f84635..7440ef6592b64b 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck %s -void __test_offloading_42_abcdef_bar_l123(); +void __test_offloading_42_abcdef_bar_l123(void); void use(int); void foo(int a) diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected index 03f68ef0bcd1d1..06aff0d9d5ac42 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected @@ -1,7 +1,7 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --include-generated-funcs --replace-value-regex "__([a-z]+)_offloading_[a-z0-9]+_[a-z0-9]+_(.*)_l[0-9]+" "somevar_[a-z0-9]+_" // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fopenmp %s -emit-llvm -o - | FileCheck %s -void __test_offloading_42_abcdef_bar_l123(); +void __test_offloading_42_abcdef_bar_l123(void); void use(int); void foo(int a) @@ -23,7 +23,7 @@ void foo(int a) // CHECK-NEXT: store i32 [[TMP0]], i32* [[CONV]], align 4 // CHECK-NEXT: [[TMP1:%.*]] = load i64, i64* [[A_CASTED]], align 8 // CHECK-NEXT: call void @{{__omp_offloading_[a-z0-9]+_[a-z0-9]+_foo_l[0-9]+}}(i64 [[TMP1]]) #[[ATTR3:[0-9]+]] -// CHECK-NEXT: call void (...) @{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}() +// CHECK-NEXT: call void @{{__test_offloading_[a-z0-9]+_[a-z0-9]+_bar_l[0-9]+}}() // CHECK-NEXT: ret void // // diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c index 42b9f4fffaa13b..c40759aeaacffe 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c @@ -8,7 +8,7 @@ double A[size]; void foo(void); -int main() { +int main(void) { int i = 0; #pragma omp parallel for diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected index 9ca1232ea827c6..f8b50470ee205f 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.generated.expected @@ -9,7 +9,7 @@ double A[size]; void foo(void); -int main() { +int main(void) { int i = 0; #pragma omp parallel for diff --git a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected index da066b422dbb04..2c7556208c8345 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/generated-funcs.c.no-generated.expected @@ -46,7 +46,7 @@ void foo(void); // NOOMP-NEXT: call void @foo() // NOOMP-NEXT: ret i32 0 // -int main() { +int main(void) { int i = 0; #pragma omp parallel for diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c index ad4c109c45ec59..ed5735e017067b 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s -void foo() { +void foo(void) { static int hex = 0x10; static int dec = 10; } -void bar() { +void bar(void) { static int hex = 0x20; static int dec = 20; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected index 3018d0261adf99..f494971a6a88a5 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-hex-value-regex.c.expected @@ -11,7 +11,7 @@ // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void foo() { +void foo(void) { static int hex = 0x10; static int dec = 10; } @@ -19,7 +19,7 @@ void foo() { // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void bar() { +void bar(void) { static int hex = 0x20; static int dec = 20; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c b/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c index cacaac63b03689..a8cf554ecb2b40 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s -void foo() { +void foo(void) { static int i, j; } -void bar() { +void bar(void) { static int i, j; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected index b0f74c53819840..94e08ce9553b5b 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/global-value-regex.c.expected @@ -9,13 +9,13 @@ // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void foo() { +void foo(void) { static int i, j; } // CHECK-LABEL: @bar( // CHECK-NEXT: entry: // CHECK-NEXT: ret void // -void bar() { +void bar(void) { static int i, j; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c b/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c index 8956e6b52a210c..f05ba41dec1f80 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c +++ b/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s -int checks_please() { +int checks_please(void) { return 1; } // UTC_ARGS: --disable -int no_checks_please() { +int no_checks_please(void) { // Manual CHECK line should be retained: // CHECK: manual check line return -1; @@ -15,6 +15,6 @@ int no_checks_please() { // UTC_ARGS: --enable -int checks_again() { +int checks_again(void) { return 2; } diff --git a/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c.expected b/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c.expected index cb7846c7b3d5a7..4688ec932b59bc 100644 --- a/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c.expected +++ b/clang/test/utils/update_cc_test_checks/Inputs/on_the_fly_arg_change.c.expected @@ -5,13 +5,13 @@ // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 1 // -int checks_please() { +int checks_please(void) { return 1; } // UTC_ARGS: --disable -int no_checks_please() { +int no_checks_please(void) { // Manual CHECK line should be retained: // CHECK: manual check line return -1; @@ -24,6 +24,6 @@ int no_checks_please() { // CHECK-NEXT: entry: // CHECK-NEXT: ret i32 2 // -int checks_again() { +int checks_again(void) { return 2; } diff --git a/clang/test/utils/update_cc_test_checks/check-globals.test b/clang/test/utils/update_cc_test_checks/check-globals.test index def1a8e9367291..9a2e0cca4c4c83 100644 --- a/clang/test/utils/update_cc_test_checks/check-globals.test +++ b/clang/test/utils/update_cc_test_checks/check-globals.test @@ -44,10 +44,10 @@ END. BOTH-NEXT:// RUN: true BOTH-NEXT:// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s BOTH-EMPTY: - IGF-NEXT:void foo() { + IGF-NEXT:void foo(void) { IGF-NEXT: static int i, j; IGF-NEXT:} - IGF-NEXT:void bar() { + IGF-NEXT:void bar(void) { IGF-NEXT: static int i, j; IGF-NEXT:} BOTH-NEXT://. @@ -60,7 +60,7 @@ BOTH-EMPTY: BOTH-NEXT:// CHECK-NEXT: entry: BOTH-NEXT:// CHECK-NEXT: ret void BOTH-NEXT:// - NRM-NEXT:void foo() { + NRM-NEXT:void foo(void) { NRM-NEXT: static int i, j; NRM-NEXT:} IGF-NEXT:// @@ -68,7 +68,7 @@ BOTH-EMPTY: BOTH-NEXT:// CHECK-NEXT: entry: BOTH-NEXT:// CHECK-NEXT: ret void BOTH-NEXT:// - NRM-NEXT:void bar() { + NRM-NEXT:void bar(void) { NRM-NEXT: static int i, j; NRM-NEXT:} BOTH-NEXT://.