diff --git a/clang/test/Sema/2007-10-01-BuildArrayRef.c b/clang/test/Sema/2007-10-01-BuildArrayRef.c index 2552934f64852d..0a3e9d4238f563 100644 --- a/clang/test/Sema/2007-10-01-BuildArrayRef.c +++ b/clang/test/Sema/2007-10-01-BuildArrayRef.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // PR 1603 -void func() +void func(void) { const int *arr; arr[0] = 1; // expected-error {{read-only variable is not assignable}} @@ -11,7 +11,7 @@ struct foo { }; struct foo sfoo = { 0 }; -int func2() +int func2(void) { const struct foo *fp; fp = &sfoo; diff --git a/clang/test/Sema/attr-alias.c b/clang/test/Sema/attr-alias.c index 93136706a7e54a..05e626f7debc5a 100644 --- a/clang/test/Sema/attr-alias.c +++ b/clang/test/Sema/attr-alias.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -verify %s -void g() {} +void g(void) {} -void f() __attribute__((alias("g"))); //expected-error {{aliases are not supported on darwin}} +void f(void) __attribute__((alias("g"))); //expected-error {{aliases are not supported on darwin}} diff --git a/clang/test/Sema/builtin-alloca-with-align.c b/clang/test/Sema/builtin-alloca-with-align.c index 16d71da60080c6..cac171f0e7ea18 100644 --- a/clang/test/Sema/builtin-alloca-with-align.c +++ b/clang/test/Sema/builtin-alloca-with-align.c @@ -28,6 +28,6 @@ void test7(int a) { __builtin_alloca_with_align(a, 2); // expected-error {{requested alignment must be 8 or greater}} } -void test8() { +void test8(void) { __builtin_alloca_with_align(sizeof(__INT64_TYPE__), __alignof__(__INT64_TYPE__)); // expected-warning {{second argument to __builtin_alloca_with_align is supposed to be in bits}} } diff --git a/clang/test/Sema/builtin-bpf-btf-type-id.c b/clang/test/Sema/builtin-bpf-btf-type-id.c index f6f48a7c005304..70b42c976dedb2 100644 --- a/clang/test/Sema/builtin-bpf-btf-type-id.c +++ b/clang/test/Sema/builtin-bpf-btf-type-id.c @@ -5,9 +5,9 @@ struct { int f2; } tmp = {}; -unsigned invalid1() { return __builtin_btf_type_id(1, tmp); } // expected-error {{__builtin_btf_type_id argument 2 not a constant}} -unsigned invalid2() { return __builtin_btf_type_id(1, 1, 1); } // expected-error {{too many arguments to function call, expected 2, have 3}} +unsigned invalid1(void) { return __builtin_btf_type_id(1, tmp); } // expected-error {{__builtin_btf_type_id argument 2 not a constant}} +unsigned invalid2(void) { return __builtin_btf_type_id(1, 1, 1); } // expected-error {{too many arguments to function call, expected 2, have 3}} -int valid1() { return __builtin_btf_type_id(tmp, 0); } -int valid2() { return __builtin_btf_type_id(&tmp, 1); } -int valid3() { return __builtin_btf_type_id(tmp.f1[4], 10); } +int valid1(void) { return __builtin_btf_type_id(tmp, 0); } +int valid2(void) { return __builtin_btf_type_id(&tmp, 1); } +int valid3(void) { return __builtin_btf_type_id(tmp.f1[4], 10); } diff --git a/clang/test/Sema/builtin-classify-type.c b/clang/test/Sema/builtin-classify-type.c index 814c1aeec62777..38be5cb516e6dd 100644 --- a/clang/test/Sema/builtin-classify-type.c +++ b/clang/test/Sema/builtin-classify-type.c @@ -14,18 +14,18 @@ enum gcc_type_class { lang_type_class }; -void foo() { +void foo(void) { int i; char c; enum { red, green, blue } enum_obj; int *p; double d; _Complex double cc; - extern void f(); + extern void f(void); struct { int a; float b; } s_obj; union { int a; float b; } u_obj; int arr[10]; - int (^block)(); + int (^block)(void); __attribute__((vector_size(16))) int vec; typedef __attribute__((ext_vector_type(4))) int evec_t; evec_t evec; @@ -55,5 +55,5 @@ void foo() { int a19[__builtin_classify_type(complex_d) == complex_type_class ? 1 : -1]; } -extern int (^p)(); +extern int (^p)(void); int n = __builtin_classify_type(p); diff --git a/clang/test/Sema/builtin-cpu-supports.c b/clang/test/Sema/builtin-cpu-supports.c index 05b58314f0932c..ece695a1a65135 100644 --- a/clang/test/Sema/builtin-cpu-supports.c +++ b/clang/test/Sema/builtin-cpu-supports.c @@ -5,7 +5,7 @@ extern void a(const char *); extern const char *str; -int main() { +int main(void) { #ifdef __x86_64__ if (__builtin_cpu_supports("ss")) // expected-error {{invalid cpu feature string}} a("sse4.2"); diff --git a/clang/test/Sema/builtin-object-size.c b/clang/test/Sema/builtin-object-size.c index fa66d2e9c0c59f..af21fe8e8f4441 100644 --- a/clang/test/Sema/builtin-object-size.c +++ b/clang/test/Sema/builtin-object-size.c @@ -10,19 +10,19 @@ int a[10]; -int f0() { +int f0(void) { return OBJECT_SIZE_BUILTIN(&a); // expected-error {{too few arguments to function}} } -int f1() { +int f1(void) { return (OBJECT_SIZE_BUILTIN(&a, 0) + OBJECT_SIZE_BUILTIN(&a, 1) + OBJECT_SIZE_BUILTIN(&a, 2) + OBJECT_SIZE_BUILTIN(&a, 3)); } -int f2() { +int f2(void) { return OBJECT_SIZE_BUILTIN(&a, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}} } -int f3() { +int f3(void) { return OBJECT_SIZE_BUILTIN(&a, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}} } @@ -84,7 +84,7 @@ int pr28314(void) { return a; } -int pr31843() { +int pr31843(void) { int n = 0; struct { int f; } a; diff --git a/clang/test/Sema/builtin-prefetch.c b/clang/test/Sema/builtin-prefetch.c index 478c85b756878f..16029b60690f66 100644 --- a/clang/test/Sema/builtin-prefetch.c +++ b/clang/test/Sema/builtin-prefetch.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -void foo() { +void foo(void) { int a; __builtin_prefetch(&a); __builtin_prefetch(&a, 1); diff --git a/clang/test/Sema/builtin-setjmp.c b/clang/test/Sema/builtin-setjmp.c index 604d534eb504a3..f8b480fbe13323 100644 --- a/clang/test/Sema/builtin-setjmp.c +++ b/clang/test/Sema/builtin-setjmp.c @@ -31,7 +31,7 @@ extern int setjmp(long); // OK, right type. typedef int *jmp_buf; #endif -void use() { +void use(void) { setjmp(0); #if NO_SETJMP // cxx-error@-2 {{undeclared identifier 'setjmp'}} @@ -60,7 +60,7 @@ int _setjmp(void *, void *); // c-warning@-2 {{incompatible redeclaration of library function '_setjmp'}} // c-note@-3 {{'_setjmp' is a builtin with type 'int (jmp_buf)'}} #endif -void use_mingw() { +void use_mingw(void) { _setjmp(0, 0); } diff --git a/clang/test/Sema/builtin-unary-fp.c b/clang/test/Sema/builtin-unary-fp.c index 2b75b10fcbe529..3f4f65eeb73a1e 100644 --- a/clang/test/Sema/builtin-unary-fp.c +++ b/clang/test/Sema/builtin-unary-fp.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic void check(int); -void a() { +void a(void) { check(__builtin_isfinite(1.0f)); check(__builtin_isinf(1.0)); check(__builtin_isinf_sign(1.0L)); diff --git a/clang/test/Sema/builtins-aarch64.c b/clang/test/Sema/builtins-aarch64.c index b4d8aaef63c0c2..ef32985df7e7a9 100644 --- a/clang/test/Sema/builtins-aarch64.c +++ b/clang/test/Sema/builtins-aarch64.c @@ -15,7 +15,7 @@ void test_clear_cache_voids(void *start, void *end) { __clear_cache(start, end); } -void test_clear_cache_no_args() { +void test_clear_cache_no_args(void) { // AArch32 version of this is variadic (at least syntactically). // However, on AArch64 GCC does not permit this call and the // implementation I've seen would go disastrously wrong. diff --git a/clang/test/Sema/builtins-arm-exclusive.c b/clang/test/Sema/builtins-arm-exclusive.c index 4e6a96bc322fc9..68457d266b9919 100644 --- a/clang/test/Sema/builtins-arm-exclusive.c +++ b/clang/test/Sema/builtins-arm-exclusive.c @@ -106,7 +106,7 @@ int test_stlex(char *addr) { return res; } -void test_clrex() { +void test_clrex(void) { __builtin_arm_clrex(); __builtin_arm_clrex(1); // expected-error {{too many arguments to function call}} } diff --git a/clang/test/Sema/builtins-arm.c b/clang/test/Sema/builtins-arm.c index f34499123c4061..7c731204da0938 100644 --- a/clang/test/Sema/builtins-arm.c +++ b/clang/test/Sema/builtins-arm.c @@ -15,37 +15,37 @@ void __clear_cache(void*, void*); #if defined(__ARM_PCS) || defined(__ARM_EABI__) // va_list on ARM AAPCS is struct { void* __ap }. -void test1() { +void test1(void) { __builtin_va_list ptr; ptr.__ap = "x"; *(ptr.__ap) = '0'; // expected-error {{incomplete type 'void' is not assignable}} } #else // va_list on ARM apcs-gnu is void*. -void test1() { +void test1(void) { __builtin_va_list ptr; ptr.__ap = "x"; // expected-error {{member reference base type '__builtin_va_list' is not a structure or union}} *(ptr.__ap) = '0';// expected-error {{member reference base type '__builtin_va_list' is not a structure or union}} } -void test2() { +void test2(void) { __builtin_va_list ptr = "x"; *ptr = '0'; // expected-error {{incomplete type 'void' is not assignable}} } #endif -void test3() { +void test3(void) { __builtin_arm_dsb(16); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_dmb(17); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_isb(18); // expected-error-re {{argument value {{.*}} is outside the valid range}} } -void test4() { +void test4(void) { __builtin_arm_prefetch(0, 2, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_prefetch(0, 0, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}} } -void test5() { +void test5(void) { __builtin_arm_dbg(16); // expected-error-re {{argument value {{.*}} is outside the valid range}} } diff --git a/clang/test/Sema/builtins-arm64-exclusive.c b/clang/test/Sema/builtins-arm64-exclusive.c index 4d678cc98027f5..ce01f79767fa86 100644 --- a/clang/test/Sema/builtins-arm64-exclusive.c +++ b/clang/test/Sema/builtins-arm64-exclusive.c @@ -102,7 +102,7 @@ int test_stlex(char *addr) { return res; } -void test_clrex() { +void test_clrex(void) { __builtin_arm_clrex(); __builtin_arm_clrex(1); // expected-error {{too many arguments to function call}} } diff --git a/clang/test/Sema/builtins-arm64-mte.c b/clang/test/Sema/builtins-arm64-mte.c index 6de2d775f85b74..b283b854532ea7 100644 --- a/clang/test/Sema/builtins-arm64-mte.c +++ b/clang/test/Sema/builtins-arm64-mte.c @@ -78,7 +78,7 @@ unsigned exclude_tag2(int *ptr, int *m) { return __arm_mte_exclude_tag(ptr, m); } -void get_tag1() { +void get_tag1(void) { // expected-error@+1 {{too few arguments to function call, expected 1, have 0}} __arm_mte_get_tag(); } @@ -98,7 +98,7 @@ int *get_tag3(const volatile int *ptr) { #endif } -void set_tag1() { +void set_tag1(void) { // expected-error@+1 {{too few arguments to function call, expected 1, have 0}} __arm_mte_set_tag(); } diff --git a/clang/test/Sema/builtins-arm64.c b/clang/test/Sema/builtins-arm64.c index 27144a18cdeba5..ba4076027bbdc0 100644 --- a/clang/test/Sema/builtins-arm64.c +++ b/clang/test/Sema/builtins-arm64.c @@ -13,17 +13,17 @@ void test_clear_cache_voids(void *start, void *end) { __clear_cache(start, end); } -void test_clear_cache_no_args() { +void test_clear_cache_no_args(void) { __clear_cache(); // expected-error {{too few arguments to function call}} } -void test_memory_barriers() { +void test_memory_barriers(void) { __builtin_arm_dmb(16); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_dsb(17); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_isb(18); // expected-error-re {{argument value {{.*}} is outside the valid range}} } -void test_prefetch() { +void test_prefetch(void) { __builtin_arm_prefetch(0, 2, 0, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_prefetch(0, 0, 3, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}} __builtin_arm_prefetch(0, 0, 0, 2, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}} diff --git a/clang/test/Sema/builtins-bpf.c b/clang/test/Sema/builtins-bpf.c index 52cf1c6a6e63d4..193840584068d5 100644 --- a/clang/test/Sema/builtins-bpf.c +++ b/clang/test/Sema/builtins-bpf.c @@ -68,34 +68,34 @@ unsigned invalid11(struct s *arg, int info_kind) { return __builtin_preserve_field_info(arg->a, info_kind); // expected-error {{__builtin_preserve_field_info argument 2 not a constant}} } -unsigned valid12() { +unsigned valid12(void) { const struct s t; return __builtin_preserve_type_info(t, 0) + __builtin_preserve_type_info(*(struct s *)0, 1); } -unsigned valid13() { +unsigned valid13(void) { __t t; return __builtin_preserve_type_info(t, 1) + __builtin_preserve_type_info(*(__t *)0, 0); } -unsigned valid14() { +unsigned valid14(void) { enum AA t; return __builtin_preserve_type_info(t, 0) + __builtin_preserve_type_info(*(enum AA *)0, 1); } -unsigned valid15() { +unsigned valid15(void) { return __builtin_preserve_enum_value(*(enum AA *)VAL1, 1) + __builtin_preserve_enum_value(*(enum AA *)VAL2, 1); } -unsigned invalid16() { +unsigned invalid16(void) { return __builtin_preserve_enum_value(*(enum AA *)0, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}} } -unsigned invalid17() { +unsigned invalid17(void) { return __builtin_preserve_enum_value(*(enum AA *)VAL10, 1); // expected-error {{__builtin_preserve_enum_value argument 1 invalid}} } diff --git a/clang/test/Sema/builtins-microsoft-arm64.c b/clang/test/Sema/builtins-microsoft-arm64.c index b72e7038954c24..3b5bd9b9bf8662 100644 --- a/clang/test/Sema/builtins-microsoft-arm64.c +++ b/clang/test/Sema/builtins-microsoft-arm64.c @@ -3,7 +3,7 @@ #include -void check__getReg() { +void check__getReg(void) { __getReg(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}} __getReg(32); // expected-error-re {{argument value {{.*}} is outside the valid range}} } diff --git a/clang/test/Sema/builtins-overflow.m b/clang/test/Sema/builtins-overflow.m index 58c294666f442c..3ef04b1ff8f43c 100644 --- a/clang/test/Sema/builtins-overflow.m +++ b/clang/test/Sema/builtins-overflow.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // expected-no-diagnostics -void test() { +void test(void) { int z[1]; __builtin_add_overflow(1, 1, z); } diff --git a/clang/test/Sema/builtins.c b/clang/test/Sema/builtins.c index 51f61c37f6519f..e49ee90c8058e9 100644 --- a/clang/test/Sema/builtins.c +++ b/clang/test/Sema/builtins.c @@ -24,7 +24,7 @@ int test6(float a, long double b) { #define CFSTR __builtin___CFStringMakeConstantString -void test7() { +void test7(void) { const void *X; X = CFSTR("\242"); // expected-warning {{input conversion stopped}} X = CFSTR("\0"); // no-warning @@ -101,12 +101,12 @@ void test_unknown_builtin(int a, int b) { // expected-note{{did you mean '__builtin_isless'?}} } -int test13() { +int test13(void) { __builtin_eh_return(0, 0); // no warning, eh_return never returns. } // -void test14() { +void test14(void) { int old; old = __sync_fetch_and_min((volatile int *)&old, 1); } @@ -117,7 +117,7 @@ void test15(const char *s) { } // PR7885 -int test16() { +int test16(void) { return __builtin_constant_p() + // expected-error{{too few arguments}} __builtin_constant_p(1, 2); // expected-error {{too many arguments}} } @@ -140,7 +140,7 @@ enum Enum { EnumValue1, EnumValue2 }; typedef __typeof(sizeof(int)) size_t; size_t strlen(const char *); -void test17() { +void test17(void) { #define ASSERT(...) { enum { folded = (__VA_ARGS__) }; int arr[folded ? 1 : -1]; } #define T(...) ASSERT(__builtin_constant_p(__VA_ARGS__)) #define F(...) ASSERT(!__builtin_constant_p(__VA_ARGS__)) @@ -191,7 +191,7 @@ void test17() { #undef F } -void test18() { +void test18(void) { char src[1024]; char dst[2048]; size_t result; @@ -206,13 +206,13 @@ void test18() { ptr = __builtin___strlcat_chk(dst, src, sizeof(dst), sizeof(dst)); // expected-warning {{incompatible integer to pointer conversion}} } -void no_ms_builtins() { +void no_ms_builtins(void) { __assume(1); // expected-warning {{implicit declaration}} __noop(1); // expected-warning {{implicit declaration}} __debugbreak(); // expected-warning {{implicit declaration}} } -void unavailable() { +void unavailable(void) { __builtin_operator_new(0); // expected-error {{'__builtin_operator_new' is only available in C++}} __builtin_operator_delete(0); // expected-error {{'__builtin_operator_delete' is only available in C++}} } @@ -348,7 +348,7 @@ void test22(void) { #define memcpy(x,y,z) __builtin___memcpy_chk(x,y,z, __builtin_object_size(x,0)) #define my_memcpy(x,y,z) __builtin___memcpy_chk(x,y,z, __builtin_object_size(x,0)) -void test23() { +void test23(void) { char src[1024]; char buf[10]; memcpy(buf, src, 11); // expected-warning{{'memcpy' will always overflow; destination buffer has size 10, but size argument is 11}} @@ -356,12 +356,12 @@ void test23() { } // Test that __builtin_is_constant_evaluated() is not allowed in C -int test_cxx_builtin() { +int test_cxx_builtin(void) { // expected-error@+1 {{use of unknown builtin '__builtin_is_constant_evaluated'}} return __builtin_is_constant_evaluated(); } -void test_builtin_complex() { +void test_builtin_complex(void) { __builtin_complex(); // expected-error {{too few}} __builtin_complex(1); // expected-error {{too few}} __builtin_complex(1, 2, 3); // expected-error {{too many}} diff --git a/clang/test/Sema/call-with-static-chain.c b/clang/test/Sema/call-with-static-chain.c index 4a076d2ecf9b06..35b9fc799cb82a 100644 --- a/clang/test/Sema/call-with-static-chain.c +++ b/clang/test/Sema/call-with-static-chain.c @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s -void f(); +void f(void); -void g() { +void g(void) { __builtin_call_with_static_chain(f(), f); __builtin_call_with_static_chain(f, f); // expected-error {{first argument to __builtin_call_with_static_chain must be a non-member call expression}} __builtin_call_with_static_chain(^{}(), f); // expected-error {{first argument to __builtin_call_with_static_chain must not be a block call}} diff --git a/clang/test/Sema/callingconv-cast.c b/clang/test/Sema/callingconv-cast.c index 599a7d1e66d7da..87b11b4bf0e535 100644 --- a/clang/test/Sema/callingconv-cast.c +++ b/clang/test/Sema/callingconv-cast.c @@ -29,7 +29,7 @@ void WINAPI mismatched_stdcall(int x) {} void take_opaque_fn(void (*callback)(int)); -int main() { +int main(void) { // expected-warning@+1 {{cast between incompatible calling conventions 'cdecl' and 'stdcall'}} take_callback((callback_t)mismatched); diff --git a/clang/test/Sema/captured-statements.c b/clang/test/Sema/captured-statements.c index ac04915097ebb4..fd907e766d5490 100644 --- a/clang/test/Sema/captured-statements.c +++ b/clang/test/Sema/captured-statements.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks -void test_gotos() { +void test_gotos(void) { goto L1; // expected-error {{use of undeclared label 'L1'}} goto L3; // OK #pragma clang __debug captured @@ -13,7 +13,7 @@ void test_gotos() { L3: ; } -void test_break_continue() { +void test_break_continue(void) { while (1) { #pragma clang __debug captured { @@ -23,7 +23,7 @@ void test_break_continue() { } } -void test_return() { +void test_return(void) { while (1) { #pragma clang __debug captured { @@ -32,7 +32,7 @@ void test_return() { } } -void test_nest() { +void test_nest(void) { int x; #pragma clang __debug captured { @@ -48,7 +48,7 @@ void test_nest() { } } -void test_nest_block() { +void test_nest_block(void) { __block int x; // expected-note {{'x' declared here}} int y; ^{ diff --git a/clang/test/Sema/cast-incomplete.c b/clang/test/Sema/cast-incomplete.c index dd10e00d444ad5..92eadd7e0c4dc3 100644 --- a/clang/test/Sema/cast-incomplete.c +++ b/clang/test/Sema/cast-incomplete.c @@ -5,7 +5,7 @@ enum x; // expected-note {{forward declaration}} extern struct y a; // expected-note {{forward declaration}} extern union z b; // expected-note 2 {{forward declaration}} -void foo() { +void foo(void) { (enum x)1; // expected-error {{cast to incomplete type}} (struct y)a; // expected-error {{cast to incomplete type}} (union z)b; // expected-error {{cast to incomplete type}} diff --git a/clang/test/Sema/cast.c b/clang/test/Sema/cast.c index 2335f2198071c3..1b7519eb87ebcc 100644 --- a/clang/test/Sema/cast.c +++ b/clang/test/Sema/cast.c @@ -2,10 +2,10 @@ typedef struct { unsigned long bits[(((1) + (64) - 1) / (64))]; } cpumask_t; cpumask_t x; -void foo() { +void foo(void) { (void)x; } -void bar() { +void bar(void) { char* a; double b; b = (double)a; // expected-error {{pointer cannot be cast to type}} @@ -183,7 +183,7 @@ void *intToPointerCast2(X x) { return (void*)x; } -void *intToPointerCast3() { +void *intToPointerCast3(void) { return (void*)(1 + 3); } diff --git a/clang/test/Sema/check-increment.c b/clang/test/Sema/check-increment.c index ae33c2085666ad..011ebd85a79cd7 100644 --- a/clang/test/Sema/check-increment.c +++ b/clang/test/Sema/check-increment.c @@ -3,7 +3,7 @@ int printf(const char *, ...); typedef int *pint; -int main() { +int main(void) { int a[5] = {0}; pint p = a; p++; diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c index 6f25eb21ff3c9b..311ec0b0ab9356 100644 --- a/clang/test/Sema/compare.c +++ b/clang/test/Sema/compare.c @@ -262,7 +262,7 @@ int test2(int i32) { } // PR5887 -void test3() { +void test3(void) { unsigned short x, y; unsigned int z; if ((x > y ? x : y) > z) @@ -271,7 +271,7 @@ void test3() { // PR5961 extern char *ptr4; -void test4() { +void test4(void) { long value; if (value < (unsigned long) &ptr4) // expected-warning {{comparison of integers of different signs}} return; @@ -320,7 +320,7 @@ int rdar8414119_bar(unsigned x) { #undef ZERO #undef CHECK -int rdar8511238() { +int rdar8511238(void) { enum A { A_foo, A_bar }; enum A a; diff --git a/clang/test/Sema/complete-incomplete-pointer-relational-c99.c b/clang/test/Sema/complete-incomplete-pointer-relational-c99.c index ea6e4055eb5290..65cf6a3e02e207 100644 --- a/clang/test/Sema/complete-incomplete-pointer-relational-c99.c +++ b/clang/test/Sema/complete-incomplete-pointer-relational-c99.c @@ -4,7 +4,7 @@ int incomplete[]; // expected-warning {{tentative array definition assumed to have one element}} int complete[6]; -int test_comparison_between_incomplete_and_complete_pointer() { +int test_comparison_between_incomplete_and_complete_pointer(void) { return (&incomplete < &complete) && // expected-warning {{pointer comparisons before C11 need to be between two complete or two incomplete types; 'int (*)[]' is incomplete and 'int (*)[6]' is complete}} (&incomplete <= &complete) && // expected-warning {{pointer comparisons before C11 need to be between two complete or two incomplete types; 'int (*)[]' is incomplete and 'int (*)[6]' is complete}} (&incomplete > &complete) && // expected-warning {{pointer comparisons before C11 need to be between two complete or two incomplete types; 'int (*)[]' is incomplete and 'int (*)[6]' is complete}} diff --git a/clang/test/Sema/complex-imag.c b/clang/test/Sema/complex-imag.c index deaf62775336f4..69121271f4b787 100644 --- a/clang/test/Sema/complex-imag.c +++ b/clang/test/Sema/complex-imag.c @@ -1,27 +1,27 @@ // RUN: %clang_cc1 -verify %s -void f1() { +void f1(void) { int a = 1; int b = __imag a; int *c = &__real a; int *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'int'}} } -void f2() { +void f2(void) { _Complex int a = 1; int b = __imag a; int *c = &__real a; int *d = &__imag a; } -void f3() { +void f3(void) { double a = 1; double b = __imag a; double *c = &__real a; double *d = &__imag a; // expected-error {{cannot take the address of an rvalue of type 'double'}} } -void f4() { +void f4(void) { _Complex double a = 1; double b = __imag a; double *c = &__real a; diff --git a/clang/test/Sema/complex-int.c b/clang/test/Sema/complex-int.c index 44b43b7cc6656e..133aab1e60c8b6 100644 --- a/clang/test/Sema/complex-int.c +++ b/clang/test/Sema/complex-int.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -verify -fsyntax-only -void a() { +void a(void) { __complex__ int arr; __complex__ short brr; __complex__ unsigned xx; @@ -27,7 +27,7 @@ switch (ii) { } } -void Tester() { +void Tester(void) { __complex short a1; __complex int a2; __complex float a3; diff --git a/clang/test/Sema/conditional-expr.c b/clang/test/Sema/conditional-expr.c index 7ff141d62e56b9..02f073414a6929 100644 --- a/clang/test/Sema/conditional-expr.c +++ b/clang/test/Sema/conditional-expr.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -Wno-pointer-to-int-cast -verify -pedantic -Wsign-conversion %s -void foo() { +void foo(void) { *(0 ? (double *)0 : (void *)0) = 0; // FIXME: GCC doesn't consider the following two statements to be errors. *(0 ? (double *)0 : (void *)(int *)0) = 0; // expected-error {{incomplete type 'void' is not assignable}} @@ -79,7 +79,7 @@ void foo() { (test0 ? (test0 ? adr2 : adr2) : nonconst_int); // expected-error{{conditional operator with the second and third operands of type ('__attribute__((address_space(2))) int *' and 'int *') which are pointers to non-overlapping address spaces}} } -int Postgresql() { +int Postgresql(void) { char x; return ((((&x) != ((void *) 0)) ? (*(&x) = ((char) 1)) : (void) ((void *) 0)), (unsigned long) ((void *) 0)); // expected-warning {{C99 forbids conditional expressions with only one void side}} } @@ -100,7 +100,7 @@ int f2(int x) { #define NULL (void*)0 -void PR9236() { +void PR9236(void) { struct A {int i;} A1; (void)(1 ? A1 : NULL); // expected-error{{non-pointer operand type 'struct A' incompatible with NULL}} (void)(1 ? NULL : A1); // expected-error{{non-pointer operand type 'struct A' incompatible with NULL}} diff --git a/clang/test/Sema/conditional.c b/clang/test/Sema/conditional.c index 1f3a6d04f14d3e..666ac5416322d5 100644 --- a/clang/test/Sema/conditional.c +++ b/clang/test/Sema/conditional.c @@ -5,15 +5,15 @@ const char* test1 = 1 ? "i" : 1 == 1 ? "v" : "r"; void _efree(void *ptr); void free(void *ptr); -int _php_stream_free1() { +int _php_stream_free1(void) { return (1 ? free(0) : _efree(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}} } -int _php_stream_free2() { +int _php_stream_free2(void) { return (1 ? _efree(0) : free(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}} } -void pr39809() { +void pr39809(void) { _Generic(0 ? (int const *)0 : (void *)0, int const *: (void)0); _Generic(0 ? (int const *)0 : (void *)1, void const *: (void)0); _Generic(0 ? (int volatile*)0 : (void const*)1, void volatile const*: (void)0); diff --git a/clang/test/Sema/const-eval.c b/clang/test/Sema/const-eval.c index 7846a6e9f3638e..286a58f503ef30 100644 --- a/clang/test/Sema/const-eval.c +++ b/clang/test/Sema/const-eval.c @@ -22,7 +22,7 @@ EVAL_EXPR(13, x || 3.0) // expected-error {{not an integer constant expression}} unsigned int l_19 = 1; EVAL_EXPR(14, (1 ^ l_19) && 1); // expected-error {{not an integer constant expression}} -void f() +void f(void) { int a; EVAL_EXPR(15, (_Bool)&a); @@ -86,7 +86,7 @@ EVAL_EXPR(40, __imag__(1.f) == 0 ? 1 : -1) EVAL_EXPR(41, (int)(1+(_Complex unsigned)2)) // rdar://8875946 -void rdar8875946() { +void rdar8875946(void) { double _Complex P; float _Complex P2 = 3.3f + P; } @@ -133,9 +133,9 @@ EVAL_EXPR(50, &Test50 < (struct Test50S*)((unsigned long)&Test50 + 10)) // expec EVAL_EXPR(51, 0 != (float)1e99) // PR21945 -void PR21945() { int i = (({}), 0l); } +void PR21945(void) { int i = (({}), 0l); } -void PR24622(); +void PR24622(void); struct PR24622 {} pr24622; EVAL_EXPR(52, &pr24622 == (void *)&PR24622); // expected-error {{not an integer constant expression}} diff --git a/clang/test/Sema/constant-builtins-2.c b/clang/test/Sema/constant-builtins-2.c index 19d1599dc4a1d7..4301b57aa84fc2 100644 --- a/clang/test/Sema/constant-builtins-2.c +++ b/clang/test/Sema/constant-builtins-2.c @@ -208,7 +208,7 @@ char clrsb12[__builtin_clrsb(~0x1f) == BITSIZE(int) - 6 ? 1 : -1]; // GCC misc stuff -extern int f(); +extern int f(void); int h0 = __builtin_types_compatible_p(int, float); //int h1 = __builtin_choose_expr(1, 10, f()); diff --git a/clang/test/Sema/constant-builtins.c b/clang/test/Sema/constant-builtins.c index fb70375b382d93..964ab59e787c49 100644 --- a/clang/test/Sema/constant-builtins.c +++ b/clang/test/Sema/constant-builtins.c @@ -17,7 +17,7 @@ long double g5 = __builtin_infl(); // GCC misc stuff -extern int f(); +extern int f(void); int h0 = __builtin_types_compatible_p(int,float); //int h1 = __builtin_choose_expr(1, 10, f()); @@ -26,7 +26,7 @@ int h3 = __builtin_bswap16(0x1234) == 0x3412 ? 1 : f(); int h4 = __builtin_bswap32(0x1234) == 0x34120000 ? 1 : f(); int h5 = __builtin_bswap64(0x1234) == 0x3412000000000000 ? 1 : f(); -short somefunc(); +short somefunc(void); short t = __builtin_constant_p(5353) ? 42 : somefunc(); diff --git a/clang/test/Sema/constant-conversion.c b/clang/test/Sema/constant-conversion.c index bf8221089d8c97..025f4709a7d5f1 100644 --- a/clang/test/Sema/constant-conversion.c +++ b/clang/test/Sema/constant-conversion.c @@ -14,7 +14,7 @@ void test_7809123(void) { a.i5 = 36; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 36 to 4}} } -void test() { +void test(void) { struct { int bit : 1; } a; a.bit = 1; // shouldn't warn } @@ -25,7 +25,7 @@ enum Test2 test2(enum Test2 *t) { return 10; // shouldn't warn } -void test3() { +void test3(void) { struct A { unsigned int foo : 2; int bar : 2; @@ -38,7 +38,7 @@ void test3() { struct A e = { .foo = 10 }; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 10 to 2}} } -void test4() { +void test4(void) { struct A { char c : 2; } a; @@ -46,7 +46,7 @@ void test4() { a.c = 0x101; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 257 to 1}} } -void test5() { +void test5(void) { struct A { _Bool b : 1; } a; @@ -56,13 +56,13 @@ void test5() { a.b = 100; } -void test6() { +void test6(void) { // Test that unreachable code doesn't trigger the truncation warning. unsigned char x = 0 ? 65535 : 1; // no-warning unsigned char y = 1 ? 65535 : 1; // expected-warning {{changes value}} } -void test7() { +void test7(void) { struct { unsigned int twoBits1:2; unsigned int twoBits2:2; @@ -76,13 +76,13 @@ void test7() { f.twoBits2 &= ~2; // no-warning } -void test8() { +void test8(void) { enum E { A, B, C }; struct { enum E x : 1; } f; f.x = C; // expected-warning {{implicit truncation from 'int' to bit-field changes value from 2 to 0}} } -void test9() { +void test9(void) { const char max_char = 0x7F; const short max_short = 0x7FFF; const int max_int = 0x7FFFFFFF; @@ -117,7 +117,7 @@ void test9() { #define A 1 -void test10() { +void test10(void) { struct S { unsigned a : 4; } s; diff --git a/clang/test/Sema/constructor-attribute.c b/clang/test/Sema/constructor-attribute.c index 3a537d424ba0c0..0615c63703a0a6 100644 --- a/clang/test/Sema/constructor-attribute.c +++ b/clang/test/Sema/constructor-attribute.c @@ -1,16 +1,16 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}} -int f() __attribute__((constructor)); -int f() __attribute__((constructor(1))); -int f() __attribute__((constructor(1,2))); // expected-error {{'constructor' attribute takes no more than 1 argument}} -int f() __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires an integer constant}} -int f() __attribute__((constructor(0x100000000))); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} +int f(void) __attribute__((constructor)); +int f(void) __attribute__((constructor(1))); +int f(void) __attribute__((constructor(1,2))); // expected-error {{'constructor' attribute takes no more than 1 argument}} +int f(void) __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires an integer constant}} +int f(void) __attribute__((constructor(0x100000000))); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}} int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}} -int f() __attribute__((destructor)); -int f() __attribute__((destructor(1))); -int f() __attribute__((destructor(1,2))); // expected-error {{'destructor' attribute takes no more than 1 argument}} -int f() __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires an integer constant}} - +int f(void) __attribute__((destructor)); +int f(void) __attribute__((destructor(1))); +int f(void) __attribute__((destructor(1,2))); // expected-error {{'destructor' attribute takes no more than 1 argument}} +int f(void) __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires an integer constant}} +void knr() __attribute__((constructor)); diff --git a/clang/test/Sema/conversion-target-dep.c b/clang/test/Sema/conversion-target-dep.c index e16685fa0674db..958a4d8b1f0769 100644 --- a/clang/test/Sema/conversion-target-dep.c +++ b/clang/test/Sema/conversion-target-dep.c @@ -8,7 +8,7 @@ long double ld; double d; _Float16 f16; // x86-error {{_Float16 is not supported on this target}} -int main() { +int main(void) { ld = d; // x86-warning {{implicit conversion increases floating-point precision: 'double' to 'long double'}} d = ld; // x86-warning {{implicit conversion loses floating-point precision: 'long double' to 'double'}} diff --git a/clang/test/Sema/conversion.c b/clang/test/Sema/conversion.c index 02131e49cb48d3..caff7c8e9d8f64 100644 --- a/clang/test/Sema/conversion.c +++ b/clang/test/Sema/conversion.c @@ -313,7 +313,7 @@ void test16(void) { } // PR 5938 -void test17() { +void test17(void) { union { unsigned long long a : 8; unsigned long long b : 32; @@ -327,7 +327,7 @@ void test17() { } // PR 5939 -void test18() { +void test18(void) { union { unsigned long long a : 1; unsigned long long b; diff --git a/clang/test/Sema/crash-invalid-array.c b/clang/test/Sema/crash-invalid-array.c index 18fbd1c84dbcf2..09731fa06f48e6 100644 --- a/clang/test/Sema/crash-invalid-array.c +++ b/clang/test/Sema/crash-invalid-array.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s // PR6913 -int main() +int main(void) { int x[10][10]; int (*p)[] = x; diff --git a/clang/test/Sema/decl-in-prototype.c b/clang/test/Sema/decl-in-prototype.c index 52970e3e1ba834..acc02fc3b116b2 100644 --- a/clang/test/Sema/decl-in-prototype.c +++ b/clang/test/Sema/decl-in-prototype.c @@ -53,7 +53,7 @@ void enum_in_fun_in_fun(void (*fp)(enum { AA, BB } e)) { // expected-warning {{w SA(2, BB == 0); } -void f7() { +void f7(void) { extern void ext(struct S { enum E7 { a, b } o; } p); // expected-warning 2 {{will not be visible}} ext(a); // expected-error {{use of undeclared identifier}} } @@ -87,7 +87,7 @@ int f11( } // expected-error {{expected member name or ';'}} e); -void f12() { +void f12(void) { extern int ext12( struct S12 { } e // expected-warning {{will not be visible}} ); diff --git a/clang/test/Sema/decl-invalid.c b/clang/test/Sema/decl-invalid.c index c7ec6dd725d62e..fca708c9bbe8a1 100644 --- a/clang/test/Sema/decl-invalid.c +++ b/clang/test/Sema/decl-invalid.c @@ -5,8 +5,8 @@ typedef union __mbstate_t; // expected-error {{declaration of anony // PR2017 -void x(); -int a() { +void x(void); +int a(void) { int r[x()]; // expected-error {{size of array has non-integer type 'void'}} static y ?; // expected-error{{unknown type name 'y'}} \ diff --git a/clang/test/Sema/decl-type-merging.c b/clang/test/Sema/decl-type-merging.c index 259b0ddf1545db..7576cac7cba211 100644 --- a/clang/test/Sema/decl-type-merging.c +++ b/clang/test/Sema/decl-type-merging.c @@ -6,7 +6,7 @@ int testx[(sizeof(x) == sizeof(int) * 10) ? 1 : -1]; int (*a)(int (*x)[10], int (*y)[]); int (*a)(int (*x)[], int (*y)[5]); -void b() { +void b(void) { int x[10], y[5]; a(&x, &y); a(&y, &y); // expected-warning {{incompatible pointer}} diff --git a/clang/test/Sema/declspec.c b/clang/test/Sema/declspec.c index d810632eeea504..88ff83a2149067 100644 --- a/clang/test/Sema/declspec.c +++ b/clang/test/Sema/declspec.c @@ -5,7 +5,7 @@ T foo(int n, int m) { } // expected-error {{cannot return array type}} void foof(const char *, ...) __attribute__((__format__(__printf__, 1, 2))), barf (void); -int typedef validTypeDecl() { } // expected-error {{function definition declared 'typedef'}} +int typedef validTypeDecl(void) { } // expected-error {{function definition declared 'typedef'}} struct _zend_module_entry { } // expected-error {{expected ';' after struct}} int gv1; @@ -29,7 +29,7 @@ restrict struct hallo; // expected-error {{restrict requires a pointer or refere struct test1 { } // expected-error {{expected ';' after struct}} -void test2() {} +void test2(void) {} // PR6423 @@ -43,9 +43,9 @@ volatile volatile int pr8264_2; // expected-warning {{duplicate 'volatile' decl char * restrict restrict pr8264_3; // expected-warning {{duplicate 'restrict' declaration specifier}} extern extern int pr8264_4; // expected-warning {{duplicate 'extern' declaration specifier}} -void pr8264_5() { +void pr8264_5(void) { register register int x; // expected-warning {{duplicate 'register' declaration specifier}} } -inline inline void pr8264_6() {} // expected-warning {{duplicate 'inline' declaration specifier}} -_Noreturn _Noreturn void pr8264_7(); // expected-warning {{duplicate '_Noreturn' declaration specifier}} +inline inline void pr8264_6(void) {} // expected-warning {{duplicate 'inline' declaration specifier}} +_Noreturn _Noreturn void pr8264_7(void); // expected-warning {{duplicate '_Noreturn' declaration specifier}} diff --git a/clang/test/Sema/designated-initializers.c b/clang/test/Sema/designated-initializers.c index 4239b5e6aeb34d..e039f18364639e 100644 --- a/clang/test/Sema/designated-initializers.c +++ b/clang/test/Sema/designated-initializers.c @@ -125,9 +125,9 @@ struct X { }; int counter = 0; -int get8() { ++counter; return 8; } +int get8(void) { ++counter; return 8; } -void test() { +void test(void) { struct X xs[] = { [0] = (struct X){1, 2}, // expected-note 2 {{previous initialization is here}} [0].c = 3, // expected-warning{{initializer partially overrides prior initialization of this subobject}} diff --git a/clang/test/Sema/dllexport.c b/clang/test/Sema/dllexport.c index 6735999d389ebb..3f911fb095c0fc 100644 --- a/clang/test/Sema/dllexport.c +++ b/clang/test/Sema/dllexport.c @@ -10,7 +10,7 @@ typedef __declspec(dllexport) int typedef2; // expected-warning@-1{{'dllexport' attribute only applies to}} typedef int __declspec(dllexport) typedef3; // expected-warning@-1{{'dllexport' attribute only applies to}} -typedef __declspec(dllexport) void (*FunTy)(); +typedef __declspec(dllexport) void (*FunTy)(void); // expected-warning@-1{{'dllexport' attribute only applies to}} enum __declspec(dllexport) Enum { EnumVal }; // expected-warning@-1{{'dllexport' attribute only applies to}} @@ -45,7 +45,7 @@ __declspec(dllexport) extern int GlobalRedecl2; int GlobalRedecl2; extern int GlobalRedecl3; // expected-note{{previous declaration is here}} -int useGlobalRedecl3() { return GlobalRedecl3; } +int useGlobalRedecl3(void) { return GlobalRedecl3; } __declspec(dllexport) extern int GlobalRedecl3; // expected-error{{redeclaration of 'GlobalRedecl3' cannot add 'dllexport' attribute}} extern int GlobalRedecl4; // expected-note{{previous declaration is here}} @@ -59,7 +59,7 @@ __declspec(dllexport) static int StaticGlobal; // expected-error{{'StaticGlobal' __declspec(dllexport) __thread int ThreadLocalGlobal; // expected-error{{'ThreadLocalGlobal' cannot be thread local when declared 'dllexport'}} // Export in local scope. -void functionScope() { +void functionScope(void) { __declspec(dllexport) int LocalVarDecl; // expected-error{{'LocalVarDecl' must have external linkage when declared 'dllexport'}} __declspec(dllexport) int LocalVarDef = 1; // expected-error{{'LocalVarDef' must have external linkage when declared 'dllexport'}} __declspec(dllexport) extern int ExternLocalVarDecl; @@ -73,50 +73,50 @@ void functionScope() { //===----------------------------------------------------------------------===// // Export function declaration. Check different placements. -__attribute__((dllexport)) void decl1A(); // Basic check with __attribute__ -__declspec(dllexport) void decl1B(); +__attribute__((dllexport)) void decl1A(void); // Basic check with __attribute__ +__declspec(dllexport) void decl1B(void); -void __attribute__((dllexport)) decl2A(); -void __declspec(dllexport) decl2B(); +void __attribute__((dllexport)) decl2A(void); +void __declspec(dllexport) decl2B(void); // Export function definition. -__declspec(dllexport) void def() {} +__declspec(dllexport) void def(void) {} // Export inline function. -__declspec(dllexport) inline void inlineFunc1() {} -extern void inlineFunc1(); +__declspec(dllexport) inline void inlineFunc1(void) {} +extern void inlineFunc1(void); -inline void __attribute__((dllexport)) inlineFunc2() {} -extern void inlineFunc2(); +inline void __attribute__((dllexport)) inlineFunc2(void) {} +extern void inlineFunc2(void); // Redeclarations -__declspec(dllexport) void redecl1(); -__declspec(dllexport) void redecl1(); +__declspec(dllexport) void redecl1(void); +__declspec(dllexport) void redecl1(void); -__declspec(dllexport) void redecl2(); - void redecl2(); +__declspec(dllexport) void redecl2(void); + void redecl2(void); -__declspec(dllexport) void redecl3(); - void redecl3() {} +__declspec(dllexport) void redecl3(void); + void redecl3(void) {} - void redecl4(); // expected-note{{previous declaration is here}} -void useRedecl4() { redecl4(); } -__declspec(dllexport) void redecl4(); // expected-error{{redeclaration of 'redecl4' cannot add 'dllexport' attribute}} + void redecl4(void); // expected-note{{previous declaration is here}} +void useRedecl4(void) { redecl4(); } +__declspec(dllexport) void redecl4(void); // expected-error{{redeclaration of 'redecl4' cannot add 'dllexport' attribute}} - void redecl5(); // expected-note{{previous declaration is here}} -void useRedecl5() { redecl5(); } -__declspec(dllexport) inline void redecl5() {} // expected-error{{redeclaration of 'redecl5' cannot add 'dllexport' attribute}} + void redecl5(void); // expected-note{{previous declaration is here}} +void useRedecl5(void) { redecl5(); } +__declspec(dllexport) inline void redecl5(void) {} // expected-error{{redeclaration of 'redecl5' cannot add 'dllexport' attribute}} // Allow with a warning if the decl hasn't been used yet. - void redecl6(); // expected-note{{previous declaration is here}} -__declspec(dllexport) void redecl6(); // expected-warning{{redeclaration of 'redecl6' should not add 'dllexport' attribute}} + void redecl6(void); // expected-note{{previous declaration is here}} +__declspec(dllexport) void redecl6(void); // expected-warning{{redeclaration of 'redecl6' should not add 'dllexport' attribute}} // External linkage is required. -__declspec(dllexport) static int staticFunc(); // expected-error{{'staticFunc' must have external linkage when declared 'dllexport'}} +__declspec(dllexport) static int staticFunc(void); // expected-error{{'staticFunc' must have external linkage when declared 'dllexport'}} // Static locals don't count as having external linkage. -void staticLocalFunc() { +void staticLocalFunc(void) { __declspec(dllexport) static int staticLocal; // expected-error{{'staticLocal' must have external linkage when declared 'dllexport'}} } @@ -151,14 +151,14 @@ __declspec(dllimport) int PrecedenceGlobalRedecl1; // expected-warning{{' __declspec(dllimport) extern int PrecedenceGlobalRedecl2; // expected-warning{{'dllimport' attribute ignored}} __declspec(dllexport) int PrecedenceGlobalRedecl2; -void __attribute__((dllimport, dllexport)) precedence1A() {} // expected-warning{{'dllimport' attribute ignored}} -void __declspec(dllimport) __declspec(dllexport) precedence1B() {} // expected-warning{{'dllimport' attribute ignored}} +void __attribute__((dllimport, dllexport)) precedence1A(void) {} // expected-warning{{'dllimport' attribute ignored}} +void __declspec(dllimport) __declspec(dllexport) precedence1B(void) {} // expected-warning{{'dllimport' attribute ignored}} -void __attribute__((dllexport, dllimport)) precedence2A() {} // expected-warning{{'dllimport' attribute ignored}} -void __declspec(dllexport) __declspec(dllimport) precedence2B() {} // expected-warning{{'dllimport' attribute ignored}} +void __attribute__((dllexport, dllimport)) precedence2A(void) {} // expected-warning{{'dllimport' attribute ignored}} +void __declspec(dllexport) __declspec(dllimport) precedence2B(void) {} // expected-warning{{'dllimport' attribute ignored}} -void __declspec(dllimport) precedenceRedecl1(); // expected-warning{{'dllimport' attribute ignored}} -void __declspec(dllexport) precedenceRedecl1() {} +void __declspec(dllimport) precedenceRedecl1(void); // expected-warning{{'dllimport' attribute ignored}} +void __declspec(dllexport) precedenceRedecl1(void) {} -void __declspec(dllexport) precedenceRedecl2(); -void __declspec(dllimport) precedenceRedecl2() {} // expected-warning{{'dllimport' attribute ignored}} +void __declspec(dllexport) precedenceRedecl2(void); +void __declspec(dllimport) precedenceRedecl2(void) {} // expected-warning{{'dllimport' attribute ignored}} diff --git a/clang/test/Sema/dllimport.c b/clang/test/Sema/dllimport.c index 5f9cc7489226b0..e5e378379c6140 100644 --- a/clang/test/Sema/dllimport.c +++ b/clang/test/Sema/dllimport.c @@ -15,7 +15,7 @@ typedef __declspec(dllimport) int typedef2; // expected-warning@-1{{'dllimport' attribute only applies to}} typedef int __declspec(dllimport) typedef3; // expected-warning@-1{{'dllimport' attribute only applies to}} -typedef __declspec(dllimport) void (*FunTy)(); +typedef __declspec(dllimport) void (*FunTy)(void); // expected-warning@-1{{'dllimport' attribute only applies to}} enum __declspec(dllimport) Enum { EnumVal }; // expected-warning@-1{{'dllimport' attribute only applies to}} @@ -108,7 +108,7 @@ __declspec(dllimport) extern int GlobalRedecl3; // expected-note{{previous decla // Adding an attribute on redeclaration. extern int GlobalRedecl4; // expected-note{{previous declaration is here}} -int useGlobalRedecl4() { return GlobalRedecl4; } +int useGlobalRedecl4(void) { return GlobalRedecl4; } __declspec(dllimport) extern int GlobalRedecl4; // expected-error{{redeclaration of 'GlobalRedecl4' cannot add 'dllimport' attribute}} // Allow with a warning if the decl hasn't been used yet. @@ -127,7 +127,7 @@ __declspec(dllimport) float LocalRedecl1; // expected-note{{previous declaration __declspec(dllimport) float LocalRedecl2; // expected-note{{previous declaration is here}} __declspec(dllimport) float LocalRedecl3; // expected-note{{previous declaration is here}} __declspec(dllimport) float LocalRedecl4; -void functionScope() { +void functionScope(void) { __declspec(dllimport) int LocalRedecl1; // expected-error{{redeclaration of 'LocalRedecl1' with a different type: 'int' vs 'float'}} int *__attribute__((dllimport)) LocalRedecl2; // expected-error{{redeclaration of 'LocalRedecl2' with a different type: 'int *' vs 'float'}} int LocalRedecl3 __attribute__((dllimport)); // expected-error{{redeclaration of 'LocalRedecl3' with a different type: 'int' vs 'float'}} @@ -149,62 +149,62 @@ void functionScope() { //===----------------------------------------------------------------------===// // Import function declaration. Check different placements. -__attribute__((dllimport)) void decl1A(); // Basic check with __attribute__ -__declspec(dllimport) void decl1B(); +__attribute__((dllimport)) void decl1A(void); // Basic check with __attribute__ +__declspec(dllimport) void decl1B(void); -void __attribute__((dllimport)) decl2A(); -void __declspec(dllimport) decl2B(); +void __attribute__((dllimport)) decl2A(void); +void __declspec(dllimport) decl2B(void); // Address of functions can be used for initialization in C language modes. // However, the address of the thunk wrapping the function is used instead of // the address in the import address table. -void (*FunForInit)() = &decl2A; +void (*FunForInit)(void) = &decl2A; // Not allowed on function definitions. -__declspec(dllimport) void def() {} // expected-error{{dllimport cannot be applied to non-inline function definition}} +__declspec(dllimport) void def(void) {} // expected-error{{dllimport cannot be applied to non-inline function definition}} // Import inline function. #ifdef GNU // expected-warning@+3{{'dllimport' attribute ignored on inline function}} // expected-warning@+3{{'dllimport' attribute ignored on inline function}} #endif -__declspec(dllimport) inline void inlineFunc1() {} -inline void __attribute__((dllimport)) inlineFunc2() {} +__declspec(dllimport) inline void inlineFunc1(void) {} +inline void __attribute__((dllimport)) inlineFunc2(void) {} // Redeclarations -__declspec(dllimport) void redecl1(); -__declspec(dllimport) void redecl1(); +__declspec(dllimport) void redecl1(void); +__declspec(dllimport) void redecl1(void); -__declspec(dllimport) void redecl2(); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} - void redecl2(); // expected-warning{{'redecl2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} +__declspec(dllimport) void redecl2(void); // expected-note{{previous declaration is here}} expected-note{{previous attribute is here}} + void redecl2(void); // expected-warning{{'redecl2' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} #ifdef GNU // expected-note@+2{{previous attribute is here}} #endif - __declspec(dllimport) void redecl3(); // expected-note{{previous declaration is here}} + __declspec(dllimport) void redecl3(void); // expected-note{{previous declaration is here}} // NB: Both MSVC and Clang issue a warning and make redecl3 dllexport. #if defined(MS) || defined(WI) // expected-warning@+4{{'redecl3' redeclared without 'dllimport' attribute: 'dllexport' attribute added}} #else // expected-warning@+2{{'redecl3' redeclared without 'dllimport' attribute: previous 'dllimport' ignored}} #endif - void redecl3() {} + void redecl3(void) {} - void redecl4(); // expected-note{{previous declaration is here}} -void useRedecl4() { redecl4(); } -__declspec(dllimport) void redecl4(); // expected-warning{{redeclaration of 'redecl4' should not add 'dllimport' attribute}} + void redecl4(void); // expected-note{{previous declaration is here}} +void useRedecl4(void) { redecl4(); } +__declspec(dllimport) void redecl4(void); // expected-warning{{redeclaration of 'redecl4' should not add 'dllimport' attribute}} // Allow with a warning if the decl hasn't been used yet. - void redecl5(); // expected-note{{previous declaration is here}} -__declspec(dllimport) void redecl5(); // expected-warning{{redeclaration of 'redecl5' should not add 'dllimport' attribute}} + void redecl5(void); // expected-note{{previous declaration is here}} +__declspec(dllimport) void redecl5(void); // expected-warning{{redeclaration of 'redecl5' should not add 'dllimport' attribute}} // Inline redeclarations. #ifdef GNU // expected-warning@+3{{'redecl6' redeclared inline; 'dllimport' attribute ignored}} #endif -__declspec(dllimport) void redecl6(); - inline void redecl6() {} +__declspec(dllimport) void redecl6(void); + inline void redecl6(void) {} #if defined(MS) || defined (WI) // expected-note@+5{{previous declaration is here}} @@ -212,8 +212,8 @@ __declspec(dllimport) void redecl6(); #else // expected-warning@+3{{'dllimport' attribute ignored on inline function}} #endif - void redecl7(); -__declspec(dllimport) inline void redecl7() {} + void redecl7(void); +__declspec(dllimport) inline void redecl7(void) {} // PR31069: Don't crash trying to merge attributes for redeclaration of invalid // decl. @@ -225,9 +225,9 @@ void __declspec(dllimport) redecl9(void); // expected-note{{previous declaration int redecl9(void) {} // expected-error{{conflicting types for 'redecl9'}} // External linkage is required. -__declspec(dllimport) static int staticFunc(); // expected-error{{'staticFunc' must have external linkage when declared 'dllimport'}} +__declspec(dllimport) static int staticFunc(void); // expected-error{{'staticFunc' must have external linkage when declared 'dllimport'}} // Static locals don't count as having external linkage. -void staticLocalFunc() { +void staticLocalFunc(void) { __declspec(dllimport) static int staticLocal; // expected-error{{'staticLocal' must have external linkage when declared 'dllimport'}} } diff --git a/clang/test/Sema/empty1.c b/clang/test/Sema/empty1.c index 39a46a7b7cd53d..6c5fe76833f3f6 100644 --- a/clang/test/Sema/empty1.c +++ b/clang/test/Sema/empty1.c @@ -42,7 +42,7 @@ struct emp_9 { // expected-warning {{struct has size 0 in C, non-zero size in C+ // Checks for pointer subtraction (PR15683) struct emp_1 *func_1p(struct emp_1 *x) { return x - 5; } -int func_1() { +int func_1(void) { struct emp_1 v[1]; return v - v; // expected-warning {{subtraction of pointers to type 'struct emp_1' of zero size has undefined behavior}} } @@ -63,7 +63,7 @@ int func_5(volatile struct emp_1 *x, const struct emp_1 *y) { return x - y; // expected-warning {{subtraction of pointers to type 'struct emp_1' of zero size has undefined behavior}} } -int func_6() { +int func_6(void) { union emp_2 v[1]; return v - v; // expected-warning {{subtraction of pointers to type 'union emp_2' of zero size has undefined behavior}} } diff --git a/clang/test/Sema/enable_if-ext.c b/clang/test/Sema/enable_if-ext.c index 1e605d49b60fd0..bcdf85bf28d089 100644 --- a/clang/test/Sema/enable_if-ext.c +++ b/clang/test/Sema/enable_if-ext.c @@ -12,39 +12,39 @@ __attribute__ (( enable_if(1, "") )) #if defined(WARN_PEDANTIC) // expected-warning@-2 {{'enable_if' is a clang extension}} #endif -void f() { } +void f(void) { } __attribute__ (( __enable_if__(1, "") )) #if defined(WARN_PEDANTIC) // expected-warning@-2 {{'enable_if' is a clang extension}} #endif -void g() { } +void g(void) { } __attribute__ (( enable_if(0, "") )) #if defined(WARN_PEDANTIC) // expected-warning@-2 {{'enable_if' is a clang extension}} #endif -void h() { } +void h(void) { } __attribute__ (( __enable_if__(0, "") )) #if defined(WARN_PEDANTIC) // expected-warning@-2 {{'enable_if' is a clang extension}} #endif -void i() { } +void i(void) { } #pragma clang system_header __attribute__ (( enable_if(1, "") )) -void j() { } +void j(void) { } __attribute__ (( __enable_if__(1, "") )) -void k() { } +void k(void) { } __attribute__ (( enable_if(0, "") )) -void l() { } +void l(void) { } __attribute__ (( __enable_if__(0, "") )) -void m() { } +void m(void) { } #endif diff --git a/clang/test/Sema/enable_if.c b/clang/test/Sema/enable_if.c index d96a53d94e1e18..22eb84fa7275c0 100644 --- a/clang/test/Sema/enable_if.c +++ b/clang/test/Sema/enable_if.c @@ -10,7 +10,7 @@ enum { TRUE = 1 }; int open(const char *pathname, int flags) __attribute__((enable_if(!(flags & O_CREAT), "must specify mode when using O_CREAT"))) __attribute__((overloadable)); // expected-note{{candidate disabled: must specify mode when using O_CREAT}} int open(const char *pathname, int flags, mode_t mode) __attribute__((overloadable)); // expected-note{{candidate function not viable: requires 3 arguments, but 2 were provided}} -void test1() { +void test1(void) { #ifndef CODEGEN open("path", O_CREAT); // expected-error{{no matching function for call to 'open'}} #endif @@ -93,7 +93,7 @@ void test4(int c) { #endif } -void test5() { +void test5(void) { int (*p1)(int) = &isdigit2; int (*p2)(int) = isdigit2; void *p3 = (void *)&isdigit2; @@ -116,12 +116,12 @@ void f(int n) __attribute__((enable_if(global == 0, "chosen when 'global' is zer enum { cst = 7 }; void return_cst(void) __attribute__((overloadable)) __attribute__((enable_if(cst == 7, "chosen when 'cst' is 7"))); -void test_return_cst() { return_cst(); } +void test_return_cst(void) { return_cst(); } void f2(void) __attribute__((overloadable)) __attribute__((enable_if(1, "always chosen"))); void f2(void) __attribute__((overloadable)) __attribute__((enable_if(0, "never chosen"))); void f2(void) __attribute__((overloadable)) __attribute__((enable_if(TRUE, "always chosen #2"))); -void test6() { +void test6(void) { void (*p1)(void) = &f2; // expected-error{{initializing 'void (*)(void)' with an expression of incompatible type ''}} expected-note@121{{candidate function}} expected-note@122{{candidate function made ineligible by enable_if}} expected-note@123{{candidate function}} void (*p2)(void) = f2; // expected-error{{initializing 'void (*)(void)' with an expression of incompatible type ''}} expected-note@121{{candidate function}} expected-note@122{{candidate function made ineligible by enable_if}} expected-note@123{{candidate function}} void *p3 = (void*)&f2; // expected-error{{address of overloaded function 'f2' is ambiguous}} expected-note@121{{candidate function}} expected-note@122{{candidate function made ineligible by enable_if}} expected-note@123{{candidate function}} @@ -130,7 +130,7 @@ void test6() { void f3(int m) __attribute__((overloadable)) __attribute__((enable_if(m >= 0, "positive"))); void f3(int m) __attribute__((overloadable)) __attribute__((enable_if(m < 0, "negative"))); -void test7() { +void test7(void) { void (*p1)(int) = &f3; // expected-error{{initializing 'void (*)(int)' with an expression of incompatible type ''}} expected-note@131{{candidate function made ineligible by enable_if}} expected-note@132{{candidate function made ineligible by enable_if}} void (*p2)(int) = f3; // expected-error{{initializing 'void (*)(int)' with an expression of incompatible type ''}} expected-note@131{{candidate function made ineligible by enable_if}} expected-note@132{{candidate function made ineligible by enable_if}} void *p3 = (void*)&f3; // expected-error{{address of overloaded function 'f3' does not match required type 'void'}} expected-note@131{{candidate function made ineligible by enable_if}} expected-note@132{{candidate function made ineligible by enable_if}} @@ -138,13 +138,13 @@ void test7() { } void f4(int m) __attribute__((enable_if(0, ""))); -void test8() { +void test8(void) { void (*p1)(int) = &f4; // expected-error{{cannot take address of function 'f4' because it has one or more non-tautological enable_if conditions}} void (*p2)(int) = f4; // expected-error{{cannot take address of function 'f4' because it has one or more non-tautological enable_if conditions}} } void regular_enable_if(int a) __attribute__((enable_if(a, ""))); // expected-note 3{{declared here}} -void PR27122_ext() { +void PR27122_ext(void) { regular_enable_if(0, 2); // expected-error{{too many arguments}} regular_enable_if(1, 2); // expected-error{{too many arguments}} regular_enable_if(); // expected-error{{too few arguments}} @@ -152,7 +152,7 @@ void PR27122_ext() { // We had a bug where we'd crash upon trying to evaluate varargs. void variadic_enable_if(int a, ...) __attribute__((enable_if(a, ""))); // expected-note 6 {{disabled}} -void variadic_test() { +void variadic_test(void) { variadic_enable_if(1); variadic_enable_if(1, 2); variadic_enable_if(1, "c", 3); diff --git a/clang/test/Sema/enum-attr.c b/clang/test/Sema/enum-attr.c index 933d8ccdcd89ca..1cdd7028e03e0e 100644 --- a/clang/test/Sema/enum-attr.c +++ b/clang/test/Sema/enum-attr.c @@ -40,7 +40,7 @@ enum __attribute__((enum_extensibility())) EnumTooFewArgs { // expected-error{{' struct __attribute__((enum_extensibility(open))) S { // expected-warning{{'enum_extensibility' attribute only applies to enums}}{ }; -void test() { +void test(void) { enum Enum t0 = 100; // expected-warning{{integer constant not in range of enumerated type}} t0 = 1; diff --git a/clang/test/Sema/enum-increment.c b/clang/test/Sema/enum-increment.c index baaa3489b9585f..f0edae3ea48c63 100644 --- a/clang/test/Sema/enum-increment.c +++ b/clang/test/Sema/enum-increment.c @@ -2,7 +2,7 @@ // expected-no-diagnostics enum A { A1, A2, A3 }; typedef enum A A; -void test() { +void test(void) { A a; a++; a--; diff --git a/clang/test/Sema/enum.c b/clang/test/Sema/enum.c index c5ff13a0e6eb77..ae4a8a357e179c 100644 --- a/clang/test/Sema/enum.c +++ b/clang/test/Sema/enum.c @@ -18,7 +18,7 @@ enum x // expected-warning {{enumeration values exceed rang { y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} z = 9223372036854775808ULL }; // expected-warning {{ISO C restricts enumerator values to range of 'int'}} -int test() { +int test(void) { return sizeof(enum e) ; } @@ -39,7 +39,7 @@ enum u0 { U0A }; // expected-error {{use of 'u0' with tag type that does not mat // rdar://6095136 extern enum some_undefined_enum ve2; // expected-warning {{ISO C forbids forward references to 'enum' types}} -void test4() { +void test4(void) { for (; ve2;) // expected-error {{statement requires expression of scalar type}} ; (_Bool)ve2; // expected-error {{arithmetic or pointer type is required}} @@ -62,7 +62,7 @@ enum e0 { // expected-note {{previous definition is here}} enum { PR3173A, PR3173B = PR3173A+50 }; // PR2753 -void foo() { +void foo(void) { enum xpto; // expected-warning{{ISO C forbids forward references to 'enum' types}} enum xpto; // expected-warning{{ISO C forbids forward references to 'enum' types}} } @@ -99,7 +99,7 @@ int CheckPR4515[PR4515b==0?1:-1]; // PR7911 extern enum PR7911T PR7911V; // expected-warning{{ISO C forbids forward references to 'enum' types}} -void PR7911F() { +void PR7911F(void) { switch (PR7911V) // expected-error {{statement requires expression of integer type}} ; } diff --git a/clang/test/Sema/expr-address-of.c b/clang/test/Sema/expr-address-of.c index aed488284ab163..9ddf7dd40e4f98 100644 --- a/clang/test/Sema/expr-address-of.c +++ b/clang/test/Sema/expr-address-of.c @@ -6,7 +6,7 @@ struct entry { struct xx *whatever; int bitf:1; }; void add_one(int *p) { (*p)++; } -void test() { +void test(void) { register struct entry *p; add_one(&p->value); struct entry pvalue; @@ -15,7 +15,7 @@ void test() { add_one(&p->whatever->bitf); // expected-error {{address of bit-field requested}} } -void foo() { +void foo(void) { register int x[10]; &x[10]; // expected-error {{address of register variable requested}} @@ -25,7 +25,7 @@ void foo() { int *x3 = &y[10]; } -void testVectorComponentAccess() { +void testVectorComponentAccess(void) { typedef float v4sf __attribute__ ((vector_size (16))); static v4sf q; float* r = &q[0]; // expected-error {{address of vector element requested}} @@ -37,7 +37,7 @@ float *testExtVectorComponentAccess(float4 x) { return &x.w; // expected-error {{address of vector element requested}} } -void f0() { +void f0(void) { register int *x0; int *_dummy0 = &(*x0); @@ -45,7 +45,7 @@ void f0() { int *_dummy1 = &(*(x1 + 1)); } -void f1() { +void f1(void) { register int x0[10]; int *_dummy00 = x0; // expected-error {{address of register variable requested}} int *_dummy01 = &(*x0); // expected-error {{address of register variable requested}} @@ -68,25 +68,25 @@ void f1() { int *p = ((int *)x0)++; // expected-error {{address of register variable requested}} } -void f2() { +void f2(void) { register int *y; int *_dummy0 = &y; // expected-error {{address of register variable requested}} int *_dummy1 = &y[10]; } -void f3() { - extern void f4(); - void (*_dummy0)() = &****f4; +void f3(void) { + extern void f4(void); + void (*_dummy0)(void) = &****f4; } -void f4() { +void f4(void) { register _Complex int x; int *_dummy0 = &__real__ x; // expected-error {{address of register variable requested}} } -void f5() { +void f5(void) { register int arr[2]; int *_dummy0 = &(int*) arr; // expected-error {{address of register variable requested}} @@ -97,7 +97,7 @@ void f6(register int x) { int * dummy0 = &x; // expected-error {{address of register variable requested}} } -char* f7() { +char* f7(void) { register struct {char* x;} t1 = {"Hello"}; char* dummy1 = &(t1.x[0]); @@ -108,7 +108,7 @@ char* f7() { void* t3 = &(*(void*)0); } -void f8() { +void f8(void) { void *dummy0 = &f8(); // expected-error {{cannot take the address of an rvalue of type 'void'}} extern void v; @@ -118,3 +118,8 @@ void f8() { void *dummy3 = &({ ; }); // expected-error {{cannot take the address of an rvalue of type 'void'}} } + +void f9(void) { + extern void knr(); + void (*_dummy0)() = &****knr; +} diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index c194d9c50bd4e5..31c6d1e01491a7 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -14,13 +14,13 @@ // Test that we don't report divide-by-zero errors in unreachable code. // This test should be left as is, as it also tests CFG functionality. -void radar9171946() { +void radar9171946(void) { if (0) { 0 / (0 ? 1 : 0); // no-warning } } -int test_pr8876() { +int test_pr8876(void) { PR8876(0); // no-warning PR8876_pos(0); // expected-warning{{indirection of non-volatile null pointer will be deleted, not trap}} expected-note{{consider using __builtin_trap() or qualifying pointer with 'volatile'}} return 0; @@ -35,22 +35,22 @@ void pr8183(unsigned long long test) } // PR1966 -_Complex double test1() { +_Complex double test1(void) { return __extension__ 1.0if; } -_Complex double test2() { +_Complex double test2(void) { return 1.0if; // expected-warning {{imaginary constants are a GNU extension}} } // rdar://6097308 -void test3() { +void test3(void) { int x; (__extension__ x) = 10; } // rdar://6162726 -void test4() { +void test4(void) { static int var; var =+ 5; // expected-warning {{use of unary operator that may be intended as compound assignment (+=)}} var =- 5; // expected-warning {{use of unary operator that may be intended as compound assignment (-=)}} @@ -72,7 +72,7 @@ void test5(int *X, float *P) { FOO = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}} } -void test6() { +void test6(void) { int X; X(); // expected-error {{called object type 'int' is not a function or function pointer}} } @@ -128,12 +128,12 @@ int test12b(const char *X) { // rdar://6719156 void test13( - void (^P)()) { // expected-error {{blocks support disabled - compile with -fblocks}} + void (^P)(void)) { // expected-error {{blocks support disabled - compile with -fblocks}} P(); - P = ^(){}; // expected-error {{blocks support disabled - compile with -fblocks}} + P = ^(void){}; // expected-error {{blocks support disabled - compile with -fblocks}} } -void test14() { +void test14(void) { typedef long long __m64 __attribute__((__vector_size__(8))); typedef short __v4hi __attribute__((__vector_size__(8))); @@ -186,7 +186,7 @@ void test18(int b) { typedef int __attribute__((address_space(256))) int_AS256; // PR7569 -void test19() { +void test19(void) { *(int *)0 = 0; // expected-warning {{indirection of non-volatile null pointer}} \ // expected-note {{consider using __builtin_trap}} *(volatile int *)0 = 0; // Ok. @@ -256,7 +256,7 @@ void test21(volatile struct Test21 *ptr) { } // Make sure we do function/array decay. -void test22() { +void test22(void) { if ("help") (void) 0; diff --git a/clang/test/Sema/ext_vector_casts.c b/clang/test/Sema/ext_vector_casts.c index 5c13acab0f58db..2b4e821de7354a 100644 --- a/clang/test/Sema/ext_vector_casts.c +++ b/clang/test/Sema/ext_vector_casts.c @@ -12,7 +12,7 @@ typedef __typeof__(sizeof(int)) size_t; typedef unsigned long ulong2 __attribute__ ((ext_vector_type(2))); typedef size_t stride4 __attribute__((ext_vector_type(4))); -static void test() { +static void test(void) { float2 vec2; float3 vec3; float4 vec4, vec4_2; diff --git a/clang/test/Sema/ext_vector_comparisons.c b/clang/test/Sema/ext_vector_comparisons.c index f1c292ff4a4df4..406c1c4cb8da03 100644 --- a/clang/test/Sema/ext_vector_comparisons.c +++ b/clang/test/Sema/ext_vector_comparisons.c @@ -2,7 +2,7 @@ typedef __attribute__(( ext_vector_type(4) )) int int4; -static int4 test1() { +static int4 test1(void) { int4 vec, rv; // comparisons to self... @@ -17,7 +17,7 @@ static int4 test1() { typedef __attribute__(( ext_vector_type(4) )) float float4; -static int4 test2() { +static int4 test2(void) { float4 vec, rv; // comparisons to self. no warning, they're floats @@ -29,14 +29,14 @@ static int4 test2() { return vec >= vec; // no-warning } -static int4 test3() { +static int4 test3(void) { int4 i0, i1; return i0 > i1 ? i0 : i1; // no-error return i0 ? i0 : i1; // no-error } -static float4 test4() { +static float4 test4(void) { float4 f0, f1; // This would actually generate implicit casting warning diff --git a/clang/test/Sema/ext_vector_components.c b/clang/test/Sema/ext_vector_components.c index 3cdeb215f87615..0102edb01e7560 100644 --- a/clang/test/Sema/ext_vector_components.c +++ b/clang/test/Sema/ext_vector_components.c @@ -7,7 +7,7 @@ typedef __attribute__(( ext_vector_type(16) )) float float16; static float4 vec4_0 = (float4)0.5f; -static void test() { +static void test(void) { float2 vec2, vec2_2; float3 vec3; float4 vec4, vec4_2, *vec4p; diff --git a/clang/test/Sema/ext_vector_conversions.c b/clang/test/Sema/ext_vector_conversions.c index aa57e2b17ea27f..33183e2a5e58f9 100644 --- a/clang/test/Sema/ext_vector_conversions.c +++ b/clang/test/Sema/ext_vector_conversions.c @@ -4,7 +4,7 @@ typedef __attribute__((ext_vector_type(4))) char char4; typedef __attribute__((ext_vector_type(4))) short short4; typedef __attribute__((ext_vector_type(1))) float float1; -static void test() { +static void test(void) { char4 vc4; float f; // Not allowed. There's no splatting conversion between float and int vector, diff --git a/clang/test/Sema/flexible-array-init.c b/clang/test/Sema/flexible-array-init.c index 78fc7c5e0df370..d3620154c5f0ce 100644 --- a/clang/test/Sema/flexible-array-init.c +++ b/clang/test/Sema/flexible-array-init.c @@ -6,7 +6,7 @@ struct one { struct one x2 = { 5, 1, 2, 3 }; // expected-warning{{flexible array initialization is a GNU extension}} -void test() { +void test(void) { struct one x3 = {5, {1, 2, 3}}; // expected-error{{initialization of flexible array member is not allowed}} struct one x3a = { 5 }; struct one x3b = { .a = 5 }; @@ -70,7 +70,7 @@ struct PR8217a { char v[]; // expected-note 2 {{initialized flexible array member 'v' is here}} }; -void PR8217() { +void PR8217(void) { struct PR8217a foo1 = { .i = 0, .v = "foo" }; // expected-error {{initialization of flexible array member is not allowed}} struct PR8217a foo2 = { .i = 0 }; struct PR8217a foo3 = { .i = 0, .v = { 'b', 'a', 'r', '\0' } }; // expected-error {{initialization of flexible array member is not allowed}} @@ -81,11 +81,11 @@ typedef struct PR10648 { unsigned long n; int v[]; // expected-note {{initialized flexible array member 'v' is here}} } PR10648; -int f10648() { +int f10648(void) { return (PR10648){2, {3, 4}}.v[1]; // expected-error {{initialization of flexible array member is not allowed}} } struct FlexWithUnnamedBitfield { int : 10; int x; int y[]; }; // expected-note {{initialized flexible array member 'y' is here}} -void TestFlexWithUnnamedBitfield() { +void TestFlexWithUnnamedBitfield(void) { struct FlexWithUnnamedBitfield x = {10, {3}}; // expected-error {{initialization of flexible array member is not allowed}} } diff --git a/clang/test/Sema/format-bool.c b/clang/test/Sema/format-bool.c index a592665494cd90..4b72c3dbd022da 100644 --- a/clang/test/Sema/format-bool.c +++ b/clang/test/Sema/format-bool.c @@ -19,7 +19,7 @@ BOOL b; #define NO __objc_no #endif -int main() { +int main(void) { p("%d", b); p("%hd", b); #ifdef TYPE_CONF diff --git a/clang/test/Sema/format-strings-bitfield-promotion.c b/clang/test/Sema/format-strings-bitfield-promotion.c index cbe00e7510dd80..42c851cf93614c 100644 --- a/clang/test/Sema/format-strings-bitfield-promotion.c +++ b/clang/test/Sema/format-strings-bitfield-promotion.c @@ -10,7 +10,7 @@ struct bitfields { unsigned long d : 32; // assumes that int is 32 bits } bf; -void bitfield_promotion() { +void bitfield_promotion(void) { printf("%ld", bf.a); // expected-warning {{format specifies type 'long' but the argument has type 'int'}} printf("%lu", bf.b); // expected-warning {{format specifies type 'unsigned long' but the argument has type 'int'}} printf("%ld", bf.c); // expected-warning {{format specifies type 'long' but the argument has type 'int'}} diff --git a/clang/test/Sema/format-strings-darwin.c b/clang/test/Sema/format-strings-darwin.c index 46e717eb9d788c..d889e7608185a8 100644 --- a/clang/test/Sema/format-strings-darwin.c +++ b/clang/test/Sema/format-strings-darwin.c @@ -10,7 +10,7 @@ int printf(const char *restrict, ...); int scanf(const char * restrict, ...) ; -void test() { +void test(void) { int justRight = 1; long tooLong = 2; diff --git a/clang/test/Sema/format-strings-enum.c b/clang/test/Sema/format-strings-enum.c index ba077a887e0113..12d7d7f8704593 100644 --- a/clang/test/Sema/format-strings-enum.c +++ b/clang/test/Sema/format-strings-enum.c @@ -40,7 +40,7 @@ void testLong(LongEnum input) { // GNU C allows forward declaring enums. extern enum forward_declared *fwd; -void forward_enum() { +void forward_enum(void) { printf("%u", fwd); // expected-warning{{format specifies type 'unsigned int' but the argument has type 'enum forward_declared *}} printf("%p", fwd); diff --git a/clang/test/Sema/format-strings-fixit-ssize_t.c b/clang/test/Sema/format-strings-fixit-ssize_t.c index f8893a14a412eb..2c83db0b663629 100644 --- a/clang/test/Sema/format-strings-fixit-ssize_t.c +++ b/clang/test/Sema/format-strings-fixit-ssize_t.c @@ -11,7 +11,7 @@ int printf(char const *, ...); int scanf(const char *, ...); -void test() { +void test(void) { typedef signed long int ssize_t; printf("%f", (ssize_t) 42); ssize_t s; diff --git a/clang/test/Sema/format-strings-fixit.c b/clang/test/Sema/format-strings-fixit.c index b982eb45e5f930..e6d638b75a71d7 100644 --- a/clang/test/Sema/format-strings-fixit.c +++ b/clang/test/Sema/format-strings-fixit.c @@ -16,7 +16,7 @@ typedef __UINTMAX_TYPE__ uintmax_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __WCHAR_TYPE__ wchar_t; -void test() { +void test(void) { // Basic types printf("%s", (int) 123); printf("abc%0f", "testing testing 123"); diff --git a/clang/test/Sema/format-strings-gnu.c b/clang/test/Sema/format-strings-gnu.c index fc524e93ed48b6..222ae30f8d9398 100644 --- a/clang/test/Sema/format-strings-gnu.c +++ b/clang/test/Sema/format-strings-gnu.c @@ -9,7 +9,7 @@ int printf(const char *restrict, ...); int scanf(const char * restrict, ...) ; -void test() { +void test(void) { long notLongEnough = 1; long long quiteLong = 2; @@ -29,7 +29,7 @@ void test() { #endif } -void testAlwaysInvalid() { +void testAlwaysInvalid(void) { // We should not suggest 'll' here! printf("%Lc", 'a'); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 'c' conversion specifier}} printf("%Ls", "a"); // expected-warning {{length modifier 'L' results in undefined behavior or no effect with 's' conversion specifier}} diff --git a/clang/test/Sema/format-strings-ms.c b/clang/test/Sema/format-strings-ms.c index 56a349051d427a..697032673d4e77 100644 --- a/clang/test/Sema/format-strings-ms.c +++ b/clang/test/Sema/format-strings-ms.c @@ -18,7 +18,7 @@ void non_iso_warning_test(__int32 i32, __int64 i64, wchar_t c, void *p) { #else -void signed_test() { +void signed_test(void) { short val = 30; printf("val = %I64d\n", val); // expected-warning{{format specifies type '__int64' (aka 'long long') but the argument has type 'short'}} long long bigval = 30; @@ -26,7 +26,7 @@ void signed_test() { printf("val = %Id\n", bigval); // expected-warning{{format specifies type '__int32' (aka 'int') but the argument has type 'long long'}} } -void unsigned_test() { +void unsigned_test(void) { unsigned short val = 30; printf("val = %I64u\n", val); // expected-warning{{format specifies type 'unsigned __int64' (aka 'unsigned long long') but the argument has type 'unsigned short'}} unsigned long long bigval = 30; diff --git a/clang/test/Sema/format-strings-no-fixit.c b/clang/test/Sema/format-strings-no-fixit.c index 701e945f69021a..dd323bf5c5de7b 100644 --- a/clang/test/Sema/format-strings-no-fixit.c +++ b/clang/test/Sema/format-strings-no-fixit.c @@ -10,7 +10,7 @@ int printf(char const *, ...); int scanf(char const *, ...); -void pr9751() { +void pr9751(void) { const char kFormat1[] = "%s"; printf(kFormat1, 5); printf("%s", 5); diff --git a/clang/test/Sema/format-strings-pedantic.c b/clang/test/Sema/format-strings-pedantic.c index d6f94120b5b959..76668978fadfe1 100644 --- a/clang/test/Sema/format-strings-pedantic.c +++ b/clang/test/Sema/format-strings-pedantic.c @@ -5,7 +5,7 @@ __attribute__((format(printf, 1, 2))) int printf(const char *restrict, ...); -int main() { +int main(void) { printf("%p", (int *)0); // expected-warning {{format specifies type 'void *' but the argument has type 'int *'}} printf("%p", (void *)0); diff --git a/clang/test/Sema/format-strings-scanf.c b/clang/test/Sema/format-strings-scanf.c index b7cdd7dd4a9a5c..7b864bfdd237e7 100644 --- a/clang/test/Sema/format-strings-scanf.c +++ b/clang/test/Sema/format-strings-scanf.c @@ -68,7 +68,7 @@ void bad_length_modifiers(char *s, void *p, wchar_t *ws, long double *ld) { // Test that the scanf call site is where the warning is attached. If the // format string is somewhere else, point to it in a note. -void pr9751() { +void pr9751(void) { int *i; char str[100]; const char kFormat1[] = "%00d"; // expected-note{{format string is defined here}}} @@ -190,7 +190,7 @@ void test_qualifiers(const int *cip, volatile int* vip, scanf("%d", (cip_t)0); // expected-warning{{format specifies type 'int *' but the argument has type 'cip_t' (aka 'const int *')}} } -void test_size_types() { +void test_size_types(void) { size_t s = 0; scanf("%zu", &s); // No warning. @@ -210,7 +210,7 @@ void test_size_types() { scanf("%zn", &d3); // expected-warning-re{{format specifies type 'ssize_t *' (aka '{{.+}}') but the argument has type 'double *'}} } -void test_ptrdiff_t_types() { +void test_ptrdiff_t_types(void) { __UNSIGNED_PTRDIFF_TYPE__ p1 = 0; scanf("%tu", &p1); // No warning. diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c index bb5c4c4d1de7f4..eafda54c18172e 100644 --- a/clang/test/Sema/format-strings.c +++ b/clang/test/Sema/format-strings.c @@ -122,7 +122,7 @@ void check_conditional_literal(const char* s, int i) { #if !defined(__ANDROID__) && !defined(__Fuchsia__) -void check_writeback_specifier() +void check_writeback_specifier(void) { int x; char *b; @@ -160,7 +160,7 @@ void check_writeback_specifier() #else -void check_writeback_specifier() +void check_writeback_specifier(void) { int x; printf("%n", &x); // expected-warning{{'%n' specifier not supported on this platform}} @@ -244,7 +244,7 @@ void check_asterisk_precision_width(int x) { void __attribute__((format(printf,1,3))) myprintf(const char*, int blah, ...); -void test_myprintf() { +void test_myprintf(void) { myprintf("%d", 17, 18); // okay } @@ -318,7 +318,7 @@ void test10(int x, float f, int i, long long lli) { typedef unsigned char uint8_t; -void should_understand_small_integers() { +void should_understand_small_integers(void) { printf("%hhu", (short) 10); // expected-warning{{format specifies type 'unsigned char' but the argument has type 'short'}} printf("%hu\n", (unsigned char)1); // warning with -Wformat-pedantic only printf("%hu\n", (uint8_t)1); // warning with -Wformat-pedantic only @@ -389,7 +389,7 @@ void test_unicode_conversions(wchar_t *s) { // Mac OS X supports positional arguments in format strings. // This is an IEEE extension (IEEE Std 1003.1). // FIXME: This is probably not portable everywhere. -void test_positional_arguments() { +void test_positional_arguments(void) { printf("%0$", (int)2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} printf("%1$*0$d", (int) 2); // expected-warning{{position arguments in format strings start counting at 1 (not 0)}} printf("%1$d", (int) 2); // no-warning @@ -404,7 +404,7 @@ void test_positional_arguments() { // PR 6697 - Handle format strings where the data argument is not adjacent to the format string void myprintf_PR_6697(const char *format, int x, ...) __attribute__((__format__(printf,1, 3))); -void test_pr_6697() { +void test_pr_6697(void) { myprintf_PR_6697("%s\n", 1, "foo"); // no-warning myprintf_PR_6697("%s\n", 1, (int)0); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}} // FIXME: Not everything should clearly support positional arguments, @@ -419,7 +419,7 @@ void rdar8026030(FILE *fp) { fprintf(fp, "\%"); // expected-warning{{incomplete format specifier}} } -void bug7377_bad_length_mod_usage() { +void bug7377_bad_length_mod_usage(void) { // Bad length modifiers printf("%hhs", "foo"); // expected-warning{{length modifier 'hh' results in undefined behavior or no effect with 's' conversion specifier}} printf("%1$zp", (void *)0); // expected-warning{{length modifier 'z' results in undefined behavior or no effect with 'p' conversion specifier}} @@ -480,7 +480,7 @@ void pr7981(wint_t c, wchar_t c2) { } // -Wformat-security says NULL is not a string literal -void rdar8269537() { +void rdar8269537(void) { // This is likely to crash in most cases, but -Wformat-nonliteral technically // doesn't warn in this case. printf(0); // no-warning @@ -496,12 +496,12 @@ void rdar8332221(va_list ap, int *x, long *y) { } // PR8641 -void pr8641() { +void pr8641(void) { printf("%#x\n", 10); printf("%#X\n", 10); } -void posix_extensions() { +void posix_extensions(void) { // Test %'d, "thousands grouping". // printf("%'d\n", 123456789); // no-warning @@ -516,13 +516,13 @@ void posix_extensions() { #pragma GCC diagnostic warning "-Wformat" #pragma GCC diagnostic ignored "-Wformat-security" -void pr8486() { +void pr8486(void) { printf("%s", 1); // expected-warning{{format specifies type 'char *' but the argument has type 'int'}} } // PR9314 // Don't warn about string literals that are PreDefinedExprs, e.g. __func__. -void pr9314() { +void pr9314(void) { printf(__PRETTY_FUNCTION__); // no-warning printf(__func__); // no-warning } @@ -544,7 +544,7 @@ void check_char(unsigned char x, signed char y) { // Test suppression of individual warnings. -void test_suppress_invalid_specifier() { +void test_suppress_invalid_specifier(void) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wformat-invalid-specifier" printf("%@", 12); // no-warning @@ -557,7 +557,7 @@ void test_suppress_invalid_specifier() { // Test that the printf call site is where the warning is attached. If the // format string is somewhere else, point to it in a note. -void pr9751() { +void pr9751(void) { const char kFormat1[] = "%d %d \n"; // expected-note{{format string is defined here}}} printf(kFormat1, 0); // expected-warning{{more '%' conversions than data arguments}} printf("%d %s\n", 0); // expected-warning{{more '%' conversions than data arguments}} @@ -638,7 +638,7 @@ void pr9751() { 0.0); // expected-warning{{format specifies}} } -void pr18905() { +void pr18905(void) { const char s1[] = "s\0%s"; // expected-note{{format string is defined here}} const char s2[1] = "s"; // expected-note{{format string is defined here}} const char s3[2] = "s\0%s"; // expected-warning{{initializer-string for char array is too long}} @@ -657,7 +657,7 @@ void __attribute__((format(strfmon,1,2))) monformat(const char *fmt, ...); void __attribute__((format(strftime,1,0))) dateformat(const char *fmt); // Other formats -void test_other_formats() { +void test_other_formats(void) { char *str = ""; monformat("", 1); // expected-warning{{format string is empty}} monformat(str); // expected-warning{{format string is not a string literal (potentially insecure)}} @@ -788,7 +788,7 @@ void test_char_pointer_arithmetic(int b) { // expected-note@-2{{format string is defined here}} } -void PR30481() { +void PR30481(void) { // This caused crashes due to invalid casts. printf(1 > 0); // expected-warning{{format string is not a string literal}} expected-warning{{incompatible integer to pointer conversion}} expected-note@format-strings.c:*{{passing argument to parameter here}} expected-note{{to avoid this}} } @@ -797,7 +797,7 @@ void test_printf_opaque_ptr(void *op) { printf("%s", op); // expected-warning{{format specifies type 'char *' but the argument has type 'void *'}} } -void test_block() { +void test_block(void) { void __attribute__((__format__(__printf__, 1, 2))) (^printf_arg1)( const char *, ...) = ^(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2))) { diff --git a/clang/test/Sema/format-type-confusion.c b/clang/test/Sema/format-type-confusion.c index f02bd56676c8fe..03b7b8b8a8c91f 100644 --- a/clang/test/Sema/format-type-confusion.c +++ b/clang/test/Sema/format-type-confusion.c @@ -5,7 +5,7 @@ int printf(const char *msg, ...); #define FMT "%hd %hu %d %u %hhd %hhu %c" -int main() { +int main(void) { _Bool b = 0; printf(FMT, b, // expected-warning {{format specifies type 'short' but the argument has type '_Bool'}} diff --git a/clang/test/Sema/gnu-flags.c b/clang/test/Sema/gnu-flags.c index 163ed50a38a41d..b454549ba94559 100644 --- a/clang/test/Sema/gnu-flags.c +++ b/clang/test/Sema/gnu-flags.c @@ -78,7 +78,7 @@ struct { int x; } emptyinit = {}; // expected-warning@+7 {{use of GNU indirect-goto extension}} #endif -void labelvalue() { +void labelvalue(void) { void *ptr; ptr = &&foo; foo: @@ -90,7 +90,7 @@ void labelvalue() { // expected-warning@+5 {{use of GNU statement expression extension}} #endif -void statementexp() +void statementexp(void) { int a = ({ 1; }); } diff --git a/clang/test/Sema/gnu89.c b/clang/test/Sema/gnu89.c index 1b7f10fee9c232..1be717f54260e8 100644 --- a/clang/test/Sema/gnu89.c +++ b/clang/test/Sema/gnu89.c @@ -2,4 +2,4 @@ int f(int restrict); -void main() {} // expected-warning {{return type of 'main' is not 'int'}} expected-note {{change return type to 'int'}} +void main(void) {} // expected-warning {{return type of 'main' is not 'int'}} expected-note {{change return type to 'int'}} diff --git a/clang/test/Sema/heinous-extensions-off.c b/clang/test/Sema/heinous-extensions-off.c index f5dbd7f1c06bd4..beaf2dcbccaf96 100644 --- a/clang/test/Sema/heinous-extensions-off.c +++ b/clang/test/Sema/heinous-extensions-off.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -verify -int foo() { +int foo(void) { int a; // PR3788 asm("nop" : : "m"((int)(a))); // expected-error {{cast in a inline asm context requiring an lvalue}} diff --git a/clang/test/Sema/heinous-extensions-on.c b/clang/test/Sema/heinous-extensions-on.c index ee3c76ae6c3cf6..9a348d8dfd572d 100644 --- a/clang/test/Sema/heinous-extensions-on.c +++ b/clang/test/Sema/heinous-extensions-on.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -verify -fheinous-gnu-extensions -void foo() { +void foo(void) { int a; // PR3788 asm("nop" : : "m"((int)(a))); // expected-warning {{cast in an inline asm context requiring an lvalue}} diff --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c index c7991155b142c3..4da6c93ac86d39 100644 --- a/clang/test/Sema/i-c-e.c +++ b/clang/test/Sema/i-c-e.c @@ -3,7 +3,7 @@ #include #include -int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{incomplete type 'void' is not assignable}} +int a(void) {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{incomplete type 'void' is not assignable}} // rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e. int expr; @@ -27,7 +27,7 @@ struct c { // Check that we can evaluate statement-expressions properly when // constant-folding inside an ICE. -void PR49239() { +void PR49239(void) { goto check_not_vla; char not_vla[__builtin_constant_p(1) ? ({ 42; }) : -1]; // expected-warning {{statement expression}} check_not_vla:; diff --git a/clang/test/Sema/implicit-builtin-redecl.c b/clang/test/Sema/implicit-builtin-redecl.c index 9fb7e62454bdc9..341ac09a0fdbb2 100644 --- a/clang/test/Sema/implicit-builtin-redecl.c +++ b/clang/test/Sema/implicit-builtin-redecl.c @@ -13,13 +13,13 @@ void f1(void) { calloc(0, 0, 0); } -void f2() { +void f2(void) { int index = 1; } static int index; -int f3() { +int f3(void) { return index << 2; } diff --git a/clang/test/Sema/implicit-decl.c b/clang/test/Sema/implicit-decl.c index 2ae4c009bd4776..d60d4875d22481 100644 --- a/clang/test/Sema/implicit-decl.c +++ b/clang/test/Sema/implicit-decl.c @@ -8,7 +8,7 @@ typedef unsigned char Boolean; extern int printf(__const char *__restrict __format, ...); // expected-note{{'printf' declared here}} -void func() { +void func(void) { int32_t *vector[16]; const char compDesc[16 + 1]; int32_t compCount = 0; @@ -27,7 +27,7 @@ Boolean _CFCalendarDecomposeAbsoluteTimeV(const char *componentDesc, int32_t **v // Test the typo-correction callback in Sema::ImplicitlyDefineFunction extern int sformatf(char *str, __const char *__restrict __format, ...); // expected-note{{'sformatf' declared here}} -void test_implicit() { +void test_implicit(void) { int formats = 0; formatd("Hello, World!\n"); // expected-error{{implicit declaration of function 'formatd' is invalid in C99}} \ // expected-note{{did you mean 'sformatf'?}} diff --git a/clang/test/Sema/implicit-def.c b/clang/test/Sema/implicit-def.c index 6caa090631e69e..017e493b7f375d 100644 --- a/clang/test/Sema/implicit-def.c +++ b/clang/test/Sema/implicit-def.c @@ -2,7 +2,7 @@ * RUN: not %clang_cc1 -fsyntax-only %s -std=c99 -pedantic-errors */ -int A() { +int A(void) { return X(); } diff --git a/clang/test/Sema/implicit-int-conversion.c b/clang/test/Sema/implicit-int-conversion.c index 6d07d385e0bdd2..3d2d83c5c4ea3a 100644 --- a/clang/test/Sema/implicit-int-conversion.c +++ b/clang/test/Sema/implicit-int-conversion.c @@ -3,7 +3,7 @@ // RUN: %clang_cc1 %s -verify -Wconversion -Wno-implicit-float-conversion -DSMALL=float -DBIG=double -DNO_DIAG // RUN: %clang_cc1 %s -verify -Wno-conversion -Wimplicit-float-conversion -DSMALL=float -DBIG=double -void f() { +void f(void) { SMALL a; BIG b = 0; a = b; diff --git a/clang/test/Sema/implicit-int-float-conversion.c b/clang/test/Sema/implicit-int-float-conversion.c index 94714de3f39c14..45be31c2abd886 100644 --- a/clang/test/Sema/implicit-int-float-conversion.c +++ b/clang/test/Sema/implicit-int-float-conversion.c @@ -8,7 +8,7 @@ long testReturn(long a, float b) { } #endif -void testAssignment() { +void testAssignment(void) { float f = 222222; double b = 222222222222L; @@ -21,7 +21,7 @@ void testAssignment() { #endif } -void testExpression() { +void testExpression(void) { float a = 0.0f; float b = 222222222222L + a; // expected-warning {{changes value from 222222222222 to 222222221312}} @@ -38,7 +38,7 @@ void testExpression() { double f = i + e; } -void testCNarrowing() { +void testCNarrowing(void) { // Since this is a C file. C++11 narrowing is not in effect. // In this case, we should issue warnings. float a = {222222222222L}; // expected-warning {{changes value from 222222222222 to 222222221312}} diff --git a/clang/test/Sema/implicit-intel-builtin-decl.c b/clang/test/Sema/implicit-intel-builtin-decl.c index e588a4b8866ef6..c9299eedbb36cc 100644 --- a/clang/test/Sema/implicit-intel-builtin-decl.c +++ b/clang/test/Sema/implicit-intel-builtin-decl.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +sse2 -fsyntax-only -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-feature +sse2 -fsyntax-only -verify %s -x c++ -void f() { +void f(void) { (void)_mm_getcsr(); // expected-warning{{implicitly declaring library function '_mm_getcsr'}} \ // expected-note{{include the header or explicitly provide a declaration for '_mm_getcsr'}} _mm_setcsr(1); // expected-warning{{implicitly declaring library function '_mm_setcsr'}} \ @@ -19,16 +19,16 @@ void f() { // expected-note{{include the header or explicitly provide a declaration for '_mm_pause'}} } -unsigned int _mm_getcsr(); +unsigned int _mm_getcsr(void); void _mm_setcsr(unsigned int); -void _mm_sfence(); +void _mm_sfence(void); void _mm_clflush(void const *); -void _mm_lfence(); -void _mm_mfence(); -void _mm_pause(); +void _mm_lfence(void); +void _mm_mfence(void); +void _mm_pause(void); -void g() { +void g(void) { (void)_mm_getcsr(); _mm_setcsr(1); _mm_sfence(); diff --git a/clang/test/Sema/implicit-ms-builtin-decl.c b/clang/test/Sema/implicit-ms-builtin-decl.c index 9a3e410c47d80a..0a1d255bfb6ee8 100644 --- a/clang/test/Sema/implicit-ms-builtin-decl.c +++ b/clang/test/Sema/implicit-ms-builtin-decl.c @@ -1,26 +1,26 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fsyntax-only -verify %s -fms-extensions // RUN: %clang_cc1 -triple i386-unknown-unknown -fsyntax-only -verify %s -fms-extensions -void f() { +void f(void) { (void)_byteswap_ushort(42); // expected-warning{{implicitly declaring library function '_byteswap_ushort'}} \ // expected-note{{include the header or explicitly provide a declaration for '_byteswap_ushort'}} (void)_byteswap_uint64(42LL); // expected-warning{{implicitly declaring library function '_byteswap_uint64'}} \ // expected-note{{include the header or explicitly provide a declaration for '_byteswap_uint64'}} } -void _byteswap_ulong(); // expected-warning{{incompatible redeclaration of library function '_byteswap_ulong'}} \ +void _byteswap_ulong(void); // expected-warning{{incompatible redeclaration of library function '_byteswap_ulong'}} \ // expected-note{{'_byteswap_ulong' is a builtin}} unsigned short _byteswap_ushort(unsigned short); unsigned long long _byteswap_uint64(unsigned long long); -void g() { +void g(void) { (void)_byteswap_ushort(42); (void)_byteswap_uint64(42LL); } #if defined(__x86_64__) -void h() { +void h(void) { (void)__mulh(21, 2); // expected-warning{{implicitly declaring library function '__mulh'}} \ // expected-note{{include the header or explicitly provide a declaration for '__mulh'}} (void)__umulh(21, 2); // expected-warning{{implicitly declaring library function '__umulh'}} \ @@ -30,14 +30,14 @@ void h() { long long __mulh(long long, long long); unsigned long long __umulh(unsigned long long, unsigned long long); -void i() { +void i(void) { (void)__mulh(21, 2); (void)__umulh(21, 2); } #endif #if defined(i386) -void h() { +void h(void) { (void)__mulh(21LL, 2LL); // expected-warning{{implicit declaration of function '__mulh' is invalid}} (void)__umulh(21ULL, 2ULL); // expected-warning{{implicit declaration of function '__umulh' is invalid}} } diff --git a/clang/test/Sema/incompatible-function-pointer-types.c b/clang/test/Sema/incompatible-function-pointer-types.c index f0f594f8db8418..d0320299ad1169 100644 --- a/clang/test/Sema/incompatible-function-pointer-types.c +++ b/clang/test/Sema/incompatible-function-pointer-types.c @@ -9,6 +9,6 @@ typedef int (*MyFnTyA)(int *, char *); int bar(char *a, int *b) { return 0; } int foo(MyFnTyA x) { return 0; } // expected-note {{passing argument to parameter 'x' here}} -void baz() { +void baz(void) { foo(&bar); // expected-warning {{incompatible function pointer types passing 'int (*)(char *, int *)' to parameter of type 'MyFnTyA' (aka 'int (*)(int *, char *)')}} } diff --git a/clang/test/Sema/incomplete-decl.c b/clang/test/Sema/incomplete-decl.c index 08f86f683b8332..954d4ab0c672f4 100644 --- a/clang/test/Sema/incomplete-decl.c +++ b/clang/test/Sema/incomplete-decl.c @@ -15,7 +15,7 @@ extern struct foo e; int ary[]; // expected-warning {{tentative array definition assumed to have one element}} struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}} -void func() { +void func(void) { int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}} void b; // expected-error {{variable has incomplete type 'void'}} struct foo f; // expected-error {{variable has incomplete type 'struct foo'}} diff --git a/clang/test/Sema/init-ref-c.c b/clang/test/Sema/init-ref-c.c index 38d8c44e2fdf53..2c805aae61a79b 100644 --- a/clang/test/Sema/init-ref-c.c +++ b/clang/test/Sema/init-ref-c.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple arm-unknown-gnu -fsyntax-only -verify %s -void f() { +void f(void) { struct EmptyStruct {}; struct EmptyStruct S; __builtin_va_end(S); // no-crash, expected-error {{non-const lvalue reference to type '__builtin_va_list' cannot bind to a value of unrelated type 'struct EmptyStruct'}} diff --git a/clang/test/Sema/init-struct-qualified.c b/clang/test/Sema/init-struct-qualified.c index 9d18e224f8eb47..ec98e683143f21 100644 --- a/clang/test/Sema/init-struct-qualified.c +++ b/clang/test/Sema/init-struct-qualified.c @@ -7,7 +7,7 @@ typedef struct _NSRect { NSPoint origin; NSSize size; } NSRect; extern const NSPoint NSZeroPoint; -extern NSSize canvasSize(); -void func() { +extern NSSize canvasSize(void); +void func(void) { const NSRect canvasRect = { NSZeroPoint, canvasSize() }; } diff --git a/clang/test/Sema/init.c b/clang/test/Sema/init.c index 26fb7c813b1984..7aee651aba2255 100644 --- a/clang/test/Sema/init.c +++ b/clang/test/Sema/init.c @@ -25,7 +25,7 @@ struct union_crash }; }; -int test() { +int test(void) { int a[10]; int b[10] = a; // expected-error {{array initializer must be an initializer list}} int +; // expected-error {{expected identifier or '('}} @@ -38,9 +38,9 @@ int test() { struct cdiff_cmd { const char *name; unsigned short argc; - int (*handler)(); + int (*handler)(void); }; -int cdiff_cmd_open(); +int cdiff_cmd_open(void); struct cdiff_cmd commands[] = { {"OPEN", 1, &cdiff_cmd_open } }; @@ -148,14 +148,14 @@ const double pr5447 = (0.05 < -1.0) ? -1.0 : 0.0499878; // behaviour of accepting bar and zed but not foo. GCC's behaviour was // changed in 2007 (rev 122551), so we should be able to change too one // day. -int PR4386_bar(); -int PR4386_foo() __attribute((weak)); -int PR4386_zed(); +int PR4386_bar(void); +int PR4386_foo(void) __attribute((weak)); +int PR4386_zed(void); int PR4386_a = ((void *) PR4386_bar) != 0; int PR4386_b = ((void *) PR4386_foo) != 0; // expected-error{{initializer element is not a compile-time constant}} int PR4386_c = ((void *) PR4386_zed) != 0; -int PR4386_zed() __attribute((weak)); +int PR4386_zed(void) __attribute((weak)); // (derived from SPEC vortex benchmark) typedef char strty[10]; diff --git a/clang/test/Sema/inline.c b/clang/test/Sema/inline.c index eced058f8ddc1a..804c51015405e2 100644 --- a/clang/test/Sema/inline.c +++ b/clang/test/Sema/inline.c @@ -7,26 +7,26 @@ // Check the use of static variables in non-static inline functions. static int staticVar; // expected-note + {{'staticVar' declared here}} -static int staticFunction(); // expected-note + {{'staticFunction' declared here}} +static int staticFunction(void); // expected-note + {{'staticFunction' declared here}} static struct { int x; } staticStruct; // expected-note + {{'staticStruct' declared here}} -inline int useStatic () { // expected-note 3 {{use 'static' to give inline function 'useStatic' internal linkage}} +inline int useStatic (void) { // expected-note 3 {{use 'static' to give inline function 'useStatic' internal linkage}} staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} (void)staticStruct.x; // expected-warning{{static variable 'staticStruct' is used in an inline function with external linkage}} return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} } -extern inline int useStaticFromExtern () { // no suggestions +extern inline int useStaticFromExtern (void) { // no suggestions staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} } -static inline int useStaticFromStatic () { +static inline int useStaticFromStatic (void) { staticFunction(); // no-warning return staticVar; // no-warning } -extern inline int useStaticInlineFromExtern () { +extern inline int useStaticInlineFromExtern (void) { // Heuristic: if the function we're using is also inline, don't warn. // This can still be wrong (in this case, we end up inlining calls to // staticFunction and staticVar) but this got very noisy even using @@ -34,9 +34,9 @@ extern inline int useStaticInlineFromExtern () { return useStaticFromStatic(); // no-warning } -static int constFunction() __attribute__((const)); +static int constFunction(void) __attribute__((const)); -inline int useConst () { +inline int useConst (void) { return constFunction(); // no-warning } @@ -56,7 +56,7 @@ int d(inline int a); // expected-error{{'inline' can only appear on functions}} // Check that the warnings from the "header file" aren't on by default in // the main source file. -inline int useStaticMainFile () { +inline int useStaticMainFile (void) { staticFunction(); // no-warning return staticVar; // no-warning } @@ -66,32 +66,32 @@ inline int useStaticMainFile () { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wstatic-in-inline" -inline int useStaticAgain () { // expected-note 2 {{use 'static' to give inline function 'useStaticAgain' internal linkage}} +inline int useStaticAgain (void) { // expected-note 2 {{use 'static' to give inline function 'useStaticAgain' internal linkage}} staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} } #pragma clang diagnostic pop -inline void defineStaticVar() { // expected-note {{use 'static' to give inline function 'defineStaticVar' internal linkage}} +inline void defineStaticVar(void) { // expected-note {{use 'static' to give inline function 'defineStaticVar' internal linkage}} static const int x = 0; // ok static int y = 0; // expected-warning {{non-constant static local variable in inline function may be different in different files}} } -extern inline void defineStaticVarInExtern() { +extern inline void defineStaticVarInExtern(void) { static const int x = 0; // ok static int y = 0; // ok } // Check behavior of line markers. # 1 "XXX.h" 1 -inline int useStaticMainFileInLineMarker() { // expected-note 2 {{use 'static' to give inline function 'useStaticMainFileInLineMarker' internal linkage}} +inline int useStaticMainFileInLineMarker(void) { // expected-note 2 {{use 'static' to give inline function 'useStaticMainFileInLineMarker' internal linkage}} staticFunction(); // expected-warning{{static function 'staticFunction' is used in an inline function with external linkage}} return staticVar; // expected-warning{{static variable 'staticVar' is used in an inline function with external linkage}} } # 100 "inline.c" 2 -inline int useStaticMainFileAfterLineMarker() { +inline int useStaticMainFileAfterLineMarker(void) { staticFunction(); // no-warning return staticVar; // no-warning } diff --git a/clang/test/Sema/integer-overflow.c b/clang/test/Sema/integer-overflow.c index 79e9294067deef..36c84b2d0537ab 100644 --- a/clang/test/Sema/integer-overflow.c +++ b/clang/test/Sema/integer-overflow.c @@ -158,7 +158,7 @@ uint64_t check_integer_overflows(int i) { return ((4608 * 1024 * 1024) + ((uint64_t)(4608 * 1024 * 1024))); } -void check_integer_overflows_in_function_calls() { +void check_integer_overflows_in_function_calls(void) { // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}} (void)f0(4608 * 1024 * 1024); @@ -172,7 +172,7 @@ void check_integer_overflows_in_function_calls() { // expected-warning@+1 {{overflow in expression; result is 536870912 with type 'int'}} (void)f2(0, f0(4608 * 1024 * 1024)); } -void check_integer_overflows_in_array_size() { +void check_integer_overflows_in_array_size(void) { int arr[4608 * 1024 * 1024]; // expected-warning {{overflow in expression; result is 536870912 with type 'int'}} } @@ -204,7 +204,7 @@ struct s2 { } }; -void PR49619() { +void PR49619(void) { int n; n = ({ while (1) diff --git a/clang/test/Sema/internal_linkage.c b/clang/test/Sema/internal_linkage.c index 99db5db4c5059f..79e04885b97774 100644 --- a/clang/test/Sema/internal_linkage.c +++ b/clang/test/Sema/internal_linkage.c @@ -13,11 +13,11 @@ int var4 __attribute__((internal_linkage)); // expected-error{{'internal_linkage int var5 __attribute__((internal_linkage)); // expected-note{{conflicting attribute is here}} int var5 __attribute__((common)); // expected-error{{'common' and 'internal_linkage' attributes are not compatible}} -__attribute__((internal_linkage)) int f() {} +__attribute__((internal_linkage)) int f(void) {} struct __attribute__((internal_linkage)) S { // expected-warning{{'internal_linkage' attribute only applies to variables, functions, and classes}} }; -__attribute__((internal_linkage("foo"))) int g() {} // expected-error{{'internal_linkage' attribute takes no arguments}} +__attribute__((internal_linkage("foo"))) int g(void) {} // expected-error{{'internal_linkage' attribute takes no arguments}} int var6 [[clang::internal_linkage]]; int var7 [[clang::internal_linkage]] __attribute__((common)); // expected-error{{'internal_linkage' and 'common' attributes are not compatible}} \ diff --git a/clang/test/Sema/loop-control.c b/clang/test/Sema/loop-control.c index 1fc35d10218ee4..67a0eb5bdfb4c1 100644 --- a/clang/test/Sema/loop-control.c +++ b/clang/test/Sema/loop-control.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s // RUN: %clang_cc1 -fsyntax-only -x c++ -Werror %s -int pr8880_1() { +int pr8880_1(void) { int first = 1; for ( ; ({ if (first) { first = 0; continue; } 0; }); ) return 0; diff --git a/clang/test/Sema/matrix-cast.c b/clang/test/Sema/matrix-cast.c index 72428da6c530f6..28709929473675 100644 --- a/clang/test/Sema/matrix-cast.c +++ b/clang/test/Sema/matrix-cast.c @@ -9,7 +9,7 @@ typedef int vec __attribute__((vector_size(4))); typedef struct test_struct { } test_struct; -void f1() { +void f1(void) { cx4x4 m1; ix4x4 m2; sx4x4 m3; @@ -49,7 +49,7 @@ typedef signed int signed_int_12x12 __attribute__((matrix_type(12, 12))); typedef unsigned int unsigned_int_12x12 __attribute__((matrix_type(12, 12))); typedef unsigned int unsigned_int_10x10 __attribute__((matrix_type(10, 10))); -void f2() { +void f2(void) { float2_8x8 m1; double_10x10 m2; double_8x8 m3; diff --git a/clang/test/Sema/matrix-type-operators.c b/clang/test/Sema/matrix-type-operators.c index c1345274f06565..7307918b6f8d69 100644 --- a/clang/test/Sema/matrix-type-operators.c +++ b/clang/test/Sema/matrix-type-operators.c @@ -128,7 +128,7 @@ void matrix_matrix_divide(sx10x10_t a, sx5x10_t b, ix10x5_t c, ix10x10_t d, floa // expected-error@-1 {{invalid operands to binary expression ('sx10x10_t' (aka 'float __attribute__((matrix_type(10, 10)))') and 'sx10x10_t')}} } -sx5x10_t get_matrix(); +sx5x10_t get_matrix(void); void insert(sx5x10_t a, float f) { // Non integer indexes. diff --git a/clang/test/Sema/memset-invalid.c b/clang/test/Sema/memset-invalid.c index c763858e26ec62..3532af835b23c8 100644 --- a/clang/test/Sema/memset-invalid.c +++ b/clang/test/Sema/memset-invalid.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -fsyntax-only %s -verify -char memset(); // expected-warning {{incompatible redeclaration of library function 'memset'}} expected-note{{'memset' is a builtin with type}} -char test() { +char memset(void); // expected-warning {{incompatible redeclaration of library function 'memset'}} expected-note{{'memset' is a builtin with type}} +char test(void) { return memset(); } diff --git a/clang/test/Sema/mips-interrupt-attr.c b/clang/test/Sema/mips-interrupt-attr.c index 7c5c9ddab5d6da..7f8958341b8f0f 100644 --- a/clang/test/Sema/mips-interrupt-attr.c +++ b/clang/test/Sema/mips-interrupt-attr.c @@ -3,27 +3,27 @@ struct a { int b; }; struct a test __attribute__((interrupt)); // expected-warning {{'interrupt' attribute only applies to functions and methods}} -__attribute__((interrupt("EIC"))) void foo1() {} // expected-warning {{'interrupt' attribute argument not supported: 'EIC'}} +__attribute__((interrupt("EIC"))) void foo1(void) {} // expected-warning {{'interrupt' attribute argument not supported: 'EIC'}} -__attribute__((interrupt("eic", 1))) void foo2() {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} +__attribute__((interrupt("eic", 1))) void foo2(void) {} // expected-error {{'interrupt' attribute takes no more than 1 argument}} -__attribute__((interrupt("eic"))) void foo3() {} -__attribute__((interrupt("vector=sw0"))) void foo4() {} -__attribute__((interrupt("vector=hw0"))) void foo5() {} -__attribute__((interrupt("vector=hw1"))) void foo6() {} -__attribute__((interrupt("vector=hw2"))) void foo7() {} -__attribute__((interrupt("vector=hw3"))) void foo8() {} -__attribute__((interrupt("vector=hw4"))) void foo9() {} -__attribute__((interrupt("vector=hw5"))) void fooa() {} -__attribute__((interrupt(""))) void food() {} +__attribute__((interrupt("eic"))) void foo3(void) {} +__attribute__((interrupt("vector=sw0"))) void foo4(void) {} +__attribute__((interrupt("vector=hw0"))) void foo5(void) {} +__attribute__((interrupt("vector=hw1"))) void foo6(void) {} +__attribute__((interrupt("vector=hw2"))) void foo7(void) {} +__attribute__((interrupt("vector=hw3"))) void foo8(void) {} +__attribute__((interrupt("vector=hw4"))) void foo9(void) {} +__attribute__((interrupt("vector=hw5"))) void fooa(void) {} +__attribute__((interrupt(""))) void food(void) {} -__attribute__((interrupt)) int foob() {return 0;} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have a 'void' return type}} +__attribute__((interrupt)) int foob(void) {return 0;} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have a 'void' return type}} __attribute__((interrupt())) void fooc(int a) {} // expected-warning {{MIPS 'interrupt' attribute only applies to functions that have no parameters}} -__attribute__((interrupt,mips16)) void fooe() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ +__attribute__((interrupt,mips16)) void fooe(void) {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} -__attribute__((mips16,interrupt)) void foof() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ +__attribute__((mips16,interrupt)) void foof(void) {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} -__attribute__((interrupt)) __attribute__ ((mips16)) void foo10() {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ +__attribute__((interrupt)) __attribute__ ((mips16)) void foo10(void) {} // expected-error {{'mips16' and 'interrupt' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} -__attribute__((mips16)) __attribute ((interrupt)) void foo11() {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ +__attribute__((mips16)) __attribute ((interrupt)) void foo11(void) {} // expected-error {{'interrupt' and 'mips16' attributes are not compatible}} \ // expected-note {{conflicting attribute is here}} diff --git a/clang/test/Sema/mips16_attr_allowed.c b/clang/test/Sema/mips16_attr_allowed.c index c712e902f5fb22..46c9753e43a00e 100644 --- a/clang/test/Sema/mips16_attr_allowed.c +++ b/clang/test/Sema/mips16_attr_allowed.c @@ -1,23 +1,23 @@ // RUN: %clang_cc1 -triple mipsel-linux-gnu -fsyntax-only -verify %s -void foo32(); -void foo16(); -void __attribute__((nomips16)) foo32(); -void __attribute__((mips16)) foo16(); +void foo32(void); +void foo16(void); +void __attribute__((nomips16)) foo32(void); +void __attribute__((mips16)) foo16(void); -void __attribute__((nomips16)) foo32_(); -void __attribute__((mips16)) foo16_(); -void foo32_(); -void foo16_(); +void __attribute__((nomips16)) foo32_(void); +void __attribute__((mips16)) foo16_(void); +void foo32_(void); +void foo16_(void); -void foo32__() __attribute__((nomips16)); -void foo32__() __attribute__((mips16)); +void foo32__(void) __attribute__((nomips16)); +void foo32__(void) __attribute__((mips16)); -void foo32a() __attribute__((nomips16(0))) ; // expected-error {{'nomips16' attribute takes no arguments}} -void __attribute__((mips16(1))) foo16a(); // expected-error {{'mips16' attribute takes no arguments}} +void foo32a(void) __attribute__((nomips16(0))) ; // expected-error {{'nomips16' attribute takes no arguments}} +void __attribute__((mips16(1))) foo16a(void); // expected-error {{'mips16' attribute takes no arguments}} -void __attribute__((nomips16(1, 2))) foo32b(); // expected-error {{'nomips16' attribute takes no arguments}} -void __attribute__((mips16(1, 2))) foo16b(); // expected-error {{'mips16' attribute takes no arguments}} +void __attribute__((nomips16(1, 2))) foo32b(void); // expected-error {{'nomips16' attribute takes no arguments}} +void __attribute__((mips16(1, 2))) foo16b(void); // expected-error {{'mips16' attribute takes no arguments}} __attribute((nomips16)) int a; // expected-error {{attribute only applies to functions}} diff --git a/clang/test/Sema/mips16_attr_not_allowed.c b/clang/test/Sema/mips16_attr_not_allowed.c index 54f27d6198104c..0d15570c83d7c3 100644 --- a/clang/test/Sema/mips16_attr_not_allowed.c +++ b/clang/test/Sema/mips16_attr_not_allowed.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s -void __attribute__((nomips16)) foo32(); // expected-warning {{unknown attribute 'nomips16' ignored}} -void __attribute__((mips16)) foo16(); // expected-warning {{unknown attribute 'mips16' ignored}} +void __attribute__((nomips16)) foo32(void); // expected-warning {{unknown attribute 'nomips16' ignored}} +void __attribute__((mips16)) foo16(void); // expected-warning {{unknown attribute 'mips16' ignored}} diff --git a/clang/test/Sema/ms-inline-asm-invalid-arch.c b/clang/test/Sema/ms-inline-asm-invalid-arch.c index 341b845a26a0eb..7dd1fac66f3e14 100644 --- a/clang/test/Sema/ms-inline-asm-invalid-arch.c +++ b/clang/test/Sema/ms-inline-asm-invalid-arch.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -triple powerpc64-unknown-linux-gnu -fasm-blocks -verify -fsyntax-only -void f() { +void f(void) { __asm nop // expected-error {{unsupported architecture 'powerpc64' for MS-style inline assembly}} } diff --git a/clang/test/Sema/ms-inline-asm.c b/clang/test/Sema/ms-inline-asm.c index 3fc74fa99c35eb..896c74c546d06c 100644 --- a/clang/test/Sema/ms-inline-asm.c +++ b/clang/test/Sema/ms-inline-asm.c @@ -5,7 +5,7 @@ void t1(void) { __asm __asm // expected-error {{__asm used with no assembly instructions}} } -void f() { +void f(void) { int foo; __asm { mov eax, eax @@ -74,7 +74,7 @@ typedef struct { int b; } A; -void t3() { +void t3(void) { __asm { mov eax, [eax] UndeclaredId } // expected-error {{unknown token in expression}} expected-error {{use of undeclared label 'UndeclaredId'}} // FIXME: Only emit one diagnostic here. @@ -84,7 +84,7 @@ void t3() { __asm { mov eax, [eax] A } } -void t4() { +void t4(void) { // The dot in the "intel dot operator" is optional in MSVC. MSVC also does // global field lookup, but we don't. __asm { mov eax, [0] A.a } @@ -96,7 +96,7 @@ void t4() { __asm { mov eax, fs:[0]. A.a } // expected-error {{unexpected token in argument list}} } -void test_operand_size() { +void test_operand_size(void) { __asm { call word t4 } // expected-error {{Expected 'PTR' or 'ptr' token!}} } @@ -111,7 +111,7 @@ __declspec(naked) int t6(int x) { asm { ret } } -void t7() { +void t7(void) { __asm { foo: // expected-note {{inline assembly label 'foo' declared here}} mov eax, 0 @@ -119,13 +119,13 @@ void t7() { goto foo; // expected-error {{cannot jump from this goto statement to label 'foo' inside an inline assembly block}} } -void t8() { +void t8(void) { __asm foo: // expected-note {{inline assembly label 'foo' declared here}} __asm mov eax, 0 goto foo; // expected-error {{cannot jump from this goto statement to label 'foo' inside an inline assembly block}} } -void t9() { +void t9(void) { goto foo; // expected-error {{cannot jump from this goto statement to label 'foo' inside an inline assembly block}} __asm { foo: // expected-note {{inline assembly label 'foo' declared here}} @@ -133,18 +133,18 @@ void t9() { } } -void t10() { +void t10(void) { goto foo; // expected-error {{cannot jump from this goto statement to label 'foo' inside an inline assembly block}} __asm foo: // expected-note {{inline assembly label 'foo' declared here}} __asm mov eax, 0 } -void t11() { +void t11(void) { foo: __asm mov eax, foo // expected-error {{use of undeclared label 'foo'}} expected-warning {{unused label 'foo'}} } -void t12() { +void t12(void) { __asm foo: __asm bar: // expected-warning {{unused label 'bar'}} __asm jmp foo diff --git a/clang/test/Sema/ms-keyword-system-header.c b/clang/test/Sema/ms-keyword-system-header.c index b4ff5683cdfd29..0332ac70b01ba1 100644 --- a/clang/test/Sema/ms-keyword-system-header.c +++ b/clang/test/Sema/ms-keyword-system-header.c @@ -6,7 +6,7 @@ // PR17824: GNU libc uses MS keyword __uptr as an identifier in C mode #include -void fn() { +void fn(void) { WS ws; ws.__uptr = 0; #ifdef MS diff --git a/clang/test/Sema/ms-wchar.c b/clang/test/Sema/ms-wchar.c index ead3d974d34fcb..de5f62a8556480 100644 --- a/clang/test/Sema/ms-wchar.c +++ b/clang/test/Sema/ms-wchar.c @@ -3,7 +3,7 @@ // C++ mode with -fno-wchar works the same as C mode for wchar_t. // RUN: %clang_cc1 -x c++ -fno-wchar -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s -wchar_t f(); // expected-error{{unknown type name 'wchar_t'}} +wchar_t f(void); // expected-error{{unknown type name 'wchar_t'}} // __wchar_t is available as an MS extension. __wchar_t g = L'a'; // expected-note {{previous}} diff --git a/clang/test/Sema/negative-shift-wrapv.c b/clang/test/Sema/negative-shift-wrapv.c index b8748201ffc01e..28218be935fcc4 100644 --- a/clang/test/Sema/negative-shift-wrapv.c +++ b/clang/test/Sema/negative-shift-wrapv.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -Wall -ffreestanding -fsyntax-only -fwrapv -verify %s -int test() { +int test(void) { int i; i = -1 << 1; // no-warning return i; diff --git a/clang/test/Sema/no_stack_protector.c b/clang/test/Sema/no_stack_protector.c index 8e52f0982f52f9..0007435901e840 100644 --- a/clang/test/Sema/no_stack_protector.c +++ b/clang/test/Sema/no_stack_protector.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -void __attribute__((no_stack_protector)) foo() {} +void __attribute__((no_stack_protector)) foo(void) {} int __attribute__((no_stack_protector)) var; // expected-warning {{'no_stack_protector' attribute only applies to functions}} -void __attribute__((no_stack_protector(2))) bar() {} // expected-error {{'no_stack_protector' attribute takes no arguments}} +void __attribute__((no_stack_protector(2))) bar(void) {} // expected-error {{'no_stack_protector' attribute takes no arguments}} diff --git a/clang/test/Sema/nocf_check_attr_not_allowed.c b/clang/test/Sema/nocf_check_attr_not_allowed.c index 2ba71d4aa4c749..aa40920438c6c8 100644 --- a/clang/test/Sema/nocf_check_attr_not_allowed.c +++ b/clang/test/Sema/nocf_check_attr_not_allowed.c @@ -2,4 +2,4 @@ // RUN: %clang_cc1 -triple arm-unknown-linux-gnu -fsyntax-only -verify -fcf-protection=branch %s // RUN: %clang_cc1 -triple arm-unknown-linux-gnu -fsyntax-only -verify %s -void __attribute__((nocf_check)) foo(); // expected-warning-re{{{{((unknown attribute 'nocf_check' ignored)|('nocf_check' attribute ignored; use -fcf-protection to enable the attribute))}}}} +void __attribute__((nocf_check)) foo(void); // expected-warning-re{{{{((unknown attribute 'nocf_check' ignored)|('nocf_check' attribute ignored; use -fcf-protection to enable the attribute))}}}} diff --git a/clang/test/Sema/non-null-warning.c b/clang/test/Sema/non-null-warning.c index 7dfa3900cbb572..1e99dee25067e2 100644 --- a/clang/test/Sema/non-null-warning.c +++ b/clang/test/Sema/non-null-warning.c @@ -9,7 +9,7 @@ int * _Nullable foo(int * _Nonnull x); -int *_Nonnull ret_nonnull(); +int *_Nonnull ret_nonnull(void); int *foo(int *x) { return 0; @@ -33,12 +33,12 @@ int *foo3(int * _Nonnull x) { // expected-warning {{nullability specifier '_Nonn return 0; } -int * ret_nonnull() { +int * ret_nonnull(void) { return 0; // expected-warning {{null returned from function that requires a non-null return value}} } #define SAFE_CALL(X) if (X) foo(X) -int main () { +int main (void) { foo(0); // expected-warning {{null passed to a callee that requires a non-null argument}} (void)sizeof(foo(0)); // expect no diagnostic in unevaluated context. SAFE_CALL(0); // expect no diagnostic for unreachable code. diff --git a/clang/test/Sema/ns_error_enum.m b/clang/test/Sema/ns_error_enum.m index 895f9b8b3356a5..0b8f8f7cced003 100644 --- a/clang/test/Sema/ns_error_enum.m +++ b/clang/test/Sema/ns_error_enum.m @@ -76,6 +76,6 @@ typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalid, InvalidDomain) { typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalid, "domain-string"); // expected-error@-1{{domain argument does not refer to global constant}} -void foo() {} +void foo(void) {} typedef NS_ERROR_ENUM(unsigned char, MyErrorEnumInvalidFunction, foo); // expected-error@-1{{domain argument 'foo' does not refer to global constant}} diff --git a/clang/test/Sema/nullability.c b/clang/test/Sema/nullability.c index 977b29e9bf9dd2..6f049e6d63793e 100644 --- a/clang/test/Sema/nullability.c +++ b/clang/test/Sema/nullability.c @@ -61,7 +61,7 @@ typedef void (* function_pointer_type_5)(int_ptr _Nonnull); void acceptFunctionPtr(_Nonnull int *(*)(void)); void acceptBlockPtr(_Nonnull int *(^)(void)); -void testBlockFunctionPtrNullability() { +void testBlockFunctionPtrNullability(void) { float *fp; fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * _Nonnull (*)(int, int)')}} fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * _Nonnull (^)(int, int)')}} @@ -105,7 +105,7 @@ void accepts_nonnull_1(_Nonnull int *ptr); void (*accepts_nonnull_2)(_Nonnull int *ptr); void (^accepts_nonnull_3)(_Nonnull int *ptr); -void test_accepts_nonnull_null_pointer_literal() { +void test_accepts_nonnull_null_pointer_literal(void) { accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} accepts_nonnull_2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} accepts_nonnull_3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -172,7 +172,7 @@ void conditional_expr(int c) { } // Check nullability of binary conditional expressions. -void binary_conditional_expr() { +void binary_conditional_expr(void) { int * _Nonnull p; int * _Nonnull nonnullP; int * _Nullable nullableP; @@ -210,7 +210,7 @@ void arrays(int ints[_Nonnull], int starSize[_Nonnull *], int vla[_Nonnull GLOBAL_LENGTH], void ** _Nullable reference); -void testDecayedType() { +void testDecayedType(void) { int produceAnErrorMessage = arrays; // expected-warning {{incompatible pointer to integer conversion initializing 'int' with an expression of type 'void (int * _Nonnull, void ** _Nullable, void *** _Nullable, void * _Null_unspecified * _Nonnull * _Nullable, int * _Nonnull, int * _Nonnull, int * _Nonnull, int * _Nonnull, int * _Nonnull, void ** _Nullable)'}} } @@ -234,7 +234,7 @@ void typedefTest(INTS _Nonnull x, INTS _Nonnull x; // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'INTS' (aka 'int[4]')}} _Nonnull INTS x; // expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'INTS' (aka 'int[4]')}} -void arraysInBlocks() { +void arraysInBlocks(void) { typedef int INTS[4]; void (^simple)(int [_Nonnull 2]) = ^(int x[_Nonnull 2]) {}; simple(0); // expected-warning {{null passed to a callee that requires a non-null argument}} diff --git a/clang/test/Sema/objc-bool-constant-conversion-fixit.m b/clang/test/Sema/objc-bool-constant-conversion-fixit.m index eac59a8c602f1d..17741a9f5cf0c2 100644 --- a/clang/test/Sema/objc-bool-constant-conversion-fixit.m +++ b/clang/test/Sema/objc-bool-constant-conversion-fixit.m @@ -4,7 +4,7 @@ BOOL b; -int main() { +int main(void) { BOOL b = 2; // CHECK: BOOL b = 2 ? YES : NO; diff --git a/clang/test/Sema/objc-bool-constant-conversion.m b/clang/test/Sema/objc-bool-constant-conversion.m index 25546ab0a647d8..00619ac8000b39 100644 --- a/clang/test/Sema/objc-bool-constant-conversion.m +++ b/clang/test/Sema/objc-bool-constant-conversion.m @@ -6,7 +6,7 @@ BOOL B; -int main() { +int main(void) { B = 0; B = 1; B = YES; diff --git a/clang/test/Sema/offsetof.c b/clang/test/Sema/offsetof.c index b5e392dda82d31..3a5ddc45cf15ce 100644 --- a/clang/test/Sema/offsetof.c +++ b/clang/test/Sema/offsetof.c @@ -11,7 +11,7 @@ struct external_sun3_core }; -void swap() +void swap(void) { int x; x = offsetof(struct external_sun3_core, c_regs); @@ -25,7 +25,7 @@ void swap() int c[__builtin_offsetof(struct external_sun3_core, X[42].f2) == 344 ? 1 : -1]; // expected-error {{no member named 'f2'}} } -extern int f(); +extern int f(void); struct s1 { int a; }; int v1 = offsetof (struct s1, a) == 0 ? 0 : f(); @@ -66,7 +66,7 @@ int test3 = __builtin_offsetof(struct has_bitfields, j); // expected-error{{cann typedef struct Array { int array[1]; } Array; int test4 = __builtin_offsetof(Array, array); -int test5() { +int test5(void) { return __builtin_offsetof(Array, array[*(int*)0]); // expected-warning{{indirection of non-volatile null pointer}} expected-note{{__builtin_trap}} } diff --git a/clang/test/Sema/outof-range-constant-compare.c b/clang/test/Sema/outof-range-constant-compare.c index ccb55e4a16630f..0578b3d2825346 100644 --- a/clang/test/Sema/outof-range-constant-compare.c +++ b/clang/test/Sema/outof-range-constant-compare.c @@ -3,7 +3,7 @@ int value(void); -int main() +int main(void) { int a = value(); diff --git a/clang/test/Sema/outof-range-enum-constant-compare.c b/clang/test/Sema/outof-range-enum-constant-compare.c index b9ce08f68c0e0a..b6264abbb506fb 100644 --- a/clang/test/Sema/outof-range-enum-constant-compare.c +++ b/clang/test/Sema/outof-range-enum-constant-compare.c @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -DSILENCE -Wno-tautological-constant-out-of-range-compare -verify %s // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -DSIGNED -DSILENCE -Wno-tautological-constant-out-of-range-compare -verify %s -int main() { +int main(void) { enum A { A_a = 2 }; enum A a; @@ -219,7 +219,7 @@ int main() { } // https://bugs.llvm.org/show_bug.cgi?id=35009 -int PR35009() { +int PR35009(void) { enum A { A_a = 2 }; enum A a; diff --git a/clang/test/Sema/overload-arm-mve.c b/clang/test/Sema/overload-arm-mve.c index 4b1f66d803a9e6..3b1a4430747f12 100644 --- a/clang/test/Sema/overload-arm-mve.c +++ b/clang/test/Sema/overload-arm-mve.c @@ -110,6 +110,6 @@ int expect_error(uint64x2_t v) { } typedef __attribute__((__clang_arm_mve_strict_polymorphism)) int i; // expected-error {{'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type}} -typedef __attribute__((__clang_arm_mve_strict_polymorphism)) int f(); // expected-error {{'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type}} +typedef __attribute__((__clang_arm_mve_strict_polymorphism)) int f(void); // expected-error {{'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type}} typedef __attribute__((__clang_arm_mve_strict_polymorphism)) struct { uint16x8_t v; } s; // expected-error {{'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type}} #endif diff --git a/clang/test/Sema/parentheses.c b/clang/test/Sema/parentheses.c index 164fe4c0f12d59..f0090c2ee9d14a 100644 --- a/clang/test/Sema/parentheses.c +++ b/clang/test/Sema/parentheses.c @@ -47,7 +47,7 @@ void bitwise_rel(unsigned i) { (void)(i != 1 & i != 2 & i != 3); } -_Bool someConditionFunc(); +_Bool someConditionFunc(void); void conditional_op(int x, int y, _Bool b, void* p) { (void)(x + someConditionFunc() ? 1 : 2); // expected-warning {{operator '?:' has lower precedence than '+'}} \ diff --git a/clang/test/Sema/pass-object-size.c b/clang/test/Sema/pass-object-size.c index 8c357b2637c699..c2e9f145efa2b3 100644 --- a/clang/test/Sema/pass-object-size.c +++ b/clang/test/Sema/pass-object-size.c @@ -40,7 +40,7 @@ void IsOverloaded(void *p PS(0)) overloaded; // expected-note 2 {{candidate addr // char* inestead of void* is intentional void IsOverloaded(char *p) overloaded; // expected-note{{passing argument to parameter 'p' here}} expected-note 2 {{type mismatch}} -void FunctionPtrs() { +void FunctionPtrs(void) { void (*p)(void *) = NotOverloaded; //expected-error{{cannot take address of function 'NotOverloaded' because parameter 1 has pass_object_size attribute}} void (*p2)(void *) = &NotOverloaded; //expected-error{{cannot take address of function 'NotOverloaded' because parameter 1 has pass_object_size attribute}} diff --git a/clang/test/Sema/patchable-function-entry-attr.c b/clang/test/Sema/patchable-function-entry-attr.c index 0fa1abdbd8ab4a..89e4380c36230d 100644 --- a/clang/test/Sema/patchable-function-entry-attr.c +++ b/clang/test/Sema/patchable-function-entry-attr.c @@ -1,17 +1,17 @@ // RUN: %clang_cc1 -triple aarch64 -fsyntax-only -verify %s // expected-error@+1 {{'patchable_function_entry' attribute takes at least 1 argument}} -__attribute__((patchable_function_entry)) void f(); +__attribute__((patchable_function_entry)) void f(void); // expected-error@+1 {{'patchable_function_entry' attribute takes no more than 2 arguments}} -__attribute__((patchable_function_entry(0, 0, 0))) void f(); +__attribute__((patchable_function_entry(0, 0, 0))) void f(void); // expected-error@+1 {{'patchable_function_entry' attribute requires a non-negative integral compile time constant expression}} -__attribute__((patchable_function_entry(-1))) void f(); +__attribute__((patchable_function_entry(-1))) void f(void); int i; // expected-error@+1 {{'patchable_function_entry' attribute requires parameter 0 to be an integer constant}} -__attribute__((patchable_function_entry(i))) void f(); +__attribute__((patchable_function_entry(i))) void f(void); // expected-error@+1 {{'patchable_function_entry' attribute requires integer constant between 0 and 2 inclusive}} -__attribute__((patchable_function_entry(2, 3))) void f(); +__attribute__((patchable_function_entry(2, 3))) void f(void); diff --git a/clang/test/Sema/pointer-subtraction.c b/clang/test/Sema/pointer-subtraction.c index 81e4936ad0298d..c3dbbd47459fa1 100644 --- a/clang/test/Sema/pointer-subtraction.c +++ b/clang/test/Sema/pointer-subtraction.c @@ -5,7 +5,7 @@ #include -void a() { +void a(void) { char *f = (char *)0; f = (char *)((char *)0 - f); // expected-warning {{performing pointer subtraction with a null pointer has undefined behavior}} f = (char *)(f - (char *)0); // expected-warning {{performing pointer subtraction with a null pointer has undefined behavior}} diff --git a/clang/test/Sema/pragma-attribute-namespace.c b/clang/test/Sema/pragma-attribute-namespace.c index e7a36afcdc23d8..067974d72cf2ab 100644 --- a/clang/test/Sema/pragma-attribute-namespace.c +++ b/clang/test/Sema/pragma-attribute-namespace.c @@ -6,19 +6,19 @@ #pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}} -int some_func(); // expected-note{{when applied to this declaration}} +int some_func(void); // expected-note{{when applied to this declaration}} #pragma clang attribute pop // expected-error{{'#pragma clang attribute pop' with no matching '#pragma clang attribute push'}} #pragma clang attribute NotMyNamespace.pop // expected-error{{'#pragma clang attribute NotMyNamespace.pop' with no matching '#pragma clang attribute NotMyNamespace.push'}} #pragma clang attribute MyOtherNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}} -int some_other_func(); // expected-note 2 {{when applied to this declaration}} +int some_other_func(void); // expected-note 2 {{when applied to this declaration}} // Out of order! #pragma clang attribute MyNamespace.pop -int some_other_other_func(); // expected-note 1 {{when applied to this declaration}} +int some_other_other_func(void); // expected-note 1 {{when applied to this declaration}} #pragma clang attribute MyOtherNamespace.pop @@ -31,11 +31,11 @@ int some_other_other_func(); // expected-note 1 {{when applied to this declarati #pragma clang attribute Merp.push (__attribute__((annotate)), apply_to=function) // expected-error{{'annotate' attribute}} #pragma clang attribute push (__attribute__((annotate)), apply_to=function) // expected-warning {{unused attribute}} #pragma clang attribute pop // expected-note{{ends here}} -int test(); // expected-note{{when applied to this declaration}} +int test(void); // expected-note{{when applied to this declaration}} #pragma clang attribute Merp.pop #pragma clang attribute push (__attribute__((annotate)), apply_to=function) // expected-warning {{unused attribute}} #pragma clang attribute Merp.push (__attribute__((annotate)), apply_to=function) // expected-error{{'annotate' attribute}} #pragma clang attribute pop // expected-note{{ends here}} -int test2(); // expected-note{{when applied to this declaration}} +int test2(void); // expected-note{{when applied to this declaration}} #pragma clang attribute Merp.pop diff --git a/clang/test/Sema/pragma-attribute.c b/clang/test/Sema/pragma-attribute.c index f9a851cdff921a..61a255a874b949 100644 --- a/clang/test/Sema/pragma-attribute.c +++ b/clang/test/Sema/pragma-attribute.c @@ -9,16 +9,16 @@ // Ensure we only report any errors once. #pragma clang attribute push (__attribute__((annotate)), apply_to = function) // expected-error 4 {{'annotate' attribute takes at least 1 argument}} -void test5_begin(); // expected-note {{when applied to this declaration}} -void test5_1(); // expected-note {{when applied to this declaration}} +void test5_begin(void); // expected-note {{when applied to this declaration}} +void test5_1(void); // expected-note {{when applied to this declaration}} #pragma clang attribute push (__attribute__((annotate())), apply_to = function) // expected-error 2 {{'annotate' attribute takes at least 1 argument}} -void test5_2(); // expected-note 2 {{when applied to this declaration}} +void test5_2(void); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute push (__attribute__((annotate("hello", "world"))), apply_to = function) -void test5_3(); // expected-note 2 {{when applied to this declaration}} +void test5_3(void); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute pop #pragma clang attribute pop @@ -28,12 +28,12 @@ void test5_3(); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute push (__attribute__((optnone)), apply_to = function) // expected-note 2 {{conflicting attribute is here}} -__attribute__((always_inline)) void optnone1() { } // expected-warning {{'always_inline' attribute ignored}} +__attribute__((always_inline)) void optnone1(void) { } // expected-warning {{'always_inline' attribute ignored}} // expected-note@-1 {{when applied to this declaration}} -void optnone2() { } +void optnone2(void) { } -__attribute__((always_inline)) void optnone3() { } // expected-warning {{'always_inline' attribute ignored}} +__attribute__((always_inline)) void optnone3(void) { } // expected-warning {{'always_inline' attribute ignored}} // expected-note@-1 {{when applied to this declaration}} #pragma clang attribute pop @@ -41,7 +41,7 @@ __attribute__((always_inline)) void optnone3() { } // expected-warning {{'always #pragma clang attribute push (__attribute__((annotate())), apply_to = function) // expected-error{{'annotate' attribute takes at least 1 argument}} #pragma clang attribute (__attribute__((annotate())), apply_to = function) // expected-error{{'annotate' attribute takes at least 1 argument}} -void fun(); // expected-note 2 {{when applied to this declaration}} +void fun(void); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute pop #pragma clang attribute pop // expected-error{{'#pragma clang attribute pop' with no matching '#pragma clang attribute push'}} @@ -50,10 +50,10 @@ void fun(); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute push #pragma clang attribute (__attribute__((annotate())), apply_to = function) // expected-error 2 {{'annotate' attribute takes at least 1 argument}} -void fun2(); // expected-note {{when applied to this declaration}} +void fun2(void); // expected-note {{when applied to this declaration}} #pragma clang attribute push (__attribute__((annotate())), apply_to = function) // expected-error{{'annotate' attribute takes at least 1 argument}} -void fun3(); // expected-note 2 {{when applied to this declaration}} +void fun3(void); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute pop #pragma clang attribute pop @@ -67,4 +67,4 @@ void fun3(); // expected-note 2 {{when applied to this declaration}} #pragma clang attribute push (__attribute__((annotate("func"))), apply_to = function) // expected-error {{unterminated '#pragma clang attribute push' at end of file}} -void function(); +void function(void); diff --git a/clang/test/Sema/pragma-pack-2.c b/clang/test/Sema/pragma-pack-2.c index 3696a22d5aa521..e337953d362658 100644 --- a/clang/test/Sema/pragma-pack-2.c +++ b/clang/test/Sema/pragma-pack-2.c @@ -47,7 +47,7 @@ struct s4_1 { extern int a4_0[offsetof(struct s4_0, f1) == 1 ? 1 : -1]; extern int a4_1[offsetof(struct s4_1, f1) == 4 ? 1 : -1]; -void f() { +void f(void) { #pragma pack(push, 2) struct s5_0 { char f0; diff --git a/clang/test/Sema/pragma-unused.c b/clang/test/Sema/pragma-unused.c index aafac0de206d20..58c2858f623898 100644 --- a/clang/test/Sema/pragma-unused.c +++ b/clang/test/Sema/pragma-unused.c @@ -31,7 +31,7 @@ void f6(void) { } } -void f7() { +void f7(void) { int y; #pragma unused(undeclared, undefined, y) // expected-warning{{undeclared variable 'undeclared' used as an argument for '#pragma unused'}} expected-warning{{undeclared variable 'undefined' used as an argument for '#pragma unused'}} } diff --git a/clang/test/Sema/predef.c b/clang/test/Sema/predef.c index 49776b0ca8f99d..97a6f82242b87a 100644 --- a/clang/test/Sema/predef.c +++ b/clang/test/Sema/predef.c @@ -8,7 +8,7 @@ void abcdefghi12(void) { char *X = __func__; // expected-warning {{predefined identifier is only valid}} \ expected-warning {{initializing 'char *' with an expression of type 'const char[1]' discards qualifiers}} -void a() { +void a(void) { __func__[0] = 'a'; // expected-error {{variable is not assignable}} } diff --git a/clang/test/Sema/private-extern.c b/clang/test/Sema/private-extern.c index 0c13c92bba7749..8c7fd18f36fd8d 100644 --- a/clang/test/Sema/private-extern.c +++ b/clang/test/Sema/private-extern.c @@ -19,56 +19,56 @@ static int g4; // expected-error{{static declaration of 'g4' follows non-static __private_extern__ int g5; // expected-note{{previous declaration}} static int g5; // expected-error{{static declaration of 'g5' follows non-static declaration}} -void f0() { +void f0(void) { int g6; // expected-note {{previous}} extern int g6; // expected-error {{extern declaration of 'g6' follows non-extern declaration}} } -void f1() { +void f1(void) { int g7; // expected-note {{previous}} __private_extern__ int g7; // expected-error {{extern declaration of 'g7' follows non-extern declaration}} } -void f2() { +void f2(void) { extern int g8; // expected-note{{previous declaration}} int g8; // expected-error {{non-extern declaration of 'g8' follows extern declaration}} } -void f3() { +void f3(void) { __private_extern__ int g9; // expected-note{{previous declaration}} int g9; // expected-error {{non-extern declaration of 'g9' follows extern declaration}} } -void f4() { +void f4(void) { extern int g10; extern int g10; } -void f5() { +void f5(void) { __private_extern__ int g11; __private_extern__ int g11; } -void f6() { +void f6(void) { // FIXME: Diagnose extern int g12; __private_extern__ int g12; } -void f7() { +void f7(void) { // FIXME: Diagnose __private_extern__ int g13; extern int g13; } struct s0; -void f8() { +void f8(void) { extern struct s0 g14; __private_extern__ struct s0 g14; } struct s0 { int x; }; -void f9() { +void f9(void) { extern int g15 = 0; // expected-error{{'extern' variable cannot have an initializer}} // FIXME: linkage specifier in warning. __private_extern__ int g16 = 0; // expected-error{{'extern' variable cannot have an initializer}} diff --git a/clang/test/Sema/recover-goto.c b/clang/test/Sema/recover-goto.c index 0e8f6d3da4c889..d79d20c1f2a394 100644 --- a/clang/test/Sema/recover-goto.c +++ b/clang/test/Sema/recover-goto.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only %s -verify -void a() { // expected-note {{to match this '{'}} +void a(void) { // expected-note {{to match this '{'}} goto A; // expected-error {{use of undeclared label}} // expected-error {{expected '}'}} diff --git a/clang/test/Sema/redefine_extname.c b/clang/test/Sema/redefine_extname.c index b6984c16b08600..8ccac7ffcd4137 100644 --- a/clang/test/Sema/redefine_extname.c +++ b/clang/test/Sema/redefine_extname.c @@ -3,6 +3,6 @@ // Check that pragma redefine_extname applies to external declarations only. #pragma redefine_extname foo_static bar_static -static int foo_static() { return 1; } // expected-warning {{#pragma redefine_extname is applicable to external C declarations only; not applied to function 'foo_static'}} +static int foo_static(void) { return 1; } // expected-warning {{#pragma redefine_extname is applicable to external C declarations only; not applied to function 'foo_static'}} unsigned __int128_t; // expected-error {{redefinition of '__int128_t' as different kind of symbol}} diff --git a/clang/test/Sema/redefinition-same-header.c b/clang/test/Sema/redefinition-same-header.c index be5bd1d71c9264..b2e3730d9c0baa 100644 --- a/clang/test/Sema/redefinition-same-header.c +++ b/clang/test/Sema/redefinition-same-header.c @@ -11,4 +11,4 @@ #include "a.h" #include "a.h" -int foo() { return yyy; } +int foo(void) { return yyy; } diff --git a/clang/test/Sema/renderscript.rs b/clang/test/Sema/renderscript.rs index 80be5ae424f8cc..79b50e981411c4 100644 --- a/clang/test/Sema/renderscript.rs +++ b/clang/test/Sema/renderscript.rs @@ -4,7 +4,7 @@ #ifndef __RENDERSCRIPT__ // expected-warning@+2 {{'kernel' attribute ignored}} #endif -void __attribute__((kernel)) kernel() {} +void __attribute__((kernel)) kernel(void) {} #ifndef __RENDERSCRIPT__ // expected-warning@+4 {{'kernel' attribute ignored}} @@ -16,7 +16,7 @@ int __attribute__((kernel)) global; #ifndef __RENDERSCRIPT__ // expected-error@+2 {{function return value cannot have __fp16 type; did you forget * ?}} #endif -__fp16 fp16_return(); +__fp16 fp16_return(void); #ifndef __RENDERSCRIPT__ // expected-error@+2 {{parameters cannot have __fp16 type; did you forget * ?}} diff --git a/clang/test/Sema/reserved-identifier.c b/clang/test/Sema/reserved-identifier.c index 9296e7125e2c80..fa12a1575a8643 100644 --- a/clang/test/Sema/reserved-identifier.c +++ b/clang/test/Sema/reserved-identifier.c @@ -4,16 +4,16 @@ __I_AM_A_SYSTEM_MACRO() // no-warning -void test_system_macro_expansion() { +void test_system_macro_expansion(void) { SOME_SYSTEM_MACRO(); // no-warning } #define __oof foo__ // expected-warning {{macro name is a reserved identifier}} -int foo__bar() { return 0; } // no-warning -static int _bar() { return 0; } // expected-warning {{identifier '_bar' is reserved because it starts with '_' at global scope}} -static int _Bar() { return 0; } // expected-warning {{identifier '_Bar' is reserved because it starts with '_' followed by a capital letter}} -int _foo() { return 0; } // expected-warning {{identifier '_foo' is reserved because it starts with '_' at global scope}} +int foo__bar(void) { return 0; } // no-warning +static int _bar(void) { return 0; } // expected-warning {{identifier '_bar' is reserved because it starts with '_' at global scope}} +static int _Bar(void) { return 0; } // expected-warning {{identifier '_Bar' is reserved because it starts with '_' followed by a capital letter}} +int _foo(void) { return 0; } // expected-warning {{identifier '_foo' is reserved because it starts with '_' at global scope}} // This one is explicitly skipped by -Wreserved-identifier void *_; // no-warning @@ -49,7 +49,7 @@ typedef struct { int _field; // no-warning } _Typedef; // expected-warning {{identifier '_Typedef' is reserved because it starts with '_' followed by a capital letter}} -int foobar() { +int foobar(void) { return foo__bar(); // no-warning } @@ -69,7 +69,7 @@ extern char *_strdup(const char *); // expected-warning {{identifier '_strdup' i // Don't warn on redeclaration extern char *_strdup(const char *); // no-warning -void ok() { - void _ko(); // expected-warning {{identifier '_ko' is reserved because it starts with '_' at global scope}} +void ok(void) { + void _ko(void); // expected-warning {{identifier '_ko' is reserved because it starts with '_' at global scope}} extern int _ko_again; // expected-warning {{identifier '_ko_again' is reserved because it starts with '_' at global scope}} } diff --git a/clang/test/Sema/return-noreturn.c b/clang/test/Sema/return-noreturn.c index 2aa0b91115b895..62735ca073ea9f 100644 --- a/clang/test/Sema/return-noreturn.c +++ b/clang/test/Sema/return-noreturn.c @@ -1,25 +1,25 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -fblocks -Wmissing-noreturn -Wno-unreachable-code int j; -void test1() { // expected-warning {{function 'test1' could be declared with attribute 'noreturn'}} +void test1(void) { // expected-warning {{function 'test1' could be declared with attribute 'noreturn'}} ^ (void) { while (1) { } }(); ^ (void) { if (j) while (1) { } }(); while (1) { } } -void test2() { +void test2(void) { if (j) while (1) { } } __attribute__((__noreturn__)) -void test2_positive() { +void test2_positive(void) { if (j) while (1) { } } // expected-warning{{function declared 'noreturn' should not return}} // This test case illustrates that we don't warn about the missing return // because the function is marked noreturn and there is an infinite loop. -extern int foo_test_3(); +extern int foo_test_3(void); __attribute__((__noreturn__)) void* test3(int arg) { while (1) foo_test_3(); } @@ -32,17 +32,17 @@ __attribute__((__noreturn__)) void* test3_positive(int arg) { // PR5298 - -Wmissing-noreturn shouldn't warn if the function is already // declared noreturn. void __attribute__((noreturn)) -test4() { +test4(void) { test2_positive(); } // Do not warn here. -_Noreturn void test5() { +_Noreturn void test5(void) { test2_positive(); } // rdar://16274746 -void test6() +void test6(void) { (void)^{ for(;;) diff --git a/clang/test/Sema/return-silent.c b/clang/test/Sema/return-silent.c index 83c3a0a1790571..720128d7ea60b2 100644 --- a/clang/test/Sema/return-silent.c +++ b/clang/test/Sema/return-silent.c @@ -1,10 +1,10 @@ // RUN: %clang_cc1 %s -Wno-return-type -fsyntax-only -verify // expected-no-diagnostics -int t14() { +int t14(void) { return; } -void t15() { +void t15(void) { return 1; } diff --git a/clang/test/Sema/riscv-interrupt-attr.c b/clang/test/Sema/riscv-interrupt-attr.c index 55f0863c1f533f..2f5f2a44c778d2 100644 --- a/clang/test/Sema/riscv-interrupt-attr.c +++ b/clang/test/Sema/riscv-interrupt-attr.c @@ -36,8 +36,8 @@ __attribute__((interrupt("user", 1))) void foo2(void) {} // expected-error {{'in __attribute__((interrupt)) int foo3(void) {return 0;} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have a 'void' return type}} -__attribute__((interrupt())) void foo4(); -__attribute__((interrupt())) void foo4() {}; +__attribute__((interrupt())) void foo4(void); +__attribute__((interrupt())) void foo4(void) {} __attribute__((interrupt())) void foo5(int a) {} // expected-warning {{RISC-V 'interrupt' attribute only applies to functions that have no parameters}} diff --git a/clang/test/Sema/riscv-types.c b/clang/test/Sema/riscv-types.c index 1be20688cc7d53..e9bd47141f08ea 100644 --- a/clang/test/Sema/riscv-types.c +++ b/clang/test/Sema/riscv-types.c @@ -136,8 +136,8 @@ void bar(void) { } typedef __rvv_bool4_t vbool4_t; -__rvv_bool4_t get_rvv_bool4(); -vbool4_t get_vbool4_t(); +__rvv_bool4_t get_rvv_bool4(void); +vbool4_t get_vbool4_t(void); void func1(int sel) { // CHECK: vbool4_t t0 = sel ? get_rvv_bool4() : get_vbool4_t(); diff --git a/clang/test/Sema/rounding-math.c b/clang/test/Sema/rounding-math.c index 89951b1726db1b..cd1498af4a7824 100644 --- a/clang/test/Sema/rounding-math.c +++ b/clang/test/Sema/rounding-math.c @@ -24,7 +24,7 @@ void bitfield(struct Bitfield *b) { b->n = (int)(6 * (1.0 / 3.0)); // norounding-warning {{changes value from 2 to 0}} } -void vlas() { +void vlas(void) { // This is always a VLA due to its syntactic form. typedef int vla1[(int)(-3 * (1.0 / 3.0))]; struct X1 { vla1 v; }; // expected-error {{fields must have a constant size}} diff --git a/clang/test/Sema/scope-check.c b/clang/test/Sema/scope-check.c index fa37d10d070b91..cc088ab3424a98 100644 --- a/clang/test/Sema/scope-check.c +++ b/clang/test/Sema/scope-check.c @@ -17,7 +17,7 @@ int test2(int x) { void test3clean(int*); -int test3() { +int test3(void) { goto L; // expected-error{{cannot jump from this goto statement to its label}} int a __attribute((cleanup(test3clean))); // expected-note {{jump bypasses initialization of variable with __attribute__((cleanup))}} L: @@ -41,7 +41,7 @@ int test5(int x) { return sizeof a; } -int test6() { +int test6(void) { // just plain invalid. goto x; // expected-error {{use of undeclared label 'x'}} } diff --git a/clang/test/Sema/self-comparison.c b/clang/test/Sema/self-comparison.c index 4c848f030e133c..036d2603329b08 100644 --- a/clang/test/Sema/self-comparison.c +++ b/clang/test/Sema/self-comparison.c @@ -36,7 +36,7 @@ int bar2(float x) { #define IS_THE_ANSWER(x) (x == 42) -int macro_comparison() { +int macro_comparison(void) { return IS_THE_ANSWER(42); } @@ -45,7 +45,7 @@ int compare_sizeof(int x) { return sizeof(x == x); // no-warning } -int array_comparisons() { +int array_comparisons(void) { int array1[2]; int array2[2]; @@ -88,6 +88,6 @@ int R8435950(int i) { __attribute__((weak)) int weak_1[3]; __attribute__((weak)) int weak_2[3]; -_Bool compare_weak() { +_Bool compare_weak(void) { return weak_1 == weak_2; }