[clang] 22db482 - Use functions with prototypes when appropriate; NFC
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 7 06:25:11 PST 2022
Author: Aaron Ballman
Date: 2022-02-07T09:25:01-05:00
New Revision: 22db4824b9e03fe8c2e9217d6832b71ac23c175f
URL: https://github.com/llvm/llvm-project/commit/22db4824b9e03fe8c2e9217d6832b71ac23c175f
DIFF: https://github.com/llvm/llvm-project/commit/22db4824b9e03fe8c2e9217d6832b71ac23c175f.diff
LOG: Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,
void func();
becomes
void func(void);
This is the third batch of tests being updated (there are a significant
number of other tests left to be updated).
Added:
Modified:
clang/test/Sema/Inputs/warn-unreachable.h
clang/test/Sema/shift.c
clang/test/Sema/source_location.c
clang/test/Sema/statements.c
clang/test/Sema/stmtexprs.c
clang/test/Sema/string-init.c
clang/test/Sema/struct-cast.c
clang/test/Sema/struct-compat.c
clang/test/Sema/struct-decl.c
clang/test/Sema/suppress-deprecated.c
clang/test/Sema/switch.c
clang/test/Sema/tautological-constant-compare.c
clang/test/Sema/tautological-constant-enum-compare.c
clang/test/Sema/tautological-objc-bool-compare.m
clang/test/Sema/tautological-unsigned-enum-zero-compare.c
clang/test/Sema/tautological-unsigned-zero-compare.c
clang/test/Sema/tentative-decls.c
clang/test/Sema/thread-specifier.c
clang/test/Sema/transparent-union-pointer.c
clang/test/Sema/transpose-memset.c
clang/test/Sema/typedef-retain.c
clang/test/Sema/typeof-use-deprecated.c
clang/test/Sema/types.c
clang/test/Sema/typo-correction-ambiguity.c
clang/test/Sema/typo-correction-no-hang.c
clang/test/Sema/typo-correction.c
clang/test/Sema/ucn-identifiers.c
clang/test/Sema/unbounded-array-bounds.c
clang/test/Sema/uninit-variables.c
clang/test/Sema/unused-expr.c
clang/test/Sema/va_arg_x86_32.c
clang/test/Sema/var-redecl.c
clang/test/Sema/variadic-incomplete-arg-type.c
clang/test/Sema/vecshift.c
clang/test/Sema/vector-assign.c
clang/test/Sema/vector-cast.c
clang/test/Sema/vector-init.c
clang/test/Sema/vector_swizzle_length.c
clang/test/Sema/vla.c
clang/test/Sema/void_arg.c
clang/test/Sema/warn-absolute-value.c
clang/test/Sema/warn-binary-conditional-expression-unused.c
clang/test/Sema/warn-cast-align.c
clang/test/Sema/warn-cast-qual.c
clang/test/Sema/warn-char-subscripts.c
clang/test/Sema/warn-documentation-fixits.c
clang/test/Sema/warn-documentation.m
clang/test/Sema/warn-extern-main.c
clang/test/Sema/warn-fortify-scanf.c
clang/test/Sema/warn-fortify-source.c
clang/test/Sema/warn-free-nonheap-object.c
clang/test/Sema/warn-logical-not-compare.c
clang/test/Sema/warn-main-return-type.c
clang/test/Sema/warn-main.c
clang/test/Sema/warn-null.c
clang/test/Sema/warn-outof-range-assign-enum.c
clang/test/Sema/warn-overlap.c
clang/test/Sema/warn-shadow-intrinsics.c
clang/test/Sema/warn-shadow.c
clang/test/Sema/warn-string-conversion.c
clang/test/Sema/warn-strlcpycat-size.c
clang/test/Sema/warn-strncat-size.c
clang/test/Sema/warn-tautological-compare.c
clang/test/Sema/warn-thread-safety-analysis.c
clang/test/Sema/warn-type-safety.c
clang/test/Sema/warn-unreachable-ms.c
clang/test/Sema/warn-unreachable.c
clang/test/Sema/warn-unreachable.m
clang/test/Sema/warn-unsequenced.c
clang/test/Sema/warn-unused-but-set-variables.c
clang/test/Sema/warn-unused-function.c
clang/test/Sema/warn-unused-label.c
clang/test/Sema/warn-unused-parameters.c
clang/test/Sema/warn-unused-value.c
clang/test/Sema/warn-unused-variables-werror.c
clang/test/Sema/warn-unused-variables.c
clang/test/Sema/warn-variable-not-needed.c
clang/test/Sema/wchar.c
clang/test/Sema/x86-attr-force-align-arg-pointer.c
clang/test/Sema/xray-always-instrument-attr.c
clang/test/Sema/xray-log-args-oob.c
clang/test/SemaCUDA/attr-declspec.cu
clang/test/SemaCUDA/attributes-on-non-cuda.cu
clang/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
clang/test/SemaCXX/attr-require-constant-initialization.cpp
clang/test/SemaCXX/size_t-literal.cpp
clang/test/SemaCXX/types_compatible_p.cpp
clang/test/SemaCXX/warn-comma-operator.cpp
clang/test/SemaObjC/alias-test-1.m
clang/test/SemaObjC/arc-bridged-cast.m
clang/test/SemaObjC/arc-cf.m
clang/test/SemaObjC/arc-decls.m
clang/test/SemaObjC/arc-dict-bridged-cast.m
clang/test/SemaObjC/arc-objc-lifetime.m
clang/test/SemaObjC/arc-system-header.m
clang/test/SemaObjC/arc-type-conversion.m
clang/test/SemaObjC/arc-unavailable-for-weakref.m
clang/test/SemaObjC/arc-unavailable-system-function.m
clang/test/SemaObjC/arc.m
clang/test/SemaObjC/argument-checking.m
clang/test/SemaObjC/attr-availability-priority.m
clang/test/SemaObjC/attr-availability.m
clang/test/SemaObjC/attr-cf_returns.m
clang/test/SemaObjC/attr-cleanup.m
clang/test/SemaObjC/attr-deprecated.m
clang/test/SemaObjC/attr-malloc.m
clang/test/SemaObjC/attr-ns_returns_retained.m
clang/test/SemaObjC/attr-objc-exception.m
clang/test/SemaObjC/attr-objc-non-lazy.m
clang/test/SemaObjC/attr-root-class.m
clang/test/SemaObjC/attr-swift-async-error.m
clang/test/SemaObjC/attr-swift-async.m
clang/test/SemaObjC/autoreleasepool.m
clang/test/SemaObjC/bad-receiver-1.m
clang/test/SemaObjC/block-capture-unused-variable.m
clang/test/SemaObjC/block-explicit-return-type.m
clang/test/SemaObjC/block-id-as-block-argtype.m
clang/test/SemaObjC/block-omitted-return-type.m
clang/test/SemaObjC/block-return.m
clang/test/SemaObjC/block-type-safety.m
clang/test/SemaObjC/boxing-illegal.m
clang/test/SemaObjC/builtin_objc_lib_functions.m
clang/test/SemaObjC/call-unavailable-init-in-self.m
clang/test/SemaOpenCL/array-init.cl
clang/test/SemaOpenCL/block-array-capturing.cl
clang/test/SemaOpenCL/invalid-block.cl
clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
clang/test/SemaOpenCL/nosvm.cl
clang/test/SemaOpenCL/null_queue.cl
Removed:
################################################################################
diff --git a/clang/test/Sema/Inputs/warn-unreachable.h b/clang/test/Sema/Inputs/warn-unreachable.h
index 394242f90829..d39be8fdd413 100644
--- a/clang/test/Sema/Inputs/warn-unreachable.h
+++ b/clang/test/Sema/Inputs/warn-unreachable.h
@@ -1,7 +1,7 @@
// Test that this unreachable code warning is
// not reported because it is in a header.
-void foo_unreachable_header() {
+void foo_unreachable_header(void) {
return;
foo_unreachable_header(); // no-warning
}
\ No newline at end of file
diff --git a/clang/test/Sema/shift.c b/clang/test/Sema/shift.c
index 34487e1156ac..1ebccb1d0b3a 100644
--- a/clang/test/Sema/shift.c
+++ b/clang/test/Sema/shift.c
@@ -10,7 +10,7 @@ enum {
Z = 1 << 2
};
-void test() {
+void test(void) {
char c;
c = 0 << 0;
@@ -61,7 +61,7 @@ void test() {
enum { b = (a << ashift) };
// Don't warn for negative shifts in code that is unreachable.
-void test_pr5544() {
+void test_pr5544(void) {
(void) (((1) > 63 && (1) < 128 ? (((unsigned long long) 1)<<((1)-64)) : (unsigned long long) 0)); // no-warning
}
diff --git a/clang/test/Sema/source_location.c b/clang/test/Sema/source_location.c
index d7f31540d582..94c09c7952dc 100644
--- a/clang/test/Sema/source_location.c
+++ b/clang/test/Sema/source_location.c
@@ -26,7 +26,7 @@ _Static_assert(IsEqual(__builtin_FILE(), "my_file.c"), "");
_Static_assert(__builtin_COLUMN() == __builtin_strlen("_Static_assert(_"), "");
-void foo() {
+void foo(void) {
_Static_assert(IsEqual(__builtin_FUNCTION(), "foo"), "");
}
#endif // CONST_STRINGS
diff --git a/clang/test/Sema/statements.c b/clang/test/Sema/statements.c
index b410383673e8..2a723421c47c 100644
--- a/clang/test/Sema/statements.c
+++ b/clang/test/Sema/statements.c
@@ -12,13 +12,13 @@ int test(int _x) {
}
// PR2374
-int test2() { return ({L:5;}); }
-int test3() { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
+int test2(void) { return ({L:5;}); }
+int test3(void) { return ({ {5;} }); } // expected-error {{returning 'void' from a function with incompatible result type 'int'}}\
// expected-warning {{expression result unused}}
-int test4() { return ({ ({5;}); }); }
-int test5() { return ({L1: L2: L3: 5;}); }
-int test6() { return ({5;}); }
-void test7() { ({5;}); } // expected-warning {{expression result unused}}
+int test4(void) { return ({ ({5;}); }); }
+int test5(void) { return ({L1: L2: L3: 5;}); }
+int test6(void) { return ({5;}); }
+void test7(void) { ({5;}); } // expected-warning {{expression result unused}}
// PR3062
int test8[({10;})]; // expected-error {{statement expression not allowed at file scope}}
@@ -29,14 +29,14 @@ void test9(const void *P) {
}
-void *test10() {
+void *test10(void) {
bar:
return &&bar; // expected-warning {{returning address of label, which is local}}
}
// PR38569: Don't warn when returning a label from a statement expression.
void test10_logpc(void*);
-void test10a() {
+void test10a(void) {
test10_logpc(({
my_pc:
&&my_pc;
@@ -99,7 +99,7 @@ void foo(enum x X) {
}
}
-int test_pr8880() {
+int test_pr8880(void) {
int first = 1;
for ( ; ({ if (first) { first = 0; continue; } 0; }); )
return 0;
@@ -108,7 +108,7 @@ int test_pr8880() {
// In PR22849, we considered __ptr to be a static data member of the anonymous
// union. Now we declare it in the parent DeclContext.
-void test_pr22849() {
+void test_pr22849(void) {
struct Bug {
typeof(({ unsigned long __ptr; (int *)(0); })) __val;
union Nested {
@@ -122,7 +122,7 @@ void test_pr22849() {
// GCC ignores empty statements at the end of compound expressions where the
// result type is concerned.
-void test13() {
+void test13(void) {
int a;
a = ({ 1; });
a = ({1;; });
@@ -130,10 +130,10 @@ void test13() {
a = ({int x = 1; (void)x;; }); // expected-error {{assigning to 'int' from incompatible type 'void'}}
}
-void test14() { return ({}); }
-void test15() {
+void test14(void) { return ({}); }
+void test15(void) {
return ({;;;; });
}
-void test16() {
+void test16(void) {
return ({test:;; });
}
diff --git a/clang/test/Sema/stmtexprs.c b/clang/test/Sema/stmtexprs.c
index 8594aae18688..708fc9abb75c 100644
--- a/clang/test/Sema/stmtexprs.c
+++ b/clang/test/Sema/stmtexprs.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -Wno-gnu-statement-expression
-int stmtexpr_fn();
+int stmtexpr_fn(void);
void stmtexprs(int i) {
__builtin_assume( ({ 1; }) ); // no warning about "side effects"
__builtin_assume( ({ if (i) { (void)0; }; 42; }) ); // no warning about "side effects"
diff --git a/clang/test/Sema/string-init.c b/clang/test/Sema/string-init.c
index 96ee360e4452..c8a6faccf466 100644
--- a/clang/test/Sema/string-init.c
+++ b/clang/test/Sema/string-init.c
@@ -5,7 +5,7 @@ typedef int wchar_t;
typedef unsigned short char16_t;
typedef unsigned int char32_t;
-void f() {
+void f(void) {
char a1[] = "a"; // No error.
char a2[] = u8"a"; // No error.
char a3[] = u"a"; // expected-error{{initializing char array with wide string literal}}
@@ -43,7 +43,7 @@ void f() {
long f5[] = L"a"; // expected-error{{array initializer must be an initializer list}}
}
-void g() {
+void g(void) {
char a[] = 1; // expected-error{{array initializer must be an initializer list or string literal}}
wchar_t b[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}}
char16_t c[] = 1; // expected-error{{array initializer must be an initializer list or wide string literal}}
diff --git a/clang/test/Sema/struct-cast.c b/clang/test/Sema/struct-cast.c
index 8aa7ca90dd13..74d00c42c295 100644
--- a/clang/test/Sema/struct-cast.c
+++ b/clang/test/Sema/struct-cast.c
@@ -11,6 +11,6 @@ struct S const foo(void);
struct S tmp;
-void priv_sock_init() {
+void priv_sock_init(void) {
tmp = (struct S)foo();
}
diff --git a/clang/test/Sema/struct-compat.c b/clang/test/Sema/struct-compat.c
index 68bb2cad45e1..3bc66b0b9d88 100644
--- a/clang/test/Sema/struct-compat.c
+++ b/clang/test/Sema/struct-compat.c
@@ -12,6 +12,6 @@ struct x {int a;} *c = b; // expected-warning {{incompatible pointer types}}
}
struct x {int a;} r;
-int b() {
+int b(void) {
struct x {char x;} s = r; // expected-error {{initializing 'struct x' with an expression of incompatible type 'struct x'}}
}
diff --git a/clang/test/Sema/struct-decl.c b/clang/test/Sema/struct-decl.c
index a119e59eab93..32674f3156ac 100644
--- a/clang/test/Sema/struct-decl.c
+++ b/clang/test/Sema/struct-decl.c
@@ -18,7 +18,7 @@ struct s {
struct st;
-int foo() {
+int foo(void) {
struct st *f;
return f->v + f[0].v;
}
@@ -60,8 +60,8 @@ inline struct test3 { // expected-error {{'inline' can only appear on functions}
struct hiding_1 {};
struct hiding_2 {};
-void test_hiding() {
- struct hiding_1 *hiding_1();
+void test_hiding(void) {
+ struct hiding_1 *hiding_1(void);
extern struct hiding_2 *hiding_2;
struct hiding_1 *p = hiding_1();
struct hiding_2 *q = hiding_2;
diff --git a/clang/test/Sema/suppress-deprecated.c b/clang/test/Sema/suppress-deprecated.c
index db9ab3f4eeb6..5b764aff86c9 100644
--- a/clang/test/Sema/suppress-deprecated.c
+++ b/clang/test/Sema/suppress-deprecated.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
// expected-no-diagnostics
-extern void OldFunction() __attribute__((deprecated));
+extern void OldFunction(void) __attribute__((deprecated));
int main (int argc, const char * argv[]) {
OldFunction();
diff --git a/clang/test/Sema/switch.c b/clang/test/Sema/switch.c
index 3296447b6df1..604e418bf5d5 100644
--- a/clang/test/Sema/switch.c
+++ b/clang/test/Sema/switch.c
@@ -29,9 +29,9 @@ void test3(void) {
// expected-note{{put the semicolon on a separate line to silence this warning}}
}
-extern int g();
+extern int g(void);
-void test4()
+void test4(void)
{
int cond;
switch (cond) {
@@ -73,7 +73,7 @@ void test5(int z) {
}
}
-void test6() {
+void test6(void) {
char ch = 'a';
switch(ch) {
case 1234: // expected-warning {{overflow converting case value}}
@@ -92,7 +92,7 @@ int f0(int var) {
return 2;
}
-void test7() {
+void test7(void) {
enum {
A = 1,
B
@@ -139,7 +139,7 @@ void test7() {
}
-void test8() {
+void test8(void) {
enum {
A,
B,
@@ -161,7 +161,7 @@ void test8() {
}
}
-void test9() {
+void test9(void) {
enum {
A = 3,
C = 1
@@ -176,7 +176,7 @@ void test9() {
}
}
-void test10() {
+void test10(void) {
enum {
A = 10,
C = 2,
@@ -196,7 +196,7 @@ void test10() {
}
}
-void test11() {
+void test11(void) {
enum {
A = -1,
B,
@@ -218,7 +218,7 @@ void test11() {
}
}
-void test12() {
+void test12(void) {
enum {
A = -1,
B = 4294967286
@@ -268,7 +268,7 @@ void f1(unsigned x) {
}
}
-void test15() {
+void test15(void) {
int i = 0;
switch (1) { // expected-warning {{no case matching constant switch condition '1'}}
case 0: i = 0; break;
@@ -276,7 +276,7 @@ void test15() {
}
}
-void test16() {
+void test16(void) {
const char c = '5';
switch (c) { // expected-warning {{no case matching constant switch condition '53'}}
case '6': return;
@@ -305,7 +305,7 @@ void test17(int x) {
}
}
-int test18() {
+int test18(void) {
enum { A, B } a;
switch (a) {
case A: return 0;
diff --git a/clang/test/Sema/tautological-constant-compare.c b/clang/test/Sema/tautological-constant-compare.c
index d16ca5e5dd10..04b8a1416be0 100644
--- a/clang/test/Sema/tautological-constant-compare.c
+++ b/clang/test/Sema/tautological-constant-compare.c
@@ -43,7 +43,7 @@ void TFunc() {
}
#endif
-int main()
+int main(void)
{
#ifdef __cplusplus
TFunc<unsigned char>();
diff --git a/clang/test/Sema/tautological-constant-enum-compare.c b/clang/test/Sema/tautological-constant-enum-compare.c
index dcac24573809..5d6c37fff2db 100644
--- a/clang/test/Sema/tautological-constant-enum-compare.c
+++ b/clang/test/Sema/tautological-constant-enum-compare.c
@@ -5,7 +5,7 @@
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -Wtype-limits -verify %s
// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -DSILENCE -Wno-type-limits -verify %s
-int main() {
+int main(void) {
enum A { A_a = 2 };
enum A a;
@@ -248,7 +248,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/tautological-objc-bool-compare.m b/clang/test/Sema/tautological-objc-bool-compare.m
index 5fd7b9e1289a..811bce04feaa 100644
--- a/clang/test/Sema/tautological-objc-bool-compare.m
+++ b/clang/test/Sema/tautological-objc-bool-compare.m
@@ -6,7 +6,7 @@
BOOL B;
-void test() {
+void test(void) {
int r;
r = B > 0;
r = B > 1; // expected-warning {{result of comparison of constant 1 with expression of type 'BOOL' is always false, as the only well defined values for 'BOOL' are YES and NO}}
diff --git a/clang/test/Sema/tautological-unsigned-enum-zero-compare.c b/clang/test/Sema/tautological-unsigned-enum-zero-compare.c
index 87a56aa40bc3..a5b9addba49a 100644
--- a/clang/test/Sema/tautological-unsigned-enum-zero-compare.c
+++ b/clang/test/Sema/tautological-unsigned-enum-zero-compare.c
@@ -11,7 +11,7 @@
// Then default enum sigdness is target-specific.
// On windows, it is signed by default. We do not want to warn in that case.
-int main() {
+int main(void) {
enum A { A_a = 0 };
enum A a;
enum B { B_a = -1 };
diff --git a/clang/test/Sema/tautological-unsigned-zero-compare.c b/clang/test/Sema/tautological-unsigned-zero-compare.c
index 4c9394e213c4..e24ec94bf6e3 100644
--- a/clang/test/Sema/tautological-unsigned-zero-compare.c
+++ b/clang/test/Sema/tautological-unsigned-zero-compare.c
@@ -31,7 +31,7 @@ void TFunc() {
}
#endif
-int main()
+int main(void)
{
#ifdef __cplusplus
TFunc<unsigned char>();
diff --git a/clang/test/Sema/tentative-decls.c b/clang/test/Sema/tentative-decls.c
index 602624229d73..a1e033eb7811 100644
--- a/clang/test/Sema/tentative-decls.c
+++ b/clang/test/Sema/tentative-decls.c
@@ -48,7 +48,7 @@ int redef[10];
int redef[]; // expected-note {{previous definition is here}}
int redef[11]; // expected-error{{redefinition of 'redef'}}
-void func() {
+void func(void) {
extern int i6; // expected-note {{previous declaration is here}}
static int i6; // expected-error{{static declaration of 'i6' follows non-static declaration}}
}
diff --git a/clang/test/Sema/thread-specifier.c b/clang/test/Sema/thread-specifier.c
index a4f31bd79f03..af6dcd9cb8d9 100644
--- a/clang/test/Sema/thread-specifier.c
+++ b/clang/test/Sema/thread-specifier.c
@@ -28,7 +28,7 @@ struct t5 { __thread int x; }; // thread-local-warning {{'_Thread_local' is a C1
// expected-error at -5 {{type name does not allow storage class to be specified}}
#endif
-__thread int t6(); // thread-local-warning {{'_Thread_local' is a C11 extension}}
+__thread int t6(void); // thread-local-warning {{'_Thread_local' is a C11 extension}}
#if defined(GNU)
// expected-error at -2 {{'__thread' is only allowed on variable declarations}}
#elif defined(C11) || defined(C99)
@@ -89,14 +89,14 @@ int *thread_int_ptr = &thread_int;
#ifndef __cplusplus
// expected-error at -2 {{initializer element is not a compile-time constant}}
#endif
-void g() {
+void g(void) {
int *p = &thread_int; // This is perfectly fine, though.
}
#if __cplusplus >= 201103L
constexpr int *thread_int_ptr_2 = &thread_int; // expected-error {{must be initialized by a constant expression}}
#endif
-int non_const();
+int non_const(void);
__thread int non_const_init = non_const(); // thread-local-warning {{'_Thread_local' is a C11 extension}}
#if !defined(__cplusplus)
// expected-error at -2 {{initializer element is not a compile-time constant}}
diff --git a/clang/test/Sema/transparent-union-pointer.c b/clang/test/Sema/transparent-union-pointer.c
index bf1fb17ac6f8..3f92ace4796c 100644
--- a/clang/test/Sema/transparent-union-pointer.c
+++ b/clang/test/Sema/transparent-union-pointer.c
@@ -8,7 +8,7 @@ typedef union {
extern int wait (__WAIT_STATUS __stat_loc);
-void fastcgi_cleanup() {
+void fastcgi_cleanup(void) {
int status = 0;
wait(&status);
}
diff --git a/clang/test/Sema/transpose-memset.c b/clang/test/Sema/transpose-memset.c
index daad3f02c130..2503fe43458c 100644
--- a/clang/test/Sema/transpose-memset.c
+++ b/clang/test/Sema/transpose-memset.c
@@ -8,7 +8,7 @@
int array[10];
int *ptr;
-int main() {
+int main(void) {
memset(array, sizeof(array), 0); // expected-warning{{'size' argument to memset is '0'; did you mean to transpose the last two arguments?}} expected-note{{parenthesize the third argument to silence}}
memset(array, sizeof(array), 0xff); // expected-warning{{setting buffer to a 'sizeof' expression; did you mean to transpose the last two arguments?}} expected-note{{cast the second argument to 'int' to silence}} expected-warning{{'memset' will always overflow; destination buffer has size 40, but size argument is 255}}
memset(ptr, sizeof(ptr), 0); // expected-warning{{'size' argument to memset is '0'; did you mean to transpose the last two arguments?}} expected-note{{parenthesize the third argument to silence}}
@@ -28,7 +28,7 @@ int main() {
real_bzero(ptr, 0); // expected-warning{{'size' argument to bzero is '0'}} expected-note{{parenthesize the second argument to silence}}
}
-void macros() {
+void macros(void) {
#define ZERO 0
int array[10];
memset(array, 0xff, ZERO); // no warning
diff --git a/clang/test/Sema/typedef-retain.c b/clang/test/Sema/typedef-retain.c
index cbec109456a7..2d94a8f665fe 100644
--- a/clang/test/Sema/typedef-retain.c
+++ b/clang/test/Sema/typedef-retain.c
@@ -14,7 +14,7 @@ void test2(float4 a, int4p result, int i) {
// PR2039
typedef int a[5];
-void test3() {
+void test3(void) {
typedef const a b;
b r; // expected-note {{variable 'r' declared const here}}
r[0] = 10; // expected-error {{cannot assign to variable 'r' with const-qualified type 'b' (aka 'const int[5]')}}
diff --git a/clang/test/Sema/typeof-use-deprecated.c b/clang/test/Sema/typeof-use-deprecated.c
index ba72b126d7c7..848a6d2852ad 100644
--- a/clang/test/Sema/typeof-use-deprecated.c
+++ b/clang/test/Sema/typeof-use-deprecated.c
@@ -16,11 +16,11 @@ struct foo { int x; } __attribute__((deprecated)); // expected-note {{'foo' has
typedef struct foo bar __attribute__((deprecated)); // expected-note {{'bar' has been explicitly marked deprecated here}}
bar x1; // expected-warning {{'bar' is deprecated}}
-int main() { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
+int main(void) { typeof(x1) y; } // expected-warning {{'foo' is deprecated}}
struct gorf { int x; };
typedef struct gorf T __attribute__((deprecated)); // expected-note {{'T' has been explicitly marked deprecated here}}
T t; // expected-warning {{'T' is deprecated}}
-void wee() { typeof(t) y; }
+void wee(void) { typeof(t) y; }
diff --git a/clang/test/Sema/types.c b/clang/test/Sema/types.c
index 941b002890bb..1eee9b491665 100644
--- a/clang/test/Sema/types.c
+++ b/clang/test/Sema/types.c
@@ -15,17 +15,17 @@ restrict S y; // expected-error {{restrict requires a pointer or reference ('S'
// int128_t is available.
-int a() {
+int a(void) {
__int128_t s;
__uint128_t t;
}
// but not a keyword
-int b() {
+int b(void) {
int __int128_t;
int __uint128_t;
}
// __int128 is a keyword
-int c() {
+int c(void) {
__int128 i;
unsigned __int128 j;
long unsigned __int128 k; // expected-error {{'long __int128' is invalid}}
@@ -88,7 +88,7 @@ int x4 __attribute__((ext_vector_type(64))); // expected-error {{'ext_vector_ty
// rdar://16492792
typedef __attribute__ ((ext_vector_type(32),__aligned__(32))) unsigned char uchar32;
-void convert() {
+void convert(void) {
uchar32 r = 0;
r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}}
}
diff --git a/clang/test/Sema/typo-correction-ambiguity.c b/clang/test/Sema/typo-correction-ambiguity.c
index c25fe652bd9f..0fc18137710d 100644
--- a/clang/test/Sema/typo-correction-ambiguity.c
+++ b/clang/test/Sema/typo-correction-ambiguity.c
@@ -7,7 +7,7 @@ int v_63;
void v_2_0(int v_452, int v_454) {}
-int v_3_0() {
+int v_3_0(void) {
for (int v_345 = 0 ; v_63;)
v_2_0(v_195, // expected-error {{use of undeclared identifier 'v_195'}}
v_231); // expected-error {{use of undeclared identifier 'v_231'}}
@@ -24,4 +24,4 @@ int g_109;
struct a g_999;
struct a g_998;
-void PR50797() { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'}}
+void PR50797(void) { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'}}
diff --git a/clang/test/Sema/typo-correction-no-hang.c b/clang/test/Sema/typo-correction-no-hang.c
index f3d3bf00abe8..e6041704ff32 100644
--- a/clang/test/Sema/typo-correction-no-hang.c
+++ b/clang/test/Sema/typo-correction-no-hang.c
@@ -11,7 +11,7 @@ int g_109;
struct a g_999; // expected-note 4{{'g_999' declared here}}
-void b() { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}}
+void b(void) { (g_910.xxx = g_910.xxx); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}}
-void c() { (g_910.xxx = g_910.xxx1); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}} \
- expected-error {{no member named 'xxx1' in 'struct a'; did you mean 'xxx'}}
+void c(void) { (g_910.xxx = g_910.xxx1); } //expected-error 2{{use of undeclared identifier 'g_910'; did you mean 'g_999'}} \
+ expected-error {{no member named 'xxx1' in 'struct a'; did you mean 'xxx'}}
diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c
index f70eb8b5cf15..3924744a8cb3 100644
--- a/clang/test/Sema/typo-correction.c
+++ b/clang/test/Sema/typo-correction.c
@@ -5,7 +5,7 @@
__typeof__(struct F*) var[invalid]; // expected-error-re {{use of undeclared identifier 'invalid'{{$}}}}
-void PR21656() {
+void PR21656(void) {
float x;
x = (float)arst; // expected-error-re {{use of undeclared identifier 'arst'{{$}}}}
}
@@ -46,19 +46,19 @@ void f(long *a, long b) {
}
extern double cabs(_Complex double z);
-void fn1() {
+void fn1(void) {
cabs(errij); // expected-error {{use of undeclared identifier 'errij'}}
}
extern long afunction(int);
-void fn2() {
+void fn2(void) {
f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier 'THIS_IS_AN_ERROR'}}
afunction(afunction_)); // expected-error {{use of undeclared identifier 'afunction_'}}
}
int d = X ? d : L; // expected-error 2 {{use of undeclared identifier}}
-int fn_with_ids() { ID = ID == ID >= ID ; } // expected-error 4 {{use of undeclared identifier}}
+int fn_with_ids(void) { ID = ID == ID >= ID ; } // expected-error 4 {{use of undeclared identifier}}
int fn_with_rs(int r) { r = TYPO + r * TYPO; } // expected-error 2 {{use of undeclared identifier}}
@@ -76,7 +76,7 @@ int g(int x, int y) {
return x + y;
}
-int h() {
+int h(void) {
g(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
(x, 5 ? z : 0); // expected-error 2 {{use of undeclared identifier}}
}
@@ -94,7 +94,7 @@ struct rdar38642201 {
};
void rdar38642201_callee(int x, int y);
-void rdar38642201_caller() {
+void rdar38642201_caller(void) {
struct rdar38642201 structVar;
rdar38642201_callee(
structVar1.fieldName1.member1, //expected-error{{use of undeclared identifier 'structVar1'}}
diff --git a/clang/test/Sema/ucn-identifiers.c b/clang/test/Sema/ucn-identifiers.c
index ebf2dc0982b9..38106767f9ab 100644
--- a/clang/test/Sema/ucn-identifiers.c
+++ b/clang/test/Sema/ucn-identifiers.c
@@ -12,7 +12,7 @@ extern void \U000000FCber(int); // redeclaration, no warning
// expected-note at -4 + {{declared here}}
#endif
-void goodCalls() {
+void goodCalls(void) {
\u00FCber(0);
\u00fcber(1);
über(2);
@@ -20,7 +20,7 @@ void goodCalls() {
\u{FC}ber(4); // expected-warning {{Clang extension}}
}
-void badCalls() {
+void badCalls(void) {
\u00FCber(0.5); // expected-warning{{implicit conversion from 'double' to 'int'}}
\u00fcber = 0; // expected-error{{non-object type 'void (int)' is not assignable}}
diff --git a/clang/test/Sema/unbounded-array-bounds.c b/clang/test/Sema/unbounded-array-bounds.c
index 061dfdbd17f2..e7636c2a9249 100644
--- a/clang/test/Sema/unbounded-array-bounds.c
+++ b/clang/test/Sema/unbounded-array-bounds.c
@@ -11,7 +11,7 @@ struct S {
struct S s[]; // expected-warning {{tentative array definition}} expected-note {{declared here}} addr16-note {{declared here}}
-void f1() {
+void f1(void) {
++s[3].a;
++s[7073650413200313099].b;
// addr16-warning at -1 {{array index 7073650413200313099 refers past the last possible element for an array in 16-bit address space containing 160-bit (20-byte) elements (max possible 3276 elements)}}
@@ -23,7 +23,7 @@ void f1() {
long long ll[]; // expected-warning {{tentative array definition}} expected-note {{declared here}} addr16-note {{declared here}} addr32-note {{declared here}}
-void f2() {
+void f2(void) {
++ll[3];
++ll[2705843009213693952];
// addr16-warning at -1 {{array index 2705843009213693952 refers past the last possible element for an array in 16-bit address space containing 64-bit (8-byte) elements (max possible 8192 elements)}}
@@ -60,13 +60,13 @@ struct BQ {
struct BQ bq[]; // expected-warning {{tentative array definition}} addr16-note {{declared here}}
-void f5() {
+void f5(void) {
++bq[0].bigblock[0].a;
++bq[1].bigblock[0].a;
// addr16-warning at -1 {{array index 1 refers past the last possible element for an array in 16-bit address space containing 524160-bit (65520-byte) elements (max possible 1 element)}}
}
-void f6() {
+void f6(void) {
int ints[] = {1, 3, 5, 7, 8, 6, 4, 5, 9};
int const n_ints = sizeof(ints) / sizeof(int);
unsigned long long const N = 3;
@@ -76,7 +76,7 @@ void f6() {
*(middle + 5 - N) = 22;
}
-void pr50741() {
+void pr50741(void) {
(void *)0 + 0xdead000000000000UL;
// no array-bounds warning, and no crash
}
diff --git a/clang/test/Sema/uninit-variables.c b/clang/test/Sema/uninit-variables.c
index e2d98354932b..fa471499a437 100644
--- a/clang/test/Sema/uninit-variables.c
+++ b/clang/test/Sema/uninit-variables.c
@@ -4,35 +4,35 @@
typedef __typeof(sizeof(int)) size_t;
void *malloc(size_t);
-int test1() {
+int test1(void) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
-int test2() {
+int test2(void) {
int x = 0;
return x; // no-warning
}
-int test3() {
+int test3(void) {
int x;
x = 0;
return x; // no-warning
}
-int test4() {
+int test4(void) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
++x; // expected-warning{{variable 'x' is uninitialized when used here}}
return x;
}
-int test5() {
+int test5(void) {
int x, y; // expected-note{{initialize the variable 'y' to silence this warning}}
x = y; // expected-warning{{variable 'y' is uninitialized when used here}}
return x;
}
-int test6() {
+int test6(void) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
x += 2; // expected-warning{{variable 'x' is uninitialized when used here}}
return x;
@@ -95,22 +95,22 @@ void test12(unsigned n) {
for (unsigned i ; n ; ++i) ; // expected-warning{{variable 'i' is uninitialized when used here}} expected-note{{initialize the variable 'i' to silence this warning}}
}
-int test13() {
+int test13(void) {
static int i;
return i; // no-warning
}
// Simply don't crash on this test case.
-void test14() {
+void test14(void) {
const char *p = 0;
for (;;) {}
}
-void test15() {
+void test15(void) {
int x = x; // no-warning: signals intended lack of initialization.
}
-int test15b() {
+int test15b(void) {
// Warn here with the self-init, since it does result in a use of
// an uninitialized variable and this is the root cause.
int x = x; // expected-warning {{variable 'x' is uninitialized when used within its own initialization}}
@@ -118,14 +118,14 @@ int test15b() {
}
// Don't warn in the following example; shows dataflow confluence.
-char *test16_aux();
-void test16() {
+char *test16_aux(void);
+void test16(void) {
char *p = test16_aux();
for (unsigned i = 0 ; i < 100 ; i++)
p[i] = 'a'; // no-warning
}
-void test17() {
+void test17(void) {
// Don't warn multiple times about the same uninitialized variable
// along the same path.
int *x; // expected-note{{initialize the variable 'x' to silence this warning}}
@@ -141,17 +141,17 @@ int test18(int x, int y) {
return 0;
}
-int test19_aux1();
-int test19_aux2();
+int test19_aux1(void);
+int test19_aux2(void);
int test19_aux3(int *x);
-int test19() {
+int test19(void) {
int z;
if (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
return z; // no-warning
return 0;
}
-int test20() {
+int test20(void) {
int z; // expected-note{{initialize the variable 'z' to silence this warning}}
if ((test19_aux1() + test19_aux2() && test19_aux1()) || test19_aux3(&z)) // expected-warning {{variable 'z' is used uninitialized whenever '||' condition is true}} expected-note {{remove the '||' if its condition is always false}}
return z; // expected-note {{uninitialized use occurs here}}
@@ -165,14 +165,14 @@ int test21(int x, int y) {
return 0;
}
-int test22() {
+int test22(void) {
int z;
while (test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z))
return z; // no-warning
return 0;
}
-int test23() {
+int test23(void) {
int z;
for ( ; test19_aux1() + test19_aux2() && test19_aux1() && test19_aux3(&z) ; )
return z; // no-warning
@@ -192,54 +192,54 @@ int test24(int flag) {
return val; // expected-warning{{variable 'val' may be uninitialized when used here}}
}
-float test25() {
+float test25(void) {
float x; // expected-note{{initialize the variable 'x' to silence this warning}}
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
typedef int MyInt;
-MyInt test26() {
+MyInt test26(void) {
MyInt x; // expected-note{{initialize the variable 'x' to silence this warning}}
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
}
// Test handling of sizeof().
-int test27() {
+int test27(void) {
struct test_27 { int x; } *y;
return sizeof(y->x); // no-warning
}
-int test28() {
+int test28(void) {
int len; // expected-note{{initialize the variable 'len' to silence this warning}}
return sizeof(int[len]); // expected-warning{{variable 'len' is uninitialized when used here}}
}
-void test29() {
+void test29(void) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
(void) ^{ (void) x; }; // expected-warning{{variable 'x' is uninitialized when captured by block}}
}
-void test30() {
+void test30(void) {
static int x; // no-warning
(void) ^{ (void) x; };
}
-void test31() {
+void test31(void) {
__block int x; // no-warning
(void) ^{ (void) x; };
}
int test32_x;
-void test32() {
+void test32(void) {
(void) ^{ (void) test32_x; }; // no-warning
}
-void test_33() {
+void test_33(void) {
int x; // no-warning
(void) x;
}
-int test_34() {
+int test_34(void) {
int x; // expected-note{{initialize the variable 'x' to silence this warning}}
(void) x;
return x; // expected-warning{{variable 'x' is uninitialized when used here}}
@@ -252,7 +252,7 @@ void test35(int x) {
}
// Test handling of indirect goto.
-void test36()
+void test36(void)
{
void **pc; // expected-note{{initialize the variable 'pc' to silence this warning}}
void *dummy[] = { &&L1, &&L2 };
@@ -263,9 +263,9 @@ void test36()
}
// Test && nested in ||.
-int test37_a();
-int test37_b();
-int test37()
+int test37_a(void);
+int test37_b(void);
+int test37(void)
{
int identifier;
if ((test37_a() && (identifier = 1)) ||
@@ -301,7 +301,7 @@ int test41(int x) {
return y; // expected-note{{uninitialized use occurs here}}
}
-void test42() {
+void test42(void) {
int a;
a = 30; // no-warning
}
@@ -329,7 +329,7 @@ int test45(int j) {
return y;
}
-void test46()
+void test46(void)
{
int i; // expected-note{{initialize the variable 'i' to silence this warning}}
int j = i ? : 1; // expected-warning {{variable 'i' is uninitialized when used here}}
@@ -346,7 +346,7 @@ void *test49(int *i)
return &a ? : i; // no-warning
}
-void test50()
+void test50(void)
{
char c[1 ? : 2]; // no-warning
}
@@ -374,13 +374,13 @@ int test52(int a, int b) {
return x; // expected-warning {{variable 'x' may be uninitialized when used here}}
}
-void test53() {
+void test53(void) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
int y = (x); // expected-warning {{variable 'x' is uninitialized when used here}}
}
// This CFG caused the uninitialized values warning to inf-loop.
-extern int PR10379_g();
+extern int PR10379_g(void);
void PR10379_f(int *len) {
int new_len; // expected-note{{initialize the variable 'new_len' to silence this warning}}
for (int i = 0; i < 42 && PR10379_g() == 0; i++) {
@@ -401,7 +401,7 @@ void test_vla_sizeof(int x) {
// Test absurd case of deadcode + use of blocks. This previously was a false positive
// due to an analysis bug.
-int test_block_and_dead_code() {
+int test_block_and_dead_code(void) {
__block int x;
^{ x = 1; }();
if (0)
@@ -432,7 +432,7 @@ void rdar9432305(float *P) {
// Test that fixits are not emitted inside macros.
#define UNINIT(T, x, y) T x; T y = x;
#define ASSIGN(T, x, y) T y = x;
-void test54() {
+void test54(void) {
UNINIT(int, a, b); // expected-warning {{variable 'a' is uninitialized when used here}} \
// expected-note {{variable 'a' is declared here}}
int c; // expected-note {{initialize the variable 'c' to silence this warning}}
@@ -443,7 +443,7 @@ void test54() {
struct { struct { void *p; } a; } test55 = { { &test55.a }}; // no-warning
struct { struct { void *p; } a; } test56 = { { &(test56.a) }}; // no-warning
-void uninit_in_loop() {
+void uninit_in_loop(void) {
int produce(void);
void consume(int);
for (int n = 0; n < 100; ++n) {
@@ -453,7 +453,7 @@ void uninit_in_loop() {
}
}
-void uninit_in_loop_goto() {
+void uninit_in_loop_goto(void) {
int produce(void);
void consume(int);
for (int n = 0; n < 100; ++n) {
@@ -473,7 +473,7 @@ extern int setjmp(jmp_buf env); // implicitly returns_twice
void do_stuff_and_longjmp(jmp_buf env, int *result) __attribute__((noreturn));
-int returns_twice() {
+int returns_twice(void) {
int a; // expected-note {{initialize}}
if (!a) { // expected-warning {{variable 'a' is uninitialized}}
jmp_buf env;
@@ -494,12 +494,12 @@ int compound_assign(int *arr, int n) {
return sum / n;
}
-int compound_assign_2() {
+int compound_assign_2(void) {
int x; // expected-note {{initialize}}
return x += 1; // expected-warning {{variable 'x' is uninitialized}}
}
-int compound_assign_3() {
+int compound_assign_3(void) {
int x; // expected-note {{initialize}}
x *= 0; // expected-warning {{variable 'x' is uninitialized}}
return x;
@@ -510,7 +510,7 @@ int self_init_in_cond(int *p) {
return n;
}
-void test_analyzer_noreturn_aux() __attribute__((analyzer_noreturn));
+void test_analyzer_noreturn_aux(void) __attribute__((analyzer_noreturn));
void test_analyzer_noreturn(int y) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c
index c574f5e4afee..01c5cf6316f9 100644
--- a/clang/test/Sema/unused-expr.c
+++ b/clang/test/Sema/unused-expr.c
@@ -28,8 +28,8 @@ void bar(volatile int *VP, int *P, int A,
sqrt(A); // expected-warning {{ignoring return value of function declared with const attribute}}
}
-extern void t1();
-extern void t2();
+extern void t1(void);
+extern void t2(void);
void t3(int c) {
c ? t1() : t2();
}
@@ -75,16 +75,16 @@ void t4(int a) {
// rdar://7186119
int t5f(void) __attribute__((warn_unused_result));
-void t5() {
+void t5(void) {
t5f(); // expected-warning {{ignoring return value of function declared with 'warn_unused_result' attribute}}
}
-int fn1() __attribute__ ((warn_unused_result));
+int fn1(void) __attribute__ ((warn_unused_result));
int fn2() __attribute__ ((pure));
int fn3() __attribute__ ((__const));
// rdar://6587766
-int t6() {
+int t6(void) {
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
return -1;
@@ -100,15 +100,15 @@ int t7 __attribute__ ((warn_unused_result)); // expected-warning {{'warn_unused_
// PR4010
int (*fn4)(void) __attribute__ ((warn_unused_result));
-void t8() {
+void t8(void) {
fn4(); // expected-warning {{ignoring return value of function declared with 'warn_unused_result' attribute}}
}
-void t9() __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
+void t9(void) __attribute__((warn_unused_result)); // expected-warning {{attribute 'warn_unused_result' cannot be applied to functions without return value}}
// rdar://7410924
void *some_function(void);
-void t10() {
+void t10(void) {
(void*) some_function(); //expected-warning {{expression result unused; should this cast be to 'void'?}}
}
@@ -121,7 +121,7 @@ void f(int i, ...) {
}
// PR8371
-int fn5() __attribute__ ((__const));
+int fn5(void) __attribute__ ((__const));
// Don't warn for unused expressions in macro bodies; however, do warn for
// unused expressions in macro arguments. Macros below are reduced from code
diff --git a/clang/test/Sema/va_arg_x86_32.c b/clang/test/Sema/va_arg_x86_32.c
index e49f0a42ccf9..86a6a8881f54 100644
--- a/clang/test/Sema/va_arg_x86_32.c
+++ b/clang/test/Sema/va_arg_x86_32.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -triple=i686-pc-linux-gnu %s
-int a() {
+int a(void) {
__builtin_va_arg((char*)0, int); // expected-error {{expression is not assignable}}
__builtin_va_arg((void*){0}, int); // expected-error {{first argument to 'va_arg' is of type 'void *'}}
}
diff --git a/clang/test/Sema/var-redecl.c b/clang/test/Sema/var-redecl.c
index 1c254f504f56..30f1fb229d8c 100644
--- a/clang/test/Sema/var-redecl.c
+++ b/clang/test/Sema/var-redecl.c
@@ -8,7 +8,7 @@ int outer5;
int outer6(float); // expected-note{{previous definition is here}}
int outer7(float);
-void outer_test() {
+void outer_test(void) {
extern float outer1; // expected-error{{redeclaration of 'outer1' with a
diff erent type}}
extern float outer2; // expected-error{{redeclaration of 'outer2' with a
diff erent type}}
extern float outer3; // expected-note{{previous declaration is here}}
@@ -30,7 +30,7 @@ int outer8(int); // expected-error{{redefinition of 'outer8' as
diff erent kind o
float outer9; // expected-error{{redefinition of 'outer9' with a
diff erent type}}
extern int outer13; // expected-note{{previous declaration is here}}
-void outer_shadowing_test() {
+void outer_shadowing_test(void) {
extern int outer10;
extern int outer11; // expected-note{{previous declaration is here}}
extern int outer12; // expected-note{{previous declaration is here}}
@@ -66,5 +66,5 @@ void f(int x) { // expected-note {{previous definition is here}}
}
extern int b[];
-void g20() { extern int b[3]; } // expected-note{{previous declaration is here}}
-void g21() { extern int b[4]; } // expected-error{{redeclaration of 'b' with a
diff erent type: 'int[4]' vs 'int[3]'}}
+void g20(void) { extern int b[3]; } // expected-note{{previous declaration is here}}
+void g21(void) { extern int b[4]; } // expected-error{{redeclaration of 'b' with a
diff erent type: 'int[4]' vs 'int[3]'}}
diff --git a/clang/test/Sema/variadic-incomplete-arg-type.c b/clang/test/Sema/variadic-incomplete-arg-type.c
index 2b5dd1ab9d48..d62a37412a9e 100644
--- a/clang/test/Sema/variadic-incomplete-arg-type.c
+++ b/clang/test/Sema/variadic-incomplete-arg-type.c
@@ -5,7 +5,7 @@ typedef struct __CFError * CFErrorRef; // expected-note {{forward declaration of
void junk(int, ...);
-int main()
+int main(void)
{
CFErrorRef error;
junk(1, *error, (void)0); // expected-error {{argument type 'struct __CFError' is incomplete}} \
diff --git a/clang/test/Sema/vecshift.c b/clang/test/Sema/vecshift.c
index f342e68547f4..bf16ebc24d03 100644
--- a/clang/test/Sema/vecshift.c
+++ b/clang/test/Sema/vecshift.c
@@ -50,7 +50,7 @@ vector_uchar4 vuc4;
vector_ushort4 vus4;
vector_uint4 vui4;
-void foo() {
+void foo(void) {
vc8 = 1 << vc8;
vuc8 = 1 << vuc8;
vi8 = 1 << vi8;
diff --git a/clang/test/Sema/vector-assign.c b/clang/test/Sema/vector-assign.c
index ad3406e304a7..d7972ed8b4c7 100644
--- a/clang/test/Sema/vector-assign.c
+++ b/clang/test/Sema/vector-assign.c
@@ -5,7 +5,7 @@ typedef signed int v1s __attribute__ ((vector_size (4)));
typedef float v2f __attribute__ ((vector_size(8)));
typedef signed short v4ss __attribute__ ((vector_size (8)));
-void test1() {
+void test1(void) {
v2s v1;
v2u v2;
v1s v3;
diff --git a/clang/test/Sema/vector-cast.c b/clang/test/Sema/vector-cast.c
index 2bdc00707d4c..40d9f54c2ebd 100644
--- a/clang/test/Sema/vector-cast.c
+++ b/clang/test/Sema/vector-cast.c
@@ -7,7 +7,7 @@ typedef short s2 __attribute__ ((vector_size(4)));
typedef enum { Evalue = 0x10000 } E;
-void f()
+void f(void)
{
t1 v1;
t2 v2;
@@ -52,7 +52,7 @@ typedef float float16 __attribute__((__vector_size__(16)));
typedef signed int vSInt32 __attribute__((__vector_size__(16)));
typedef unsigned int vUInt32 __attribute__((__vector_size__(16)));
-void f4() {
+void f4(void) {
float2 f2;
double d, a, b, c;
float64x2_t v = {0.0, 1.0};
@@ -70,7 +70,7 @@ void f4() {
// rdar://15931426
// Don't permit a lax conversion to and from a pointer type.
typedef short short_sizeof_pointer __attribute__((vector_size(sizeof(void*))));
-void f5() {
+void f5(void) {
short_sizeof_pointer v;
void *ptr;
v = ptr; // expected-error-re {{assigning to 'short_sizeof_pointer' (vector of {{[0-9]+}} 'short' values) from incompatible type 'void *'}}
diff --git a/clang/test/Sema/vector-init.c b/clang/test/Sema/vector-init.c
index 9f27bb882e66..c7c278f96368 100644
--- a/clang/test/Sema/vector-init.c
+++ b/clang/test/Sema/vector-init.c
@@ -37,7 +37,7 @@ int test2[sizeof(float3) == sizeof(float4) ? 1 : -1];
typedef long long __attribute__((vector_size(16))) longlong2;
typedef short __attribute__((vector_size(16))) short8;
typedef short __attribute__((vector_size(8))) short4;
-void test3() {
+void test3(void) {
extern short8 test3_helper(void);
longlong2 arr1[2] = { test3_helper(), test3_helper() };
short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' (vector of 4 'short' values) with an expression of incompatible type 'short8' (vector of 8 'short' values)}}
diff --git a/clang/test/Sema/vector_swizzle_length.c b/clang/test/Sema/vector_swizzle_length.c
index 5e6b1e7d67a1..dc3a56c5a01c 100644
--- a/clang/test/Sema/vector_swizzle_length.c
+++ b/clang/test/Sema/vector_swizzle_length.c
@@ -3,7 +3,7 @@
typedef float float8 __attribute__((ext_vector_type(8)));
-void foo() {
+void foo(void) {
float8 f2 = (float8){0, 0, 0, 0, 0, 0, 0, 0};
(void)f2.s01234;
(void)f2.xyzxy;
diff --git a/clang/test/Sema/vla.c b/clang/test/Sema/vla.c
index 329f32b4f1f9..ba584da5bbc0 100644
--- a/clang/test/Sema/vla.c
+++ b/clang/test/Sema/vla.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only -pedantic
-int test1() {
+int test1(void) {
typedef int x[test1()]; // vla
static int y = sizeof(x); // expected-error {{not a compile-time constant}}
}
@@ -32,7 +32,7 @@ int d[i]; // expected-error {{variable length array declaration not allowed at f
int (*e)[i]; // expected-error {{variably modified type declaration not allowed at file scope}}
-void f3()
+void f3(void)
{
static int a[i]; // expected-error {{variable length array declaration cannot have 'static' storage duration}}
extern int b[i]; // expected-error {{variable length array declaration cannot have 'extern' linkage}}
@@ -53,7 +53,7 @@ int pr2044b;
int (*pr2044c(void))[pr2044b]; // expected-error {{variably modified type}}
const int f5_ci = 1;
-void f5() { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}}
+void f5(void) { char a[][f5_ci] = {""}; } // expected-error {{variable-sized object may not be initialized}}
// PR5185
void pr5185(int a[*]);
@@ -75,7 +75,7 @@ struct {
implicitly_declared() // expected-warning {{implicit declaration}}
];
};
-int (*use_implicitly_declared)() = implicitly_declared; // ok, was implicitly declared at file scope
+int (*use_implicitly_declared)(void) = implicitly_declared; // ok, was implicitly declared at file scope
void VLAPtrAssign(int size) {
int array[1][2][3][size][4][5];
@@ -90,7 +90,7 @@ void VLAPtrAssign(int size) {
int (*p4)[2][size][3][4][5] = array;
}
-void pr44406() {
+void pr44406(void) {
goto L; // expected-error {{cannot jump}}
int z[(int)(1.0 * 2)]; // expected-note {{bypasses initialization of variable length array}}
L:;
@@ -101,7 +101,7 @@ typedef struct {
char c[pr44406_a]; // expected-warning {{folded to constant array as an extension}}
} pr44406_s;
-void test_fold_to_constant_array() {
+void test_fold_to_constant_array(void) {
const int ksize = 4;
goto jump_over_a1; // expected-error{{cannot jump from this goto statement to its label}}
diff --git a/clang/test/Sema/void_arg.c b/clang/test/Sema/void_arg.c
index 337972fd149b..801d54a5e9a5 100644
--- a/clang/test/Sema/void_arg.c
+++ b/clang/test/Sema/void_arg.c
@@ -3,7 +3,7 @@
typedef void Void;
-void foo() {
+void foo(void) {
int X;
X = sizeof(int (void a)); // expected-error {{argument may not have 'void' type}}
diff --git a/clang/test/Sema/warn-absolute-value.c b/clang/test/Sema/warn-absolute-value.c
index 109d515d3b2b..b522581463a1 100644
--- a/clang/test/Sema/warn-absolute-value.c
+++ b/clang/test/Sema/warn-absolute-value.c
@@ -780,11 +780,11 @@ void test_unsigned_long(unsigned long x) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
}
-long long test_array() {
+long long test_array(void) {
return llabs((long long[]){1});
// expected-warning at -1 {{absolute value of array type}}
}
-long long test_function_pointer() {
+long long test_function_pointer(void) {
return llabs(&test_function_pointer);
// expected-warning at -1 {{absolute value of pointer type}}
}
@@ -792,7 +792,7 @@ long long test_void_pointer(void *x) {
return llabs(x);
// expected-warning at -1 {{absolute value of pointer type}}
}
-long long test_function() {
+long long test_function(void) {
return llabs(test_function);
// expected-warning at -1 {{absolute value of function type}}
}
diff --git a/clang/test/Sema/warn-binary-conditional-expression-unused.c b/clang/test/Sema/warn-binary-conditional-expression-unused.c
index 982d66df6d4b..3e3e978fabfc 100644
--- a/clang/test/Sema/warn-binary-conditional-expression-unused.c
+++ b/clang/test/Sema/warn-binary-conditional-expression-unused.c
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-value -verify %s
-int main() {
+int main(void) {
int a;
int b;
a ? : b; //expected-warning{{expression result unused}}
diff --git a/clang/test/Sema/warn-cast-align.c b/clang/test/Sema/warn-cast-align.c
index 7df71997bf3e..739e4a2d4897 100644
--- a/clang/test/Sema/warn-cast-align.c
+++ b/clang/test/Sema/warn-cast-align.c
@@ -53,7 +53,7 @@ struct S {
struct S0 __attribute__((aligned(4))) s0;
};
-void test4() {
+void test4(void) {
struct S s;
int *i = (int *)s.a;
i = (int *)&s.s0;
@@ -68,7 +68,7 @@ FnTy test5(void) {
return (FnTy)&func5;
}
-void test6() {
+void test6(void) {
struct {
int hello;
doesnotexist world; // expected-error {{unknown type name 'doesnotexist'}}
diff --git a/clang/test/Sema/warn-cast-qual.c b/clang/test/Sema/warn-cast-qual.c
index 789bde15b13c..104f9a3faf47 100644
--- a/clang/test/Sema/warn-cast-qual.c
+++ b/clang/test/Sema/warn-cast-qual.c
@@ -3,7 +3,7 @@
#include <stdint.h>
-void foo() {
+void foo(void) {
const char *const ptr = 0;
const char *const *ptrptr = 0;
char *const *ptrcptr = 0;
@@ -38,7 +38,7 @@ void foo() {
const char *charptr2 = (char *)charptr; // no warning
}
-void bar_0() {
+void bar_0(void) {
struct C {
const int a;
int b;
@@ -50,7 +50,7 @@ void bar_0() {
*(int *)(&S.b) = 0; // expected-warning {{cast from 'const int *' to 'int *' drops const qualifier}}
}
-void bar_1() {
+void bar_1(void) {
struct C {
const int a;
int b;
diff --git a/clang/test/Sema/warn-char-subscripts.c b/clang/test/Sema/warn-char-subscripts.c
index 374a609e81f7..2e72d90fa612 100644
--- a/clang/test/Sema/warn-char-subscripts.c
+++ b/clang/test/Sema/warn-char-subscripts.c
@@ -1,63 +1,63 @@
// RUN: %clang_cc1 -Wchar-subscripts -fsyntax-only -verify %s
-void t1() {
+void t1(void) {
int array[1] = { 0 };
char subscript = 0;
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
}
-void t2() {
+void t2(void) {
int array[1] = { 0 };
char subscript = 0;
int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
}
-void t3() {
+void t3(void) {
int *array = 0;
char subscript = 0;
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
}
-void t4() {
+void t4(void) {
int *array = 0;
char subscript = 0;
int val = subscript[array]; // expected-warning{{array subscript is of type 'char'}}
}
-char returnsChar();
-void t5() {
+char returnsChar(void);
+void t5(void) {
int *array = 0;
int val = array[returnsChar()]; // expected-warning{{array subscript is of type 'char'}}
}
-void t6() {
+void t6(void) {
int array[1] = { 0 };
signed char subscript = 0;
int val = array[subscript]; // no warning for explicit signed char
}
-void t7() {
+void t7(void) {
int array[1] = { 0 };
unsigned char subscript = 0;
int val = array[subscript]; // no warning for unsigned char
}
typedef char CharTy;
-void t8() {
+void t8(void) {
int array[1] = { 0 };
CharTy subscript = 0;
int val = array[subscript]; // expected-warning{{array subscript is of type 'char'}}
}
typedef signed char SignedCharTy;
-void t9() {
+void t9(void) {
int array[1] = { 0 };
SignedCharTy subscript = 0;
int val = array[subscript]; // no warning for explicit signed char
}
typedef unsigned char UnsignedCharTy;
-void t10() {
+void t10(void) {
int array[1] = { 0 };
UnsignedCharTy subscript = 0;
int val = array[subscript]; // no warning for unsigned char
diff --git a/clang/test/Sema/warn-documentation-fixits.c b/clang/test/Sema/warn-documentation-fixits.c
index 2c759630bea7..413ebb26b315 100644
--- a/clang/test/Sema/warn-documentation-fixits.c
+++ b/clang/test/Sema/warn-documentation-fixits.c
@@ -4,7 +4,7 @@
// expected-warning at +1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note at +2 {{add a deprecation attribute to the declaration to silence this warning}}
/// \deprecated
-void test_deprecated_1();
+void test_deprecated_1(void);
// expected-warning at +1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note at +2 {{add a deprecation attribute to the declaration to silence this warning}}
/// \deprecated
diff --git a/clang/test/Sema/warn-documentation.m b/clang/test/Sema/warn-documentation.m
index 6f6411e31597..962a5f63fb75 100644
--- a/clang/test/Sema/warn-documentation.m
+++ b/clang/test/Sema/warn-documentation.m
@@ -176,7 +176,7 @@ @interface S1 @end
// expected-warning at +1 {{unknown command tag name}}
/// \t bbb IS_DOXYGEN_END
-int FooBar();
+int FooBar(void);
// rdar://13836387
/** \brief Module handling the incoming notifications from the system.
@@ -256,7 +256,7 @@ - (void) VarArgMeth : (id)arg, ... {}
* \param p not here.
* \returns integer.
*/
-void (^_Nullable blockPointerVariableThatLeadsNowhere)();
+void (^_Nullable blockPointerVariableThatLeadsNowhere)(void);
@interface CheckFunctionBlockPointerVars {
/**
@@ -298,7 +298,7 @@ @interface CheckFunctionBlockPointerVars {
* \returns Nothing, but can allow this as this pattern is used to document the
* value that the property getter returns.
*/
- at property void (^blockReturnsNothing)();
+ at property void (^blockReturnsNothing)(void);
@end
@@ -314,8 +314,8 @@ @interface CheckFunctionBlockPointerVars {
typedef void (^VariadicBlockType)(int a, ...);
// PR42844 - Assertion failures when using typedefed block pointers
-typedef void(^VoidBlockType)();
-typedef VoidBlockType VoidBlockTypeCall();
+typedef void(^VoidBlockType)(void);
+typedef VoidBlockType VoidBlockTypeCall(void);
VoidBlockTypeCall *d; ///< \return none
// expected-warning at -1 {{'\return' command used in a comment that is not attached to a function or method declaration}}
VoidBlockTypeCall ^e; ///< \return none
diff --git a/clang/test/Sema/warn-extern-main.c b/clang/test/Sema/warn-extern-main.c
index 62c2c9b4a86c..7b73fe3473de 100644
--- a/clang/test/Sema/warn-extern-main.c
+++ b/clang/test/Sema/warn-extern-main.c
@@ -16,18 +16,18 @@ extern int main; // expected-warning{{variable named 'main' with external linkag
#elif TEST3
// expected-no-diagnostics
-void x() {
+void x(void) {
static int main;
}
#elif TEST4
-void x() {
+void x(void) {
extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}}
}
#elif TEST5
// expected-no-diagnostics
-void x() {
+void x(void) {
int main;
}
@@ -37,13 +37,13 @@ static int main;
#elif TEST7
// expected-no-diagnostics
-void x() {
+void x(void) {
auto int main;
}
#elif TEST8
// expected-no-diagnostics
-void x() {
+void x(void) {
register int main;
}
diff --git a/clang/test/Sema/warn-fortify-scanf.c b/clang/test/Sema/warn-fortify-scanf.c
index ec6e9220a7a3..16cbfa29b80a 100644
--- a/clang/test/Sema/warn-fortify-scanf.c
+++ b/clang/test/Sema/warn-fortify-scanf.c
@@ -5,7 +5,7 @@ extern int scanf(const char *format, ...);
extern int fscanf(FILE *f, const char *format, ...);
extern int sscanf(const char *input, const char *format, ...);
-void call_scanf() {
+void call_scanf(void) {
char buf10[10];
char buf20[20];
char buf30[30];
@@ -41,7 +41,7 @@ void call_scanf() {
scanf("%12d", &x);
}
-void call_sscanf() {
+void call_sscanf(void) {
char buf10[10];
char buf20[20];
char buf30[30];
@@ -54,7 +54,7 @@ void call_sscanf() {
sscanf("a b c", "%19s %29s %9s", buf20, buf30, buf10);
}
-void call_fscanf() {
+void call_fscanf(void) {
char buf10[10];
char buf20[20];
char buf30[30];
diff --git a/clang/test/Sema/warn-fortify-source.c b/clang/test/Sema/warn-fortify-source.c
index 6ec9c6e036ce..91c204dd9461 100644
--- a/clang/test/Sema/warn-fortify-source.c
+++ b/clang/test/Sema/warn-fortify-source.c
@@ -21,7 +21,7 @@ void *memcpy(void *dst, const void *src, size_t c);
}
#endif
-void call_memcpy() {
+void call_memcpy(void) {
char dst[10];
char src[20];
memcpy(dst, src, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 10, but size argument is 20}}
@@ -30,7 +30,7 @@ void call_memcpy() {
memcpy(dst, src, 20); // no warning, unreachable
}
-void call_memcpy_type() {
+void call_memcpy_type(void) {
struct pair {
int first;
int second;
@@ -40,56 +40,56 @@ void call_memcpy_type() {
memcpy(&p.first, buf, 20); // expected-warning {{memcpy' will always overflow; destination buffer has size 8, but size argument is 20}}
}
-void call_strncat() {
+void call_strncat(void) {
char s1[10], s2[20];
__builtin_strncat(s2, s1, 20);
__builtin_strncat(s1, s2, 20); // expected-warning {{'strncat' size argument is too large; destination buffer has size 10, but size argument is 20}}
}
-void call_strncpy() {
+void call_strncpy(void) {
char s1[10], s2[20];
__builtin_strncpy(s2, s1, 20);
__builtin_strncpy(s1, s2, 20); // expected-warning {{'strncpy' size argument is too large; destination buffer has size 10, but size argument is 20}}
}
-void call_stpncpy() {
+void call_stpncpy(void) {
char s1[10], s2[20];
__builtin_stpncpy(s2, s1, 20);
__builtin_stpncpy(s1, s2, 20); // expected-warning {{'stpncpy' size argument is too large; destination buffer has size 10, but size argument is 20}}
}
-void call_strcpy() {
+void call_strcpy(void) {
const char *const src = "abcd";
char dst[4];
__builtin_strcpy(dst, src); // expected-warning {{'strcpy' will always overflow; destination buffer has size 4, but the source string has length 5 (including NUL byte)}}
}
-void call_strcpy_nowarn() {
+void call_strcpy_nowarn(void) {
const char *const src = "abcd";
char dst[5];
// We should not get a warning here.
__builtin_strcpy(dst, src);
}
-void call_memmove() {
+void call_memmove(void) {
char s1[10], s2[20];
__builtin_memmove(s2, s1, 20);
__builtin_memmove(s1, s2, 20); // expected-warning {{'memmove' will always overflow; destination buffer has size 10, but size argument is 20}}
}
-void call_memset() {
+void call_memset(void) {
char buf[10];
__builtin_memset(buf, 0xff, 10);
__builtin_memset(buf, 0xff, 11); // expected-warning {{'memset' will always overflow; destination buffer has size 10, but size argument is 11}}
}
-void call_snprintf() {
+void call_snprintf(void) {
char buf[10];
__builtin_snprintf(buf, 10, "merp");
__builtin_snprintf(buf, 11, "merp"); // expected-warning {{'snprintf' size argument is too large; destination buffer has size 10, but size argument is 11}}
}
-void call_vsnprintf() {
+void call_vsnprintf(void) {
char buf[10];
__builtin_va_list list;
__builtin_vsnprintf(buf, 10, "merp", list);
@@ -148,7 +148,7 @@ void call_sprintf_chk(char *buf) {
__builtin___sprintf_chk(buf, 1, 11, "%e", 9.f); // expected-warning {{'sprintf' will always overflow; destination buffer has size 11, but format string expands to at least 12}}
}
-void call_sprintf() {
+void call_sprintf(void) {
char buf[6];
sprintf(buf, "hell\0 boy"); // expected-warning {{format string contains '\0' within the string body}}
sprintf(buf, "hello b\0y"); // expected-warning {{format string contains '\0' within the string body}}
diff --git a/clang/test/Sema/warn-free-nonheap-object.c b/clang/test/Sema/warn-free-nonheap-object.c
index 1618a559b431..a62e8ace7142 100644
--- a/clang/test/Sema/warn-free-nonheap-object.c
+++ b/clang/test/Sema/warn-free-nonheap-object.c
@@ -10,7 +10,7 @@ struct S {
};
int GI;
-void test() {
+void test(void) {
{
free(&GI); // expected-warning {{attempt to call free on non-heap object 'GI'}}
}
diff --git a/clang/test/Sema/warn-logical-not-compare.c b/clang/test/Sema/warn-logical-not-compare.c
index b67845ec84a0..35a500ffce8c 100644
--- a/clang/test/Sema/warn-logical-not-compare.c
+++ b/clang/test/Sema/warn-logical-not-compare.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wlogical-not-parentheses -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
-int getInt();
+int getInt(void);
int test1(int i1, int i2) {
int ret;
@@ -110,7 +110,7 @@ int test1(int i1, int i2) {
}
enum E {e1, e2};
-enum E getE();
+enum E getE(void);
int test2 (enum E e) {
int ret;
diff --git a/clang/test/Sema/warn-main-return-type.c b/clang/test/Sema/warn-main-return-type.c
index f8bcbc555fc5..468a5de478e3 100644
--- a/clang/test/Sema/warn-main-return-type.c
+++ b/clang/test/Sema/warn-main-return-type.c
@@ -3,21 +3,21 @@
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
// expected-note at +1 5{{previous definition is here}}
-int main() {
+int main(void) {
return 0;
}
// expected-error at +3 {{conflicting types for 'main}}
// expected-warning at +2 {{return type of 'main' is not 'int'}}
// expected-note at +1 {{change return type to 'int'}}
-void main() {
+void main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int"
}
// expected-error at +3 {{conflicting types for 'main}}
// expected-warning at +2 {{return type of 'main' is not 'int'}}
// expected-note at +1 {{change return type to 'int'}}
-double main() {
+double main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:7}:"int"
return 0.0;
}
@@ -28,7 +28,7 @@ double main() {
// expected-error at +3 {{conflicting types for 'main}}
// expected-warning at +2 {{return type of 'main' is not 'int'}}
// expected-note at +1 {{change return type to 'int'}}
-const float main() {
+const float main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:12}:"int"
return 0.0f;
}
@@ -38,14 +38,14 @@ typedef void *(*fptr)(int a);
// expected-error at +3 {{conflicting types for 'main}}
// expected-warning at +2 {{return type of 'main' is not 'int'}}
// expected-note at +1 {{change return type to 'int'}}
-fptr main() {
+fptr main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int"
return (fptr) 0;
}
// expected-error at +2 {{conflicting types for 'main}}
// expected-warning at +1 {{return type of 'main' is not 'int'}}
-void *(*main())(int a) {
+void *(*main(void))(int a) {
return (fptr) 0;
}
diff --git a/clang/test/Sema/warn-main.c b/clang/test/Sema/warn-main.c
index 4620663037e2..8625fdd09ee9 100644
--- a/clang/test/Sema/warn-main.c
+++ b/clang/test/Sema/warn-main.c
@@ -3,20 +3,20 @@
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
// expected-note at +1 2{{previous definition is here}}
-int main() {
+int main(void) {
return 0;
}
// expected-error at +2 {{static declaration of 'main' follows non-static declaration}}
// expected-warning at +1 {{'main' should not be declared static}}
-static int main() {
+static int main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
return 0;
}
// expected-error at +2 {{redefinition of 'main'}}
// expected-error at +1 {{'main' is not allowed to be declared inline}}
-inline int main() {
+inline int main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
return 0;
}
@@ -24,7 +24,7 @@ inline int main() {
// expected-warning at +5 {{function 'main' declared 'noreturn' should not return}}
// expected-warning at +2 {{'main' is not allowed to be declared _Noreturn}}
// expected-note at +1 {{remove '_Noreturn'}}
-_Noreturn int main() {
+_Noreturn int main(void) {
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:11}:""
return 0;
}
diff --git a/clang/test/Sema/warn-null.c b/clang/test/Sema/warn-null.c
index 3bf2aedc445f..da2d90d53417 100644
--- a/clang/test/Sema/warn-null.c
+++ b/clang/test/Sema/warn-null.c
@@ -6,7 +6,7 @@
int *p = 0;
int *q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
int *r = (1 - 1); // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
-void f() {
+void f(void) {
p = 0;
q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
r = 1 - 1; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
diff --git a/clang/test/Sema/warn-outof-range-assign-enum.c b/clang/test/Sema/warn-outof-range-assign-enum.c
index edd4e3722927..e7c6e2d7db06 100644
--- a/clang/test/Sema/warn-outof-range-assign-enum.c
+++ b/clang/test/Sema/warn-outof-range-assign-enum.c
@@ -17,7 +17,7 @@ static const CCTestEnum SilenceWithCast2 = (CCTestEnum) 51; // no-warning
static const CCTestEnum SilenceWithCast3 = (const CCTestEnum) 51; // no-warning
static const CCTestEnum SilenceWithCast4 = (const volatile CCTestEnum) 51; // no-warning
-void SilenceWithCastLocalVar() {
+void SilenceWithCastLocalVar(void) {
CCTestEnum SilenceWithCast1 = 51; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
CCTestEnum SilenceWithCast2 = (CCTestEnum) 51; // no-warning
CCTestEnum SilenceWithCast3 = (const CCTestEnum) 51; // no-warning
@@ -45,13 +45,13 @@ typedef enum
a = 0
} T;
-void f()
+void f(void)
{
T x = a;
x += 1; // expected-warning {{integer constant not in range of enumerated type}}
}
-int main() {
+int main(void) {
CCTestEnum test = 1; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
test = 600; // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
foo(2); // expected-warning {{integer constant not in range of enumerated type 'CCTestEnum'}}
diff --git a/clang/test/Sema/warn-overlap.c b/clang/test/Sema/warn-overlap.c
index e1e86d1a08cd..1eddfd1077fd 100644
--- a/clang/test/Sema/warn-overlap.c
+++ b/clang/test/Sema/warn-overlap.c
@@ -92,7 +92,7 @@ void enums(enum Choices c) {
}
// Don't generate a warning here.
-void array_out_of_bounds() {
+void array_out_of_bounds(void) {
int x;
int buffer[4];
x = (-7 > 0) ? (buffer[-7]) : 0;
diff --git a/clang/test/Sema/warn-shadow-intrinsics.c b/clang/test/Sema/warn-shadow-intrinsics.c
index b291426395c9..1d93ffb8cc61 100644
--- a/clang/test/Sema/warn-shadow-intrinsics.c
+++ b/clang/test/Sema/warn-shadow-intrinsics.c
@@ -4,7 +4,7 @@
// Test that using two macros from emmintrin do not cause a
// useless -Wshadow warning.
-void rdar10679282() {
+void rdar10679282(void) {
__m128i qf = _mm_setzero_si128();
qf = _mm_slli_si128(_mm_add_epi64(qf, _mm_srli_si128(qf, 8)), 8); // no-warning
(void) qf;
diff --git a/clang/test/Sema/warn-shadow.c b/clang/test/Sema/warn-shadow.c
index aa8505b0c917..b4b0620395cf 100644
--- a/clang/test/Sema/warn-shadow.c
+++ b/clang/test/Sema/warn-shadow.c
@@ -2,7 +2,7 @@
int i; // expected-note 3 {{previous declaration is here}}
-void foo() {
+void foo(void) {
int pass1;
int i; // expected-warning {{declaration shadows a variable in the global scope}} \
// expected-note {{previous declaration is here}}
@@ -52,11 +52,11 @@ void test7(void *context, void (*callback)(void *context)) {}
extern int bob; // expected-note {{previous declaration is here}}
// rdar://8883302
-void rdar8883302() {
+void rdar8883302(void) {
extern int bob; // don't warn for shadowing.
}
-void test8() {
+void test8(void) {
int bob; // expected-warning {{declaration shadows a variable in the global scope}}
}
diff --git a/clang/test/Sema/warn-string-conversion.c b/clang/test/Sema/warn-string-conversion.c
index fbbc264f8f9a..809fbc575205 100644
--- a/clang/test/Sema/warn-string-conversion.c
+++ b/clang/test/Sema/warn-string-conversion.c
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -verify -fsyntax-only -Wstring-conversion %s
-void do_nothing();
-void assert_error();
+void do_nothing(void);
+void assert_error(void);
#define assert1(expr) \
if (expr) \
@@ -13,7 +13,7 @@ void assert_error();
((expr) ? do_nothing() : assert_error())
// Exception for common assert form.
-void test1() {
+void test1(void) {
assert1(0 && "foo");
assert1("foo" && 0);
assert1(0 || "foo"); // expected-warning {{string literal}}
@@ -25,7 +25,7 @@ void test1() {
assert2("foo"); // expected-warning {{string literal}}
}
-void test2() {
+void test2(void) {
if ("hi") {} // expected-warning {{string literal}}
while ("hello") {} // expected-warning {{string literal}}
for (;"howdy";) {} // expected-warning {{string literal}}
diff --git a/clang/test/Sema/warn-strlcpycat-size.c b/clang/test/Sema/warn-strlcpycat-size.c
index 8babdde276fa..c471665e8b67 100644
--- a/clang/test/Sema/warn-strlcpycat-size.c
+++ b/clang/test/Sema/warn-strlcpycat-size.c
@@ -39,7 +39,7 @@ void flexible_arrays(struct S *s) {
}
// Don't issue FIXIT for destinations of size 1.
-void size_1() {
+void size_1(void) {
char z[1];
char str[] = "hi";
diff --git a/clang/test/Sema/warn-strncat-size.c b/clang/test/Sema/warn-strncat-size.c
index c050dd12994a..215eb0d079da 100644
--- a/clang/test/Sema/warn-strncat-size.c
+++ b/clang/test/Sema/warn-strncat-size.c
@@ -55,7 +55,7 @@ void flexible_arrays(struct S *s) {
}
// Don't issue FIXIT for destinations of size 1.
-void size_1() {
+void size_1(void) {
char z[1];
char str[] = "hi";
diff --git a/clang/test/Sema/warn-tautological-compare.c b/clang/test/Sema/warn-tautological-compare.c
index e4eec11b42d2..88e0f98b48ea 100644
--- a/clang/test/Sema/warn-tautological-compare.c
+++ b/clang/test/Sema/warn-tautological-compare.c
@@ -8,10 +8,10 @@ struct {
} c;
const char str[] = "text";
-void ignore() {
+void ignore(void) {
if (!a) {}
}
-void test() {
+void test(void) {
if (!b) {} // expected-warning {{address of array 'b' will always evaluate to 'true'}}
if (b == 0) {} // expected-warning {{comparison of array 'b' equal to a null pointer is always false}}
if (!c.x) {} // expected-warning {{address of array 'c.x' will always evaluate to 'true'}}
@@ -21,7 +21,7 @@ void test() {
}
int array[2];
-int test1()
+int test1(void)
{
if (!array) { // expected-warning {{address of array 'array' will always evaluate to 'true'}}
return array[0];
@@ -51,7 +51,7 @@ int test2(int* pointer, char ch, void * pv) {
return 1;
}
-void test3() {
+void test3(void) {
if (array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}}
if (array != 0) {} // expected-warning {{comparison of array 'array' not equal to a null pointer is always true}}
if (!array) { } // expected-warning {{address of array 'array' will always evaluate to 'true'}}
@@ -85,7 +85,7 @@ void _HTTPClientErrorHandler(int me)
SAVE_READ(&me);
}
-void test_conditional_operator() {
+void test_conditional_operator(void) {
int x;
x = b ? 1 : 0; // expected-warning {{address of array}}
x = c.x ? 1 : 0; // expected-warning {{address of array}}
diff --git a/clang/test/Sema/warn-thread-safety-analysis.c b/clang/test/Sema/warn-thread-safety-analysis.c
index a45fb8e0f382..355616b73d96 100644
--- a/clang/test/Sema/warn-thread-safety-analysis.c
+++ b/clang/test/Sema/warn-thread-safety-analysis.c
@@ -72,7 +72,7 @@ int get_value(int *p) SHARED_LOCKS_REQUIRED(foo_.mu_){
return *p;
}
-int main() {
+int main(void) {
Foo_fun1(1); // expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu2'}} \
expected-warning{{calling function 'Foo_fun1' requires holding mutex 'mu1' exclusively}}
@@ -132,4 +132,4 @@ int main() {
// We had a problem where we'd skip all attributes that follow a late-parsed
// attribute in a single __attribute__.
-void run() __attribute__((guarded_by(mu1), guarded_by(mu1))); // expected-warning 2{{only applies to non-static data members and global variables}}
+void run(void) __attribute__((guarded_by(mu1), guarded_by(mu1))); // expected-warning 2{{only applies to non-static data members and global variables}}
diff --git a/clang/test/Sema/warn-type-safety.c b/clang/test/Sema/warn-type-safety.c
index 13e61147a38c..e55889b10394 100644
--- a/clang/test/Sema/warn-type-safety.c
+++ b/clang/test/Sema/warn-type-safety.c
@@ -86,7 +86,7 @@ void test_tag_mismatch(int *ptr)
C_func(ptr, 20); // should warn, but may cause false positives
}
-void test_null_pointer()
+void test_null_pointer(void)
{
C_func(0, C_tag); // no-warning
C_func((void *) 0, C_tag); // no-warning
diff --git a/clang/test/Sema/warn-unreachable-ms.c b/clang/test/Sema/warn-unreachable-ms.c
index 421415e932f0..f1e08a68cee1 100644
--- a/clang/test/Sema/warn-unreachable-ms.c
+++ b/clang/test/Sema/warn-unreachable-ms.c
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 %s -triple=i686-pc-win32 -fsyntax-only -verify -fms-extensions -Wunreachable-code
-void f();
+void f(void);
-void g1() {
+void g1(void) {
__try {
f();
__leave;
@@ -24,7 +24,7 @@ void g1() {
}
}
-void g2() {
+void g2(void) {
__try {
// Nested __try.
__try {
@@ -41,7 +41,7 @@ void g2() {
}
}
-void g3() {
+void g3(void) {
__try {
__try {
f();
diff --git a/clang/test/Sema/warn-unreachable.c b/clang/test/Sema/warn-unreachable.c
index e0bd54e497ce..9e3979690ab2 100644
--- a/clang/test/Sema/warn-unreachable.c
+++ b/clang/test/Sema/warn-unreachable.c
@@ -3,11 +3,11 @@
#include "warn-unreachable.h"
-int halt() __attribute__((noreturn));
-int live();
-int dead();
+int halt(void) __attribute__((noreturn));
+int live(void);
+int dead(void);
-void test1() {
+void test1(void) {
goto c;
d:
goto e; // expected-warning {{will never be executed}}
@@ -26,7 +26,7 @@ void test1() {
f: ;
}
-void test2() {
+void test2(void) {
int i;
switch (live()) {
case 1:
@@ -123,7 +123,7 @@ void __myassert_rtn(const char *, const char *, int, const char *) __attribute__
#define myassert(e) \
(__builtin_expect(!(e), 0) ? __myassert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
-void test_assert() {
+void test_assert(void) {
myassert(0 && "unreachable");
return; // no-warning
}
@@ -137,7 +137,7 @@ void PR9774(int *s) {
// Test case for <rdar://problem/11005770>. We should treat code guarded
// by 'x & 0' and 'x * 0' as unreachable.
-int calledFun();
+int calledFun(void);
void test_mul_and_zero(int x) {
if (x & 0) calledFun(); // expected-warning {{will never be executed}}
if (0 & x) calledFun(); // expected-warning {{will never be executed}}
@@ -145,8 +145,8 @@ void test_mul_and_zero(int x) {
if (0 * x) calledFun(); // expected-warning {{will never be executed}}
}
-void raze() __attribute__((noreturn));
-void warn_here();
+void raze(void) __attribute__((noreturn));
+void warn_here(void);
int test_break_preceded_by_noreturn(int i) {
switch (i) {
@@ -193,17 +193,17 @@ void unreachable_in_default(MyEnum e) {
}
// Don't warn about trivial dead returns.
-int trivial_dead_return() {
+int trivial_dead_return(void) {
raze();
return ((0)); // expected-warning {{'return' will never be executed}}
}
-void trivial_dead_return_void() {
+void trivial_dead_return_void(void) {
raze();
return; // expected-warning {{'return' will never be executed}}
}
-MyEnum trivial_dead_return_enum() {
+MyEnum trivial_dead_return_enum(void) {
raze();
return Value1; // expected-warning {{'return' will never be executed}}
}
@@ -219,12 +219,12 @@ MyEnum trivial_dead_return_enum_2(int x) {
return 2; // expected-warning {{will never be executed}}
}
-const char *trivial_dead_return_cstr() {
+const char *trivial_dead_return_cstr(void) {
raze();
return ""; // expected-warning {{return' will never be executed}}
}
-char trivial_dead_return_char() {
+char trivial_dead_return_char(void) {
raze();
return ' '; // expected-warning {{return' will never be executed}}
}
@@ -289,7 +289,7 @@ enum MyEnum2 {
ME_B = 1
};
-int test_MyEnum() {
+int test_MyEnum(void) {
if (!ME_A)
return 1; // no-warning
if (ME_A)
@@ -329,12 +329,12 @@ int test_do_while_nontrivial_cond(int x) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code-return"
-void trivial_dead_return_void_SUPPRESSED() {
+void trivial_dead_return_void_SUPPRESSED(void) {
raze();
return; // no-warning
}
-MyEnum trivial_dead_return_enum_SUPPRESSED() {
+MyEnum trivial_dead_return_enum_SUPPRESSED(void) {
raze();
return Value1; // no-warning
}
@@ -432,7 +432,7 @@ void wrapOneInFixit(struct StructWithPointer *s) {
wrapOneInFixit(s); // expected-warning {{code will never be executed}}
}
-void unaryOpNoFixit() {
+void unaryOpNoFixit(void) {
if (~ 1)
return; // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]
unaryOpNoFixit(); // expected-warning {{code will never be executed}}
@@ -455,7 +455,7 @@ void unaryOpFixitCastSubExpr(int x) {
#define false 0
#define true 1
-void testTrueFalseMacros() {
+void testTrueFalseMacros(void) {
if (false) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
testTrueFalseMacros(); // expected-warning {{code will never be executed}}
if (!true) // expected-note {{silence by adding parentheses to mark code as explicitly dead}}
@@ -490,13 +490,13 @@ int pr13910_bar2(int x) {
pr13910_foo(x); // expected-warning {{code will never be executed}}
}
-void pr13910_noreturn() {
+void pr13910_noreturn(void) {
raze();
__builtin_unreachable(); // expected no warning
__builtin_assume(0); // expected no warning
}
-void pr13910_assert() {
+void pr13910_assert(void) {
myassert(0 && "unreachable");
return;
__builtin_unreachable(); // expected no warning
diff --git a/clang/test/Sema/warn-unreachable.m b/clang/test/Sema/warn-unreachable.m
index c2f4606d4899..aba9d09fe3c4 100644
--- a/clang/test/Sema/warn-unreachable.m
+++ b/clang/test/Sema/warn-unreachable.m
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-exceptions -verify -Wunreachable-code %s
-void f();
+void f(void);
-void g1() {
+void g1(void) {
@try {
f();
@throw @"";
@@ -24,7 +24,7 @@ void g1() {
}
}
-void g2() {
+void g2(void) {
@try {
// Nested @try.
@try {
@@ -41,7 +41,7 @@ void g2() {
}
}
-void g3() {
+void g3(void) {
@try {
@try {
f();
diff --git a/clang/test/Sema/warn-unsequenced.c b/clang/test/Sema/warn-unsequenced.c
index fd0227b479a8..1e4dcc9a9778 100644
--- a/clang/test/Sema/warn-unsequenced.c
+++ b/clang/test/Sema/warn-unsequenced.c
@@ -6,7 +6,7 @@ typedef struct A {
int x, y;
} A;
-void test() {
+void test(void) {
int a;
int xs[10];
a + ++a; // expected-warning {{unsequenced modification and access to 'a'}}
diff --git a/clang/test/Sema/warn-unused-but-set-variables.c b/clang/test/Sema/warn-unused-but-set-variables.c
index 38042ba014c4..a8d2ceaa428c 100644
--- a/clang/test/Sema/warn-unused-but-set-variables.c
+++ b/clang/test/Sema/warn-unused-but-set-variables.c
@@ -4,7 +4,7 @@ struct S {
int i;
};
-int f0() {
+int f0(void) {
int y; // expected-warning{{variable 'y' set but not used}}
y = 0;
diff --git a/clang/test/Sema/warn-unused-function.c b/clang/test/Sema/warn-unused-function.c
index 6d813669d6c9..3da59e1abe09 100644
--- a/clang/test/Sema/warn-unused-function.c
+++ b/clang/test/Sema/warn-unused-function.c
@@ -2,23 +2,23 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-infinite-recursion %s
-void foo() {}
-static void f2() {}
-static void f1() {f2();} // expected-warning{{unused}}
+void foo(void) {}
+static void f2(void) {}
+static void f1(void) {f2();} // expected-warning{{unused}}
-static int f0() { return 17; } // expected-warning{{not needed and will not be emitted}}
+static int f0(void) { return 17; } // expected-warning{{not needed and will not be emitted}}
int x = sizeof(f0());
-static void f3();
-extern void f3() { } // expected-warning{{unused}}
+static void f3(void);
+extern void f3(void) { } // expected-warning{{unused}}
-inline static void f4();
-void f4() { } // expected-warning{{unused}}
+inline static void f4(void);
+void f4(void) { } // expected-warning{{unused}}
-static void __attribute__((used)) f5() {}
-static void f6();
-static void __attribute__((used)) f6();
-static void f6() {};
+static void __attribute__((used)) f5(void) {}
+static void f6(void);
+static void __attribute__((used)) f6(void);
+static void f6(void) {};
static void f7(void);
void f8(void(*a0)(void));
diff --git a/clang/test/Sema/warn-unused-label.c b/clang/test/Sema/warn-unused-label.c
index 4b1dbbf24692..75f178aa2d5b 100644
--- a/clang/test/Sema/warn-unused-label.c
+++ b/clang/test/Sema/warn-unused-label.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-label -verify %s
-void f() {
+void f(void) {
a:
goto a;
b: // expected-warning{{unused}}
@@ -10,6 +10,6 @@ void f() {
return;
}
-void PR8455() {
+void PR8455(void) {
L: __attribute__((unused)) return; // ok, no semicolon required
}
diff --git a/clang/test/Sema/warn-unused-parameters.c b/clang/test/Sema/warn-unused-parameters.c
index 9167ae023592..4cc002fbc537 100644
--- a/clang/test/Sema/warn-unused-parameters.c
+++ b/clang/test/Sema/warn-unused-parameters.c
@@ -15,7 +15,7 @@ void f1(void) {
// Used when testing '-Wunused' to see that we only emit one diagnostic, and no
// warnings for the above cases.
-static void achor() {};
+static void achor(void) {};
// Do not warn on naked functions.
__attribute__((naked)) static void nakedFunction(int a, int b) { }
diff --git a/clang/test/Sema/warn-unused-value.c b/clang/test/Sema/warn-unused-value.c
index 14a4dc1b46ee..cc54ad61f0b9 100644
--- a/clang/test/Sema/warn-unused-value.c
+++ b/clang/test/Sema/warn-unused-value.c
@@ -5,10 +5,10 @@
int i = 0;
int j = 0;
-void foo();
+void foo(void);
// PR4806
-void pr4806() {
+void pr4806(void) {
1,foo(); // expected-warning {{left operand of comma operator has no effect}}
// other
@@ -58,10 +58,10 @@ void pr4806() {
}
// Don't warn about unused '||', '&&' expressions that contain assignments.
-int test_logical_foo1();
-int test_logical_foo2();
-int test_logical_foo3();
-int test_logical_bar() {
+int test_logical_foo1(void);
+int test_logical_foo2(void);
+int test_logical_foo3(void);
+int test_logical_bar(void) {
int x = 0;
(x = test_logical_foo1()) || // no-warning
(x = test_logical_foo2()) || // no-warning
diff --git a/clang/test/Sema/warn-unused-variables-werror.c b/clang/test/Sema/warn-unused-variables-werror.c
index ceaff1ba69b4..bd974d13d47e 100644
--- a/clang/test/Sema/warn-unused-variables-werror.c
+++ b/clang/test/Sema/warn-unused-variables-werror.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Werror -verify %s
-void f() {
+void f(void) {
int i; // expected-error{{unused}}
int j; // expected-error{{unused}}
}
diff --git a/clang/test/Sema/warn-unused-variables.c b/clang/test/Sema/warn-unused-variables.c
index 58e52b171da5..d482c353f0ad 100644
--- a/clang/test/Sema/warn-unused-variables.c
+++ b/clang/test/Sema/warn-unused-variables.c
@@ -19,12 +19,12 @@ void f1(void) {
}
// PR5933
-int f2() {
+int f2(void) {
int X = 4; // Shouldn't have a bogus 'unused variable X' warning.
return Y + X; // expected-error {{use of undeclared identifier 'Y'}}
}
-int f3() {
+int f3(void) {
int X1 = 4;
(void)(Y1 + X1); // expected-error {{use of undeclared identifier 'Y1'}}
(void)(^() { int X = 4; }); // expected-warning{{unused}}
diff --git a/clang/test/Sema/warn-variable-not-needed.c b/clang/test/Sema/warn-variable-not-needed.c
index 472ac8298999..19860ce8da4b 100644
--- a/clang/test/Sema/warn-variable-not-needed.c
+++ b/clang/test/Sema/warn-variable-not-needed.c
@@ -2,7 +2,7 @@
// expected-no-diagnostics
static int a;
-int bar() {
+int bar(void) {
extern int a;
return a;
}
diff --git a/clang/test/Sema/wchar.c b/clang/test/Sema/wchar.c
index 2c88f8db5248..5566207e50d7 100644
--- a/clang/test/Sema/wchar.c
+++ b/clang/test/Sema/wchar.c
@@ -28,7 +28,7 @@ typedef __WCHAR_TYPE__ wchar_t;
int check_wchar_size[sizeof(*L"") == sizeof(wchar_t) ? 1 : -1];
-void foo() {
+void foo(void) {
WCHAR_T_TYPE t1[] = L"x";
wchar_t tab[] = L"x";
WCHAR_T_TYPE t2[] = "x"; // expected-error {{initializing wide char array with non-wide string literal}}
diff --git a/clang/test/Sema/x86-attr-force-align-arg-pointer.c b/clang/test/Sema/x86-attr-force-align-arg-pointer.c
index 5d36e9af195b..20e6e1c3e5b5 100644
--- a/clang/test/Sema/x86-attr-force-align-arg-pointer.c
+++ b/clang/test/Sema/x86-attr-force-align-arg-pointer.c
@@ -14,8 +14,8 @@ void d(void);
void __attribute__((force_align_arg_pointer)) d(void) {}
// Attribute is ignored on function pointer types.
-void (__attribute__((force_align_arg_pointer)) *p)();
-typedef void (__attribute__((__force_align_arg_pointer__)) *p2)();
+void (__attribute__((force_align_arg_pointer)) *p)(void);
+typedef void (__attribute__((__force_align_arg_pointer__)) *p2)(void);
// Attribute is also ignored on function typedefs.
typedef void __attribute__((force_align_arg_pointer)) e(void);
diff --git a/clang/test/Sema/xray-always-instrument-attr.c b/clang/test/Sema/xray-always-instrument-attr.c
index b52369010287..7c025fbc7791 100644
--- a/clang/test/Sema/xray-always-instrument-attr.c
+++ b/clang/test/Sema/xray-always-instrument-attr.c
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only -std=c11
-void foo() __attribute__((xray_always_instrument));
+void foo(void) __attribute__((xray_always_instrument));
struct __attribute__((xray_always_instrument)) a { int x; }; // expected-warning {{'xray_always_instrument' attribute only applies to functions and Objective-C methods}}
-void bar() __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
+void bar(void) __attribute__((xray_always_instrument("not-supported"))); // expected-error {{'xray_always_instrument' attribute takes no arguments}}
diff --git a/clang/test/Sema/xray-log-args-oob.c b/clang/test/Sema/xray-log-args-oob.c
index 585f5fd172ee..71fbdef2c52c 100644
--- a/clang/test/Sema/xray-log-args-oob.c
+++ b/clang/test/Sema/xray-log-args-oob.c
@@ -2,8 +2,8 @@
void foo(int) __attribute__((xray_log_args(1)));
struct __attribute__((xray_log_args(1))) a { int x; }; // expected-warning {{'xray_log_args' attribute only applies to functions and Objective-C methods}}
-void fop() __attribute__((xray_log_args(1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
+void fop(void) __attribute__((xray_log_args(1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
-void foq() __attribute__((xray_log_args(-1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
+void foq(void) __attribute__((xray_log_args(-1))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
-void fos() __attribute__((xray_log_args(0))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
+void fos(void) __attribute__((xray_log_args(0))); // expected-error {{'xray_log_args' attribute parameter 1 is out of bounds}}
diff --git a/clang/test/SemaCUDA/attr-declspec.cu b/clang/test/SemaCUDA/attr-declspec.cu
index bad86c65c23a..3d0165038dd5 100644
--- a/clang/test/SemaCUDA/attr-declspec.cu
+++ b/clang/test/SemaCUDA/attr-declspec.cu
@@ -21,16 +21,16 @@
// expected-warning at +14 {{'__device_builtin_texture_type__' attribute only applies to classes}}
#endif
-__declspec(__device__) void f_device();
-__declspec(__global__) void f_global();
+__declspec(__device__) void f_device(void);
+__declspec(__global__) void f_global(void);
__declspec(__constant__) int* g_constant;
__declspec(__shared__) float *g_shared;
-__declspec(__host__) void f_host();
-__declspec(__device_builtin__) void f_device_builtin();
+__declspec(__host__) void f_host(void);
+__declspec(__device_builtin__) void f_device_builtin(void);
typedef __declspec(__device_builtin__) const void *t_device_builtin;
enum __declspec(__device_builtin__) e_device_builtin {E};
__declspec(__device_builtin__) int v_device_builtin;
-__declspec(__cudart_builtin__) void f_cudart_builtin();
+__declspec(__cudart_builtin__) void f_cudart_builtin(void);
__declspec(__device_builtin_surface_type__) unsigned long long surface_var;
__declspec(__device_builtin_texture_type__) unsigned long long texture_var;
diff --git a/clang/test/SemaCUDA/attributes-on-non-cuda.cu b/clang/test/SemaCUDA/attributes-on-non-cuda.cu
index 215721d273f4..ee4b43a04ce5 100644
--- a/clang/test/SemaCUDA/attributes-on-non-cuda.cu
+++ b/clang/test/SemaCUDA/attributes-on-non-cuda.cu
@@ -22,16 +22,16 @@
// expected-warning at +15 {{'device_builtin_texture_type' attribute only applies to classes}}
#endif
-__attribute__((device)) void f_device();
-__attribute__((global)) void f_global();
+__attribute__((device)) void f_device(void);
+__attribute__((global)) void f_global(void);
__attribute__((constant)) int* g_constant;
__attribute__((shared)) float *g_shared;
-__attribute__((host)) void f_host();
-__attribute__((device_builtin)) void f_device_builtin();
+__attribute__((host)) void f_host(void);
+__attribute__((device_builtin)) void f_device_builtin(void);
typedef __attribute__((device_builtin)) const void *t_device_builtin;
enum __attribute__((device_builtin)) e_device_builtin {E};
__attribute__((device_builtin)) int v_device_builtin;
-__attribute__((cudart_builtin)) void f_cudart_builtin();
-__attribute__((nv_weak)) void f_nv_weak();
+__attribute__((cudart_builtin)) void f_cudart_builtin(void);
+__attribute__((nv_weak)) void f_nv_weak(void);
__attribute__((device_builtin_surface_type)) unsigned long long surface_var;
__attribute__((device_builtin_texture_type)) unsigned long long texture_var;
diff --git a/clang/test/SemaCXX/attr-deprecated-replacement-fixit.cpp b/clang/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
index 2e635a72c196..89258b8233ec 100644
--- a/clang/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
+++ b/clang/test/SemaCXX/attr-deprecated-replacement-fixit.cpp
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -verify -fsyntax-only %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
-// RUN: cp %s %t
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t
-// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t
+// RUN: cp %s %t.cpp
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fixit %t.cpp
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -Werror %t.cpp
#if !__has_feature(attribute_deprecated_with_replacement)
#error "Missing __has_feature"
diff --git a/clang/test/SemaCXX/attr-require-constant-initialization.cpp b/clang/test/SemaCXX/attr-require-constant-initialization.cpp
index 77a4d52538dd..4c0a83455171 100644
--- a/clang/test/SemaCXX/attr-require-constant-initialization.cpp
+++ b/clang/test/SemaCXX/attr-require-constant-initialization.cpp
@@ -7,7 +7,7 @@
#define ATTR __attribute__((require_constant_initialization)) // expected-note 0+ {{expanded from macro}}
-int ReturnInt(); // expected-note 0+ {{declared here}}
+int ReturnInt(void); // expected-note 0+ {{declared here}}
struct PODType { // expected-note 0+ {{declared here}}
int value; // expected-note 0-2 {{declared here}}
@@ -78,7 +78,7 @@ ATTR const int &glvalue_ref ATTR = glvalue_int;
ATTR const int &glvalue_ref2 ATTR = glvalue_int2;
ATTR __thread const int &glvalue_ref_tl = glvalue_int;
-void test_basic_start_static_2_1() {
+void test_basic_start_static_2_1(void) {
const int non_global = 42;
ATTR static const int &local_init = non_global; // expected-error {{variable does not have a constant initializer}}
// expected-note at -1 {{required by 'require_constant_initialization' attribute here}}
@@ -146,7 +146,7 @@ thread_local const int &TT1::tl_temp_init = 42; // expected-error {{variable doe
// constructor call, and if the initialization full-expression is a constant
// initializer for the object;
-void test_basic_start_static_2_2() {
+void test_basic_start_static_2_2(void) {
#if __cplusplus < 201103L
ATTR static PODType pod;
#else
@@ -249,7 +249,7 @@ ATTR int lit_in_init = LitType{42}.value;
// if an object with static or thread storage duration is not initialized by a
// constructor call and if either the object is value-initialized or every
// full-expression that appears in its initializer is a constant expression.
-void test_basic_start_static_2_3() {
+void test_basic_start_static_2_3(void) {
ATTR static int static_local = 42;
ATTR static int static_local2; // zero-initialization takes place
#if __cplusplus >= 201103L
diff --git a/clang/test/SemaCXX/size_t-literal.cpp b/clang/test/SemaCXX/size_t-literal.cpp
index 180f95979b39..02e644697002 100644
--- a/clang/test/SemaCXX/size_t-literal.cpp
+++ b/clang/test/SemaCXX/size_t-literal.cpp
@@ -15,7 +15,7 @@ struct is_same { static constexpr bool value = false; };
template <typename T>
struct is_same<T, T> { static constexpr bool value = true; };
-void SSizeT() {
+void SSizeT(void) {
auto a1 = 1z;
// cxx2b-warning at -1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning at -2 {{'size_t' suffix for literals is a C++2b extension}}
@@ -27,7 +27,7 @@ void SSizeT() {
static_assert(is_same<decltype(a2), ssize_t>::value);
}
-void SizeT() {
+void SizeT(void) {
auto a1 = 1uz;
// cxx2b-warning at -1 {{'size_t' suffix for literals is incompatible with C++ standards before C++2b}}
// cxx20-warning at -2 {{'size_t' suffix for literals is a C++2b extension}}
@@ -69,7 +69,7 @@ void SizeT() {
static_assert(is_same<decltype(a8), size_t>::value);
}
-void oor() {
+void oor(void) {
#if __i386__
(void)3'000'000'000z; // cxx2b-32-error {{signed 'size_t' literal is out of range of possible signed 'size_t' values}}
(void)3'000'000'000uz;
@@ -83,7 +83,7 @@ void oor() {
#else
-void f() {
+void f(void) {
(void)1z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1Z; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
(void)1uz; // c11-error {{'size_t' suffix for literals is a C++2b feature}}
diff --git a/clang/test/SemaCXX/types_compatible_p.cpp b/clang/test/SemaCXX/types_compatible_p.cpp
index 29e06405adea..adcf2776d05a 100644
--- a/clang/test/SemaCXX/types_compatible_p.cpp
+++ b/clang/test/SemaCXX/types_compatible_p.cpp
@@ -3,7 +3,7 @@
// Test that GNU C extension __builtin_types_compatible_p() is not available in C++ mode.
-int f() {
+int f(void) {
return __builtin_types_compatible_p(int, const int); // expected-error{{expected '(' for function-style cast or type construction}} \
// expected-error{{expected expression}}
}
diff --git a/clang/test/SemaCXX/warn-comma-operator.cpp b/clang/test/SemaCXX/warn-comma-operator.cpp
index 76cd49ed42bf..635ce01b1c9c 100644
--- a/clang/test/SemaCXX/warn-comma-operator.cpp
+++ b/clang/test/SemaCXX/warn-comma-operator.cpp
@@ -7,10 +7,10 @@
// RUN: %clang_cc1 -fsyntax-only -Wcomma -x c -std=c17 -verify %s
// int returning function
-int return_four() { return 5; }
+int return_four(void) { return 5; }
// Test builtin operators
-void test_builtin() {
+void test_builtin(void) {
int x = 0, y = 0;
for (; y < 10; x++, y++) {}
for (; y < 10; ++x, y++) {}
@@ -32,7 +32,7 @@ void test_builtin() {
}
// Test nested comma operators
-void test_nested() {
+void test_nested(void) {
int x1, x2, x3;
int y1, *y2 = 0, y3 = 5;
@@ -42,7 +42,7 @@ void test_nested() {
}
// Confusing "," for "=="
-void test_compare() {
+void test_compare(void) {
if (return_four(), 5) {}
// expected-warning at -1{{comma operator}}
// expected-note at -2{{cast expression to void}}
@@ -53,7 +53,7 @@ void test_compare() {
}
// Confusing "," for "+"
-int test_plus() {
+int test_plus(void) {
return return_four(), return_four();
// expected-warning at -1{{comma operator}}
// expected-note at -2{{cast expression to void}}
@@ -64,7 +64,7 @@ int test_plus() {
}
// Be sure to look through parentheses
-void test_parentheses() {
+void test_parentheses(void) {
int x, y;
for (x = 0; return_four(), x;) {}
// expected-warning at -1{{comma operator}}
@@ -79,7 +79,7 @@ void test_parentheses() {
// CHECK: fix-it:{{.*}}:{[[@LINE-4]]:30-[[@LINE-4]]:30}:")"
}
-void test_increment() {
+void test_increment(void) {
int x, y;
++x, ++y;
// expected-warning at -1{{comma operator}}
@@ -128,7 +128,7 @@ void test_conditions(int x) {
}
// Nested comma operator with fix-its.
-void test_nested_fixits() {
+void test_nested_fixits(void) {
return_four(), return_four(), return_four(), return_four();
// expected-warning at -1 3{{comma operator}}
// expected-note at -2 3{{cast expression to void}}
diff --git a/clang/test/SemaObjC/alias-test-1.m b/clang/test/SemaObjC/alias-test-1.m
index 2cea115b429e..0e517e4677ca 100644
--- a/clang/test/SemaObjC/alias-test-1.m
+++ b/clang/test/SemaObjC/alias-test-1.m
@@ -19,7 +19,7 @@
alias *p;
class2 *p2;
-int foo ()
+int foo (void)
{
if (p == p2) {
diff --git a/clang/test/SemaObjC/arc-bridged-cast.m b/clang/test/SemaObjC/arc-bridged-cast.m
index 0ba7792146c6..ad167e985b27 100644
--- a/clang/test/SemaObjC/arc-bridged-cast.m
+++ b/clang/test/SemaObjC/arc-bridged-cast.m
@@ -9,15 +9,15 @@
@interface NSString
@end
-CFTypeRef CFCreateSomething();
-CFStringRef CFCreateString();
-CFTypeRef CFGetSomething();
-CFStringRef CFGetString();
+CFTypeRef CFCreateSomething(void);
+CFStringRef CFCreateString(void);
+CFTypeRef CFGetSomething(void);
+CFStringRef CFGetString(void);
-id CreateSomething();
-NSString *CreateNSString();
+id CreateSomething(void);
+NSString *CreateNSString(void);
-void from_cf() {
+void from_cf(void) {
id obj1 = (__bridge_transfer id)CFCreateSomething();
id obj2 = (__bridge_transfer NSString*)CFCreateString();
(__bridge int*)CFCreateSomething(); // expected-error{{incompatible types casting 'CFTypeRef' (aka 'const void *') to 'int *' with a __bridge cast}}
@@ -36,7 +36,7 @@ void to_cf(id obj) {
// CHECK: fix-it:"{{.*}}":{35:20-35:35}:"__bridge_retained"
}
-CFTypeRef fixits() {
+CFTypeRef fixits(void) {
id obj1 = (id)CFCreateSomething(); // expected-error{{cast of C pointer type 'CFTypeRef' (aka 'const void *') to Objective-C pointer type 'id' requires a bridged cast}} \
// expected-note{{use __bridge to convert directly (no change in ownership)}} expected-note{{use CFBridgingRelease call to transfer ownership of a +1 'CFTypeRef' (aka 'const void *') into ARC}}
// CHECK: fix-it:"{{.*}}":{40:17-40:17}:"CFBridgingRelease("
@@ -65,9 +65,9 @@ CFTypeRef fixitsWithSpace(id obj) {
// rdar://problem/20107345
typedef const struct __attribute__((objc_bridge(id))) __CFAnnotatedObject *CFAnnotatedObjectRef;
-CFAnnotatedObjectRef CFGetAnnotated();
+CFAnnotatedObjectRef CFGetAnnotated(void);
-void testObjCBridgeId() {
+void testObjCBridgeId(void) {
id obj;
obj = (__bridge id)CFGetAnnotated();
obj = (__bridge NSString*)CFGetAnnotated();
diff --git a/clang/test/SemaObjC/arc-cf.m b/clang/test/SemaObjC/arc-cf.m
index d71d274dfb81..199dce0ec6b6 100644
--- a/clang/test/SemaObjC/arc-cf.m
+++ b/clang/test/SemaObjC/arc-cf.m
@@ -13,7 +13,7 @@
#pragma clang arc_cf_code_audited begin
extern CFStringRef CFCreateString0(void);
#pragma clang arc_cf_code_audited end
-void test0() {
+void test0(void) {
id x;
x = (id) CFMakeString0(); // expected-error {{requires a bridged cast}} expected-note {{__bridge to convert directly}} expected-note {{CFBridgingRelease call to transfer}}
x = (id) CFCreateString0(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
@@ -21,7 +21,7 @@ void test0() {
extern CFStringRef CFMakeString1(void) __attribute__((cf_returns_not_retained));
extern CFStringRef CFCreateString1(void) __attribute__((cf_returns_retained));
-void test1() {
+void test1(void) {
id x;
x = (id) CFMakeString1();
x = (id) CFCreateString1(); // expected-error {{requires a bridged cast}} expected-note {{CFBridgingRelease call to transfer}}
@@ -38,7 +38,7 @@ void test1() {
extern CFStringRef CFMakeString3(void) CF_RETURNS_RETAINED;
extern CFStringRef CFCreateString3(void);
CF_AUDIT_END
-void test2() {
+void test2(void) {
id x;
x = (id) CFMakeString2();
x = (id) CFCreateString2();
@@ -53,7 +53,7 @@ @interface NSString @end
extern SInt32 CFStringGetIntValue(CFStringRef str); // expected-note {{passing argument to parameter 'str' here}}
#pragma clang arc_cf_code_audited end
-void test3() {
+void test3(void) {
NSString* answer = @"42";
int ans = CFStringGetIntValue(answer); // expected-error {{incompatible pointer types passing retainable parameter of type 'NSString *__strong'to a CF function expecting 'CFStringRef'}}
}
diff --git a/clang/test/SemaObjC/arc-decls.m b/clang/test/SemaObjC/arc-decls.m
index 28c3de996996..93d7d941c1a0 100644
--- a/clang/test/SemaObjC/arc-decls.m
+++ b/clang/test/SemaObjC/arc-decls.m
@@ -35,7 +35,8 @@ @interface I {
// rdar://10260525
struct r10260525 {
- id (^block) ();
+ id (^block1) ();
+ id (^block2) (void);
};
struct S {
@@ -54,7 +55,7 @@ @interface I {
extern id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
-void func()
+void func(void)
{
id X;
static id __autoreleasing X1; // expected-error {{global variables cannot have __autoreleasing ownership}}
diff --git a/clang/test/SemaObjC/arc-dict-bridged-cast.m b/clang/test/SemaObjC/arc-dict-bridged-cast.m
index e683343cd07a..957c3ec9b271 100644
--- a/clang/test/SemaObjC/arc-dict-bridged-cast.m
+++ b/clang/test/SemaObjC/arc-dict-bridged-cast.m
@@ -26,7 +26,7 @@ - (id)objectForKeyedSubscript:(id<NSCopying>)key;
@interface NSMutableString @end
-NSMutableString *test() {
+NSMutableString *test(void) {
NSDictionary *infoDictionary;
infoDictionary[kCFBundleNameKey] = 0; // expected-error {{indexing expression is invalid because subscript type 'CFStringRef' (aka 'const struct __CFString *') is not an integral or Objective-C pointer type}}
return infoDictionary[CFStringCreateMutable(((void*)0), 100)]; // expected-error {{indexing expression is invalid because subscript type 'CFMutableStringRef' (aka 'struct __CFString *') is not an integral or Objective-C pointer type}} \
diff --git a/clang/test/SemaObjC/arc-objc-lifetime.m b/clang/test/SemaObjC/arc-objc-lifetime.m
index 5e252537fb88..6d96cc84aaae 100644
--- a/clang/test/SemaObjC/arc-objc-lifetime.m
+++ b/clang/test/SemaObjC/arc-objc-lifetime.m
@@ -5,7 +5,7 @@
typedef const struct __CFString * CFStringRef;
@class NSString;
-NSString *CFBridgingRelease();
+NSString *CFBridgingRelease(void);
typedef NSString * PNSString;
@@ -42,7 +42,7 @@ - (void)decodeValueOfObjCType:(const char *)type at:(void *)addr {
__unsafe_unretained strong_I test5;
// rdar://10907090
-typedef void (^T) ();
+typedef void (^T) (void);
@interface NSObject @end
@protocol P;
@interface Radar10907090 @end
@@ -54,7 +54,7 @@ - (void) MM : (NSObject*) arg0 : (__strong NSObject**)arg : (id) arg1 : (__stron
- (void) M : (NSObject**)arg0 : (id*)arg {} // expected-warning {{method parameter of type 'NSObject *__autoreleasing *' with no explicit ownership}} \
// expected-warning {{method parameter of type '__autoreleasing id *' with no explicit ownership}}
- (void) N : (__strong NSObject***) arg0 : (__strong NSObject<P>***)arg : (float**) arg1 : (double) arg2 {}
-- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)()') with no explicit ownership}}
+- (void) BLOCK : (T*) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning-re {{method parameter of type '__autoreleasing T *' (aka 'void (^__autoreleasing *)({{(void)?}})') with no explicit ownership}}
@end
// rdar://12280826
@@ -73,32 +73,32 @@ - (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environme
typedef __strong NSObject *strong_NSObject_ptr;
// Warn
-__strong id f1(); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
+__strong id f1(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
NSObject __unsafe_unretained *f2(int); // expected-warning{{ARC __unsafe_unretained lifetime qualifier on return type is ignored}}
__autoreleasing NSObject *f3(void); // expected-warning{{ARC __autoreleasing lifetime qualifier on return type is ignored}}
NSObject * __strong f4(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
-NSObject_ptr __strong f5(); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
+NSObject_ptr __strong f5(void); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
typedef __strong id (*fptr)(int); // expected-warning{{ARC __strong lifetime qualifier on return type is ignored}}
// Don't warn
-strong_id f6();
-strong_NSObject_ptr f7();
+strong_id f6(void);
+strong_NSObject_ptr f7(void);
typedef __strong id (^block_ptr)(int);
// rdar://10127067
-void test8_a() {
+void test8_a(void) {
__weak id *(^myBlock)(void);
__weak id *var = myBlock();
(void) (__strong id *) &myBlock;
(void) (__weak id *) &myBlock; // expected-error {{cast}}
}
-void test8_b() {
+void test8_b(void) {
__weak id (^myBlock)(void);
(void) (__weak id *) &myBlock;
(void) (__strong id *) &myBlock; // expected-error {{cast}}
}
-void test8_c() {
+void test8_c(void) {
__weak id (^*(^myBlock)(void))(void);
(void) (__weak id*) myBlock();
(void) (__strong id*) myBlock(); // expected-error {{cast}}
@@ -107,18 +107,18 @@ void test8_c() {
}
@class Test9;
-void test9_a() {
+void test9_a(void) {
__weak Test9 **(^myBlock)(void);
__weak Test9 **var = myBlock();
(void) (__strong Test9 **) &myBlock;
(void) (__weak Test9 **) &myBlock; // expected-error {{cast}}
}
-void test9_b() {
+void test9_b(void) {
__weak Test9 *(^myBlock)(void);
(void) (__weak Test9**) &myBlock;
(void) (__strong Test9**) &myBlock; // expected-error {{cast}}
}
-void test9_c() {
+void test9_c(void) {
__weak Test9 *(^*(^myBlock)(void))(void);
(void) (__weak Test9 **) myBlock();
(void) (__strong Test9 **) myBlock(); // expected-error {{cast}}
diff --git a/clang/test/SemaObjC/arc-system-header.m b/clang/test/SemaObjC/arc-system-header.m
index f3b72363c57b..62fceec798ac 100644
--- a/clang/test/SemaObjC/arc-system-header.m
+++ b/clang/test/SemaObjC/arc-system-header.m
@@ -26,14 +26,14 @@ void test5(struct Test5 *p) {
p->field = 0;
}
-id test6() {
+id test6(void) {
// This is actually okay to use if declared in a system header.
id x;
x = (id) kMagicConstant;
x = (id) (x ? kMagicConstant : kMagicConstant);
x = (id) (x ? kMagicConstant : (void*) 0);
- extern void test6_helper();
+ extern void test6_helper(void);
x = (id) (test6_helper(), kMagicConstant);
}
@@ -47,7 +47,7 @@ void test7(Test7 *p) {
}
extern void doSomething(Test9 arg);
-void test9() {
+void test9(void) {
Test9 foo2 = {0, 0};
doSomething(foo2);
}
diff --git a/clang/test/SemaObjC/arc-type-conversion.m b/clang/test/SemaObjC/arc-type-conversion.m
index a349d00ec851..f06a137cc209 100644
--- a/clang/test/SemaObjC/arc-type-conversion.m
+++ b/clang/test/SemaObjC/arc-type-conversion.m
@@ -61,9 +61,9 @@ void from_void(void *vp) {
uip = vp; // expected-error{{implicit conversion of a non-Objective-C pointer type 'void *' to '__unsafe_unretained id *' is disallowed with ARC}}
}
-typedef void (^Block)();
-typedef void (^Block_strong)() __strong;
-typedef void (^Block_autoreleasing)() __autoreleasing;
+typedef void (^Block)(void);
+typedef void (^Block_strong)(void) __strong;
+typedef void (^Block_autoreleasing)(void) __autoreleasing;
@class NSString;
diff --git a/clang/test/SemaObjC/arc-unavailable-for-weakref.m b/clang/test/SemaObjC/arc-unavailable-for-weakref.m
index c59616819930..3b4c79d200a1 100644
--- a/clang/test/SemaObjC/arc-unavailable-for-weakref.m
+++ b/clang/test/SemaObjC/arc-unavailable-for-weakref.m
@@ -8,7 +8,7 @@ @interface NSOptOut1072 // expected-note {{class is declared here}}
@interface sub : NSOptOut1072 @end // expected-note 2 {{class is declared here}}
-int main() {
+int main(void) {
__weak sub *w2; // expected-error {{class is incompatible with __weak references}}
__weak NSOptOut1072 *ns1; // expected-error {{class is incompatible with __weak references}}
@@ -26,7 +26,7 @@ @interface NOWEAK
+ (id) new;
@end
-NOWEAK * Test1() {
+NOWEAK * Test1(void) {
NOWEAK * strong1 = [NOWEAK new];
__weak id weak1;
weak1 = strong1; // expected-error {{assignment of a weak-unavailable object to a __weak object}}
@@ -39,7 +39,7 @@ + (id) new;
@protocol P @end
@protocol P1 @end
-NOWEAK<P, P1> * Test2() {
+NOWEAK<P, P1> * Test2(void) {
NOWEAK<P, P1> * strong1 = 0;
__weak id<P> weak1;
weak1 = strong1; // expected-error {{assignment of a weak-unavailable object to a __weak object}}
diff --git a/clang/test/SemaObjC/arc-unavailable-system-function.m b/clang/test/SemaObjC/arc-unavailable-system-function.m
index e9e217980fb8..d3ada73ec752 100644
--- a/clang/test/SemaObjC/arc-unavailable-system-function.m
+++ b/clang/test/SemaObjC/arc-unavailable-system-function.m
@@ -3,10 +3,10 @@
# 1 "<command line>"
# 1 "/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h" 1 3
-id * foo(); // expected-note {{declaration uses type that is ill-formed in ARC}}
+id * foo(void); // expected-note {{declaration uses type that is ill-formed in ARC}}
# 1 "arc-unavailable-system-function.m" 2
-void ret() {
+void ret(void) {
foo(); // expected-error {{'foo' is unavailable in ARC}}
}
diff --git a/clang/test/SemaObjC/arc.m b/clang/test/SemaObjC/arc.m
index bcd2f995622c..05353d2506d8 100644
--- a/clang/test/SemaObjC/arc.m
+++ b/clang/test/SemaObjC/arc.m
@@ -92,7 +92,7 @@ - (id)myBadInit __attribute__((objc_method_family(12))); // expected-error {{'o
@end
-void rdar8861761() {
+void rdar8861761(void) {
B *o1 = [[B alloc] initWithInt:0];
B *o2 = [B alloc];
[o2 initWithInt:0]; // expected-warning {{expression result unused}}
@@ -105,7 +105,7 @@ @interface rdar8925835
- (void)foo:(void (^)(unsigned captureCount, I * const capturedStrings[captureCount]))block;
@end
-void test5() {
+void test5(void) {
extern void test5_helper(__autoreleasing id *);
id x;
@@ -340,7 +340,7 @@ - (id) consumesSelf {
// rdar://problem/9172151
@class Test14A, Test14B;
-void test14() {
+void test14(void) {
extern void test14_consume(id *);
extern int test14_cond(void);
extern float test14_nowriteback(id __autoreleasing const *); // expected-note{{passing argument to parameter here}}
@@ -376,7 +376,7 @@ void test14() {
test14_nowriteback(wip); // expected-error{{passing '__weak id *' to parameter of type '__autoreleasing id const *' changes retain/release properties of pointer}}
}
-void test15() {
+void test15(void) {
__block __autoreleasing id x; // expected-error {{__block variables cannot have __autoreleasing ownership}}
}
@@ -464,7 +464,7 @@ _Bool fn(id obj) {
}
// Check casting w/ ownership qualifiers.
-void test21() {
+void test21(void) {
__strong id *sip;
(void)(__weak id *)sip; // expected-error{{casting '__strong id *' to type '__weak id *' changes retain/release properties of pointer}}
(void)(__weak const id *)sip; // expected-error{{casting '__strong id *' to type '__weak id const *' changes retain/release properties of pointer}}
@@ -606,7 +606,7 @@ - (void) Meth {
// rdar://9411838
@protocol PTest31 @end
-int Test31() {
+int Test31(void) {
Class cls;
id ids;
id<PTest31> pids;
@@ -698,7 +698,7 @@ void test37(Test37 *c) {
@interface Test38
@property int value;
@end
-void test38() {
+void test38(void) {
extern Test38 *test38_helper(void);
switch (test38_helper().value) {
case 0:
@@ -797,7 +797,7 @@ void foo(NSArray *array) {
}
// rdar://16627903
-extern void abort();
+extern void abort(void);
#define TKAssertEqual(a, b) do{\
__typeof(a) a_res = (a);\
__typeof(b) b_res = (b);\
@@ -806,7 +806,7 @@ void foo(NSArray *array) {
}\
}while(0)
-int garf() {
+int garf(void) {
id object;
TKAssertEqual(object, nil);
TKAssertEqual(object, (id)nil);
diff --git a/clang/test/SemaObjC/argument-checking.m b/clang/test/SemaObjC/argument-checking.m
index 3639fcd51190..04e64ecd5230 100644
--- a/clang/test/SemaObjC/argument-checking.m
+++ b/clang/test/SemaObjC/argument-checking.m
@@ -13,7 +13,7 @@ -(int)charStarMeth:(char *)s; // expected-note{{passing argument to parameter 's
:(struct S)s2; // expected-note{{passing argument to parameter 's2' here}}
@end
-void test() {
+void test(void) {
id obj = [Test alloc];
struct S sInst;
diff --git a/clang/test/SemaObjC/attr-availability-priority.m b/clang/test/SemaObjC/attr-availability-priority.m
index 83a1668d2b3e..99e5b45ca0b9 100644
--- a/clang/test/SemaObjC/attr-availability-priority.m
+++ b/clang/test/SemaObjC/attr-availability-priority.m
@@ -1,15 +1,15 @@
// RUN: %clang_cc1 -triple arm64-apple-tvos12.0 -fsyntax-only -verify %s
-void explicit() __attribute__((availability(tvos, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
-void inferred() __attribute__((availability(ios, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
-void explicitOverInferred()
+void explicit(void) __attribute__((availability(tvos, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
+void inferred(void) __attribute__((availability(ios, introduced=11.0, deprecated=12.0))); // expected-note {{marked deprecated here}}
+void explicitOverInferred(void)
__attribute__((availability(ios, introduced=11.0, deprecated=12.0)))
__attribute__((availability(tvos, introduced=11.0)));
-void explicitOverInferred2()
+void explicitOverInferred2(void)
__attribute__((availability(tvos, introduced=11.0)))
__attribute__((availability(ios, introduced=11.0, deprecated=12.0)));
-void simpleUsage() {
+void simpleUsage(void) {
explicit(); // expected-warning{{'explicit' is deprecated: first deprecated in tvOS 12.0}}
inferred(); // expected-warning{{'inferred' is deprecated: first deprecated in tvOS 12.0}}
// ok, not deprecated for tvOS.
@@ -19,29 +19,29 @@ void simpleUsage() {
#pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function)
-void explicitFromPragma(); // expected-note {{marked deprecated here}}
-void explicitWinsOverExplicitFromPragma() __attribute__((availability(tvos, introduced=11.0)));
-void implicitLosesOverExplicitFromPragma() __attribute__((availability(ios, introduced=11.0))); // expected-note {{marked deprecated here}}
+void explicitFromPragma(void); // expected-note {{marked deprecated here}}
+void explicitWinsOverExplicitFromPragma(void) __attribute__((availability(tvos, introduced=11.0)));
+void implicitLosesOverExplicitFromPragma(void) __attribute__((availability(ios, introduced=11.0))); // expected-note {{marked deprecated here}}
#pragma clang attribute pop
#pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=12.0))), apply_to=function)
-void implicitFromPragma(); // expected-note {{marked deprecated here}}
-void explicitWinsOverImplicitFromPragma() __attribute__((availability(tvos, introduced=11.0)));
-void implicitWinsOverImplicitFromPragma() __attribute__((availability(ios, introduced=11.0)));
+void implicitFromPragma(void); // expected-note {{marked deprecated here}}
+void explicitWinsOverImplicitFromPragma(void) __attribute__((availability(tvos, introduced=11.0)));
+void implicitWinsOverImplicitFromPragma(void) __attribute__((availability(ios, introduced=11.0)));
#pragma clang attribute pop
#pragma clang attribute push (__attribute__((availability(tvos, introduced=11.0, deprecated=12.0))), apply_to=function)
#pragma clang attribute push (__attribute__((availability(ios, introduced=11.0, deprecated=11.3))), apply_to=function)
-void pragmaExplicitWinsOverPragmaImplicit(); // expected-note {{marked deprecated here}}
+void pragmaExplicitWinsOverPragmaImplicit(void); // expected-note {{marked deprecated here}}
#pragma clang attribute pop
#pragma clang attribute pop
-void pragmaUsage() {
+void pragmaUsage(void) {
explicitFromPragma(); // expected-warning {{'explicitFromPragma' is deprecated: first deprecated in tvOS 12.0}}
explicitWinsOverExplicitFromPragma(); // ok
implicitLosesOverExplicitFromPragma(); // expected-warning {{'implicitLosesOverExplicitFromPragma' is deprecated: first deprecated in tvOS 12.0}}
diff --git a/clang/test/SemaObjC/attr-availability.m b/clang/test/SemaObjC/attr-availability.m
index e3f7a38f5889..a4917e6b78af 100644
--- a/clang/test/SemaObjC/attr-availability.m
+++ b/clang/test/SemaObjC/attr-availability.m
@@ -219,7 +219,7 @@ void partialinter2(PartialI2* p) {
MyEnum_Blah UNAVAILABLE, // expected-note {{'MyEnum_Blah' has been explicitly marked unavailable here}}
} UNAVAILABLE;
-void use_myEnum() {
+void use_myEnum(void) {
// expected-error at +2 {{'MyEnum' is unavailable: not available}}
// expected-error at +1 {{MyEnum_Blah' is unavailable: not available}}
MyEnum e = MyEnum_Blah;
@@ -312,9 +312,9 @@ -(void)method {
#if defined(WARN_PARTIAL)
-int fn_10_5() __attribute__((availability(macosx, introduced=10.5)));
-int fn_10_7() __attribute__((availability(macosx, introduced=10.7))); // expected-note{{'fn_10_7' has been marked as being introduced in macOS 10.7 here, but the deployment target is macOS 10.5}}
-int fn_10_8() __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{'fn_10_8' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5}}
+int fn_10_5(void) __attribute__((availability(macosx, introduced=10.5)));
+int fn_10_7(void) __attribute__((availability(macosx, introduced=10.7))); // expected-note{{'fn_10_7' has been marked as being introduced in macOS 10.7 here, but the deployment target is macOS 10.5}}
+int fn_10_8(void) __attribute__((availability(macosx, introduced=10.8))) { // expected-note{{'fn_10_8' has been marked as being introduced in macOS 10.8 here, but the deployment target is macOS 10.5}}
return fn_10_7();
}
@@ -340,7 +340,7 @@ -(void)method3 { fn_10_8(); } // expected-warning{{only available on macOS 10.8}
-(void)method4 { fn_10_8(); }
@end
-int old_func() __attribute__((availability(macos, introduced=10.4))) {
+int old_func(void) __attribute__((availability(macos, introduced=10.4))) {
fn_10_5();
}
diff --git a/clang/test/SemaObjC/attr-cf_returns.m b/clang/test/SemaObjC/attr-cf_returns.m
index 560d40dc2817..8d5da90472a1 100644
--- a/clang/test/SemaObjC/attr-cf_returns.m
+++ b/clang/test/SemaObjC/attr-cf_returns.m
@@ -15,11 +15,11 @@
typedef struct __CFFoo *CFFooRef;
-int invalid1() CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}}
-void invalid2() CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}}
+int invalid1(void) CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}}
+void invalid2(void) CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to functions that return a pointer}}
-CFFooRef valid1() CF_RETURNS_RETAINED;
-id valid2() CF_RETURNS_RETAINED;
+CFFooRef valid1(void) CF_RETURNS_RETAINED;
+id valid2(void) CF_RETURNS_RETAINED;
@interface Test
- (int)invalid1 CF_RETURNS_RETAINED; // expected-warning{{'cf_returns_retained' attribute only applies to methods that return a pointer}}
diff --git a/clang/test/SemaObjC/attr-cleanup.m b/clang/test/SemaObjC/attr-cleanup.m
index 978498ca64b5..9ee02bfab5a2 100644
--- a/clang/test/SemaObjC/attr-cleanup.m
+++ b/clang/test/SemaObjC/attr-cleanup.m
@@ -5,7 +5,7 @@
void c1(id *a);
-void t1()
+void t1(void)
{
NSString *s __attribute((cleanup(c1)));
}
diff --git a/clang/test/SemaObjC/attr-deprecated.m b/clang/test/SemaObjC/attr-deprecated.m
index 28031997af7a..1a965ab922c0 100644
--- a/clang/test/SemaObjC/attr-deprecated.m
+++ b/clang/test/SemaObjC/attr-deprecated.m
@@ -76,7 +76,7 @@ @interface Bar
- (void) MySetter : (int) value;
@end
-int t5() {
+int t5(void) {
Bar *f;
f.FooBar = 1; // expected-warning {{'FooBar' is deprecated}}
return f.FooBar; // expected-warning {{'FooBar' is deprecated}}
@@ -102,7 +102,7 @@ - (id)meth;
@end
__attribute__((deprecated))
-void depr_function();
+void depr_function(void);
@implementation DEPRECATED (Category2) // no warning
- (id)meth {
@@ -248,7 +248,7 @@ - (const char *)cString __attribute__((availability(macosx,introduced=10.0 ,depr
@end
id PID = 0;
-const char * func() {
+const char * func(void) {
return [PID cString]; // expected-warning {{'cString' is deprecated: first deprecated in macOS 10.4}}
}
diff --git a/clang/test/SemaObjC/attr-malloc.m b/clang/test/SemaObjC/attr-malloc.m
index 0874a476806c..8fe31e28f893 100644
--- a/clang/test/SemaObjC/attr-malloc.m
+++ b/clang/test/SemaObjC/attr-malloc.m
@@ -10,7 +10,7 @@ - (int) test2 __attribute((malloc)); // expected-warning {{attribute only appli
typedef void (^bptr)(void);
bptr baz(void) __attribute((malloc)); // no-warning
-__attribute((malloc)) id (*f)(); // expected-warning {{attribute only applies to functions}}
-__attribute((malloc)) bptr (*g)(); // expected-warning {{attribute only applies to functions}}
-__attribute((malloc)) void *(^h)(); // expected-warning {{attribute only applies to functions}}
+__attribute((malloc)) id (*f)(void); // expected-warning {{attribute only applies to functions}}
+__attribute((malloc)) bptr (*g)(void); // expected-warning {{attribute only applies to functions}}
+__attribute((malloc)) void *(^h)(void); // expected-warning {{attribute only applies to functions}}
diff --git a/clang/test/SemaObjC/attr-ns_returns_retained.m b/clang/test/SemaObjC/attr-ns_returns_retained.m
index 83397a6556cc..6084289b1f83 100644
--- a/clang/test/SemaObjC/attr-ns_returns_retained.m
+++ b/clang/test/SemaObjC/attr-ns_returns_retained.m
@@ -4,15 +4,15 @@
// rdar://20130079
#if __has_feature(objc_arc)
-__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(); // expected-note {{previous definition is here}}
-id (^invalidBlockRedecl)(); //expected-error {{redefinition of 'invalidBlockRedecl' with a
diff erent type: 'id (^__strong)()' vs 'id ((^__strong))() __attribute__((ns_returns_retained))'}}
+__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(void); // expected-note {{previous definition is here}}
+id (^invalidBlockRedecl)(void); //expected-error {{redefinition of 'invalidBlockRedecl' with a
diff erent type: 'id (^__strong)(void)' vs 'id ((^__strong))(void) __attribute__((ns_returns_retained))'}}
#else
-__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)();
-id (^invalidBlockRedecl)();
+__attribute__((ns_returns_retained)) id (^invalidBlockRedecl)(void);
+id (^invalidBlockRedecl)(void);
#endif
-typedef __attribute__((ns_returns_retained)) id (^blockType)();
+typedef __attribute__((ns_returns_retained)) id (^blockType)(void);
-typedef __attribute__((ns_returns_retained)) int (^invalidBlockType)(); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}}
+typedef __attribute__((ns_returns_retained)) int (^invalidBlockType)(void); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}}
-__attribute__((ns_returns_retained)) int functionDecl(); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}}
+__attribute__((ns_returns_retained)) int functionDecl(void); // expected-warning {{'ns_returns_retained' attribute only applies to functions that return an Objective-C object}}
diff --git a/clang/test/SemaObjC/attr-objc-exception.m b/clang/test/SemaObjC/attr-objc-exception.m
index dd8ac573deed..e820ad81c54d 100644
--- a/clang/test/SemaObjC/attr-objc-exception.m
+++ b/clang/test/SemaObjC/attr-objc-exception.m
@@ -12,5 +12,5 @@ @interface NSException {
int X;
__attribute__((__objc_exception__)) // expected-error {{'__objc_exception__' attribute only applies to Objective-C interfaces}}
-void foo();
+void foo(void);
diff --git a/clang/test/SemaObjC/attr-objc-non-lazy.m b/clang/test/SemaObjC/attr-objc-non-lazy.m
index bbbbd741455f..f0f8fffceb9a 100644
--- a/clang/test/SemaObjC/attr-objc-non-lazy.m
+++ b/clang/test/SemaObjC/attr-objc-non-lazy.m
@@ -25,7 +25,7 @@ @protocol B
@end
__attribute__((objc_nonlazy_class)) // expected-error {{'objc_nonlazy_class' attribute only applies to Objective-C interfaces}}
-void foo();
+void foo(void);
@interface E
@end
diff --git a/clang/test/SemaObjC/attr-root-class.m b/clang/test/SemaObjC/attr-root-class.m
index 6be1c09d4dc7..1edee0b005f4 100644
--- a/clang/test/SemaObjC/attr-root-class.m
+++ b/clang/test/SemaObjC/attr-root-class.m
@@ -11,7 +11,7 @@ @interface NonRootClass : RootClass // expected-error {{objc_root_class attrib
@implementation NonRootClass
@end
-__attribute__((objc_root_class)) static void nonClassDeclaration() // expected-error {{'objc_root_class' attribute only applies to Objective-C interfaces}}
+__attribute__((objc_root_class)) static void nonClassDeclaration(void) // expected-error {{'objc_root_class' attribute only applies to Objective-C interfaces}}
{
}
diff --git a/clang/test/SemaObjC/attr-swift-async-error.m b/clang/test/SemaObjC/attr-swift-async-error.m
index 7a608b24682b..9d1a5c722c52 100644
--- a/clang/test/SemaObjC/attr-swift-async-error.m
+++ b/clang/test/SemaObjC/attr-swift-async-error.m
@@ -43,15 +43,15 @@
ASYNC(swift_private, 1)
ASYNC_ERROR(none)
-void test_none(void (^)());
+void test_none(void (^)(void));
ASYNC(none)
ASYNC_ERROR(none)
-void test_double_none(void (^)());
+void test_double_none(void (^)(void));
ASYNC(none)
ASYNC_ERROR(none, 1) // expected-error {{'swift_async_error' attribute takes one argument}}
-void test_double_none_args();
+void test_double_none_args(void);
ASYNC(swift_private, 1)
ASYNC_ERROR(nonnull_error, 1) // expected-error{{'swift_async_error' attribute takes one argument}}
diff --git a/clang/test/SemaObjC/attr-swift-async.m b/clang/test/SemaObjC/attr-swift-async.m
index 729c19f7612a..4e69becc1464 100644
--- a/clang/test/SemaObjC/attr-swift-async.m
+++ b/clang/test/SemaObjC/attr-swift-async.m
@@ -5,24 +5,24 @@
SA(none) int a; // expected-warning{{'swift_async' attribute only applies to functions and Objective-C methods}}
-SA(none) void b();
+SA(none) void b(void);
-SA(not_swift_private, 0) void c(); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
-SA(swift_private, 1) void d(); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
+SA(not_swift_private, 0) void c(void); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
+SA(swift_private, 1) void d(void); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
SA(swift_private, 1) void e(int); // expected-error{{'swift_async' completion handler parameter must have block type returning 'void', type here is 'int'}}
-SA(not_swift_private, 1) void f(int (^)()); // expected-error{{'swift_async' completion handler parameter must have block type returning 'void', type here is 'int (^)()'}}
-SA(swift_private, 1) void g(void (^)());
+SA(not_swift_private, 1) void f(int (^)(void)); // expected-error-re{{'swift_async' completion handler parameter must have block type returning 'void', type here is 'int (^)({{(void)?}})'}}
+SA(swift_private, 1) void g(void (^)(void));
-SA(none, 1) void h(); // expected-error{{'swift_async' attribute takes one argument}}
-SA() void i(); // expected-error{{'swift_async' attribute takes at least 1 argument}}
-SA(not_swift_private) void j(); // expected-error{{'swift_async' attribute requires exactly 2 arguments}}
-SA(43) void k(); // expected-error{{'swift_async' attribute requires parameter 1 to be an identifier}}
-SA(not_a_thing, 0) void l(); // expected-error{{first argument to 'swift_async' must be either 'none', 'swift_private', or 'not_swift_private'}}
+SA(none, 1) void h(void); // expected-error{{'swift_async' attribute takes one argument}}
+SA() void i(void); // expected-error{{'swift_async' attribute takes at least 1 argument}}
+SA(not_swift_private) void j(void); // expected-error{{'swift_async' attribute requires exactly 2 arguments}}
+SA(43) void k(void); // expected-error{{'swift_async' attribute requires parameter 1 to be an identifier}}
+SA(not_a_thing, 0) void l(void); // expected-error{{first argument to 'swift_async' must be either 'none', 'swift_private', or 'not_swift_private'}}
@interface TestOnMethods
--(void)m1:(int (^)())callback SA(swift_private, 1); // expected-error{{'swift_async' completion handler parameter must have block type returning 'void', type here is 'int (^)()'}}
--(void)m2:(void (^)())callback SA(swift_private, 0); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
--(void)m3:(void (^)())callback SA(swift_private, 2); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
+-(void)m1:(int (^)(void))callback SA(swift_private, 1); // expected-error-re{{'swift_async' completion handler parameter must have block type returning 'void', type here is 'int (^)({{(void)?}})'}}
+-(void)m2:(void (^)(void))callback SA(swift_private, 0); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
+-(void)m3:(void (^)(void))callback SA(swift_private, 2); // expected-error{{'swift_async' attribute parameter 2 is out of bounds}}
-(void)m4 SA(none);
-(void)m5:(int)p handler:(void (^)(int))callback SA(not_swift_private, 2);
@end
diff --git a/clang/test/SemaObjC/autoreleasepool.m b/clang/test/SemaObjC/autoreleasepool.m
index c88f1bacca63..5e4627330e98 100644
--- a/clang/test/SemaObjC/autoreleasepool.m
+++ b/clang/test/SemaObjC/autoreleasepool.m
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
-void *objc_autoreleasepool_push();
+void *objc_autoreleasepool_push(void);
void autoreleasepool_pop(void*);
@interface AUTORP @end
diff --git a/clang/test/SemaObjC/bad-receiver-1.m b/clang/test/SemaObjC/bad-receiver-1.m
index fe7f7f5b4467..8ccf61f374ba 100644
--- a/clang/test/SemaObjC/bad-receiver-1.m
+++ b/clang/test/SemaObjC/bad-receiver-1.m
@@ -6,13 +6,13 @@ - (id) retain;
int objc_lookUpClass(const char*);
-void __raiseExc1() {
+void __raiseExc1(void) {
[objc_lookUpClass("NSString") retain]; // expected-warning {{receiver type 'int' is not 'id'}}
}
typedef const struct __CFString * CFStringRef;
-void func() {
+void func(void) {
CFStringRef obj;
[obj self]; // expected-warning {{receiver type 'CFStringRef' (aka 'const struct __CFString *') is not 'id'}} \\
diff --git a/clang/test/SemaObjC/block-capture-unused-variable.m b/clang/test/SemaObjC/block-capture-unused-variable.m
index 1d40d9fb106b..272c3bef493a 100644
--- a/clang/test/SemaObjC/block-capture-unused-variable.m
+++ b/clang/test/SemaObjC/block-capture-unused-variable.m
@@ -8,7 +8,7 @@
extern __attribute__((visibility("default"))) struct dispatch_queue_s _dispatch_main_q;
-id getFoo();
+id getFoo(void);
@protocol P
@@ -18,7 +18,7 @@ @interface I
@end
-void test() {
+void test(void) {
// no diagnostics
__block id x = getFoo();
__block id<P> y = x;
diff --git a/clang/test/SemaObjC/block-explicit-return-type.m b/clang/test/SemaObjC/block-explicit-return-type.m
index 22e5b6f75106..94211e8fb7d5 100644
--- a/clang/test/SemaObjC/block-explicit-return-type.m
+++ b/clang/test/SemaObjC/block-explicit-return-type.m
@@ -19,7 +19,7 @@ - (id) some_method_that_returns_id;
typedef double (^myblock)(int);
double test(myblock I);
-int main() {
+int main(void) {
__block int x = 1;
__block int y = 2;
@@ -51,7 +51,7 @@ int main() {
double res = test(^(int z){x = y+z; return (double)z; });
}
-void func() {
+void func(void) {
completion_block_t X;
completion_block_t (^blockx)(dispatch_item_t) = ^completion_block_t (dispatch_item_t item) {
@@ -69,7 +69,7 @@ void func() {
// intent: block taking int returning block that takes char,int and returns int
int (^(^block)(double x))(char, short);
-void foo() {
+void foo(void) {
int one = 1;
block = ^(double x){ return ^(char c, short y) { return one + c + y; };}; // expected-error {{returning block that lives on the local stack}}
// or:
diff --git a/clang/test/SemaObjC/block-id-as-block-argtype.m b/clang/test/SemaObjC/block-id-as-block-argtype.m
index 20bb6adec327..e3a97fb900c4 100644
--- a/clang/test/SemaObjC/block-id-as-block-argtype.m
+++ b/clang/test/SemaObjC/block-id-as-block-argtype.m
@@ -11,7 +11,7 @@
void another_fn(block2_t arg);
-int main() {
+int main(void) {
block1_t b1;
block2_t b2;
block3_t b3;
diff --git a/clang/test/SemaObjC/block-omitted-return-type.m b/clang/test/SemaObjC/block-omitted-return-type.m
index 93d5e05ea282..f4ab4628013f 100644
--- a/clang/test/SemaObjC/block-omitted-return-type.m
+++ b/clang/test/SemaObjC/block-omitted-return-type.m
@@ -10,32 +10,32 @@ - (void)test;
@implementation Test
- (void)test
{
- void (^simpleBlock)() = ^ _Nonnull { //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
+ void (^simpleBlock)(void) = ^ _Nonnull { //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
return;
};
- void (^simpleBlock2)() = ^ _Nonnull void { //expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'void'}}
+ void (^simpleBlock2)(void) = ^ _Nonnull void { //expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'void'}}
return;
};
- void (^simpleBlock3)() = ^ _Nonnull (void) { //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
+ void (^simpleBlock3)(void) = ^ _Nonnull (void) { //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
return;
};
- void (^simpleBlock4)() = ^ const { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
+ void (^simpleBlock4)(void) = ^ const { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
return;
};
- void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible block pointer types initializing 'void (^)()' with an expression of type 'const void (^)(void)'}}
+ void (^simpleBlock5)(void) = ^ const void { //expected-error {{incompatible block pointer types initializing 'void (^)(void)' with an expression of type 'const void (^)(void)'}}
return; // expected-warning at -1 {{function cannot return qualified void type 'const void'}}
};
- void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
+ void (^simpleBlock6)(void) = ^ const (void) { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
return;
};
- void (^simpleBlock7)() = ^ _Nonnull __attribute__((align_value(128))) _Nullable const (void) { // expected-warning {{attribute '_Nullable' ignored, because it cannot be applied to omitted return type}} \
+ void (^simpleBlock7)(void) = ^ _Nonnull __attribute__((align_value(128))) _Nullable const (void) { // expected-warning {{attribute '_Nullable' ignored, because it cannot be applied to omitted return type}} \
// expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}} \
// expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}} \
// expected-warning {{'align_value' attribute only applies to variables and typedefs}}
return;
};
- void (^simpleBlock9)() = ^ __attribute__ ((align_value(128))) _Nonnull const (void) { // expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}} \
+ void (^simpleBlock9)(void) = ^ __attribute__ ((align_value(128))) _Nonnull const (void) { // expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}} \
// expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}} \
// expected-warning {{'align_value' attribute only applies to variables and typedefs}}
return;
diff --git a/clang/test/SemaObjC/block-return.m b/clang/test/SemaObjC/block-return.m
index e0bac996d80a..1c2d9f6d0e86 100644
--- a/clang/test/SemaObjC/block-return.m
+++ b/clang/test/SemaObjC/block-return.m
@@ -6,8 +6,8 @@ @interface NSString
- (__attribute__((objc_gc(strong))) const char *)UTF8String;
@end
-int main() {
-__attribute__((objc_gc(strong))) char const *(^libraryNameForIndex)() = ^() {
+int main(void) {
+__attribute__((objc_gc(strong))) char const *(^libraryNameForIndex)(void) = ^(void) {
NSString *moduleName;
return [moduleName UTF8String];
};
diff --git a/clang/test/SemaObjC/block-type-safety.m b/clang/test/SemaObjC/block-type-safety.m
index 4a5a1dd344f0..a587dd10db5f 100644
--- a/clang/test/SemaObjC/block-type-safety.m
+++ b/clang/test/SemaObjC/block-type-safety.m
@@ -16,11 +16,11 @@ void f3(void(^f)(Sub *)) {
f(o);
}
-void r0(Super* (^f)()) {
+void r0(Super* (^f)(void)) {
Super *o = f();
}
-void r1(Sub* (^f)()) { // expected-note{{passing argument to parameter 'f' here}}
+void r1(Sub* (^f)(void)) { // expected-note{{passing argument to parameter 'f' here}}
Sub *o = f();
}
@@ -31,19 +31,19 @@ void r2 (id<NSObject> (^f) (void)) {
id o = f();
}
-void test1() {
+void test1(void) {
f2(^(Sub *o) { }); // expected-error {{incompatible block pointer types passing}}
f3(^(Super *o) { }); // OK, block taking Super* may be called with a Sub*
- r0(^Super* () { return 0; }); // OK
- r0(^Sub* () { return 0; }); // OK, variable of type Super* gets return value of type Sub*
- r0(^id () { return 0; });
+ r0(^Super* (void) { return 0; }); // OK
+ r0(^Sub* (void) { return 0; }); // OK, variable of type Super* gets return value of type Sub*
+ r0(^id (void) { return 0; });
- r1(^Super* () { return 0; }); // expected-error {{incompatible block pointer types passing}}
- r1(^Sub* () { return 0; }); // OK
- r1(^id () { return 0; });
+ r1(^Super* (void) { return 0; }); // expected-error {{incompatible block pointer types passing}}
+ r1(^Sub* (void) { return 0; }); // OK
+ r1(^id (void) { return 0; });
- r2(^id<NSObject>() { return 0; });
+ r2(^id<NSObject>(void) { return 0; });
}
@@ -103,7 +103,7 @@ void f4(void (^f)(id<P> x)) { // expected-note{{passing argument to parameter 'f
f(b); // expected-warning {{passing 'NSArray<P2> *' to parameter of incompatible type 'id<P>'}}
}
-void test3() {
+void test3(void) {
f4(^(NSArray<P2>* a) { }); // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)' to parameter of type 'void (^)(id<P>)'}}
}
@@ -117,8 +117,8 @@ @interface Baz(FooConformance) <Foo>
@implementation Baz @end
-int test4 () {
- id <Foo> (^b)() = ^{ // Doesn't work
+int test4 (void) {
+ id <Foo> (^b)(void) = ^{ // Doesn't work
return (Baz *)0;
};
return 0;
@@ -135,7 +135,7 @@ @interface NSAllArray (FooConformance) <Foo>
@end
#ifndef COMPATIBILITY_QUALIFIED_ID_TYPE_CHECKING
-int test5() {
+int test5(void) {
// Returned value is used outside of a block, so error on changing
// a return type to a more general than expected.
NSAllArray *(^block)(id);
@@ -158,7 +158,7 @@ int test5() {
// explained in non-compatibility test above, it is not safe in general. But
// to keep existing code working we support a compatibility mode that uses
// previous type checking.
-int test5() {
+int test5(void) {
NSAllArray *(^block)(id);
id <Foo> (^genericBlock)(id);
genericBlock = block;
@@ -183,7 +183,7 @@ @interface radar10798770
- (void)sortUsingComparator:(NSComparator)c;
@end
-void f() {
+void f(void) {
radar10798770 *f;
[f sortUsingComparator:^(id a, id b) {
return NSOrderedSame;
@@ -194,41 +194,41 @@ void f() {
@protocol P1 @end
@protocol P2 @end
-void Test() {
-void (^aBlock)();
+void Test(void) {
+void (^aBlock)(void);
id anId = aBlock; // OK
-id<P1,P2> anQualId = aBlock; // expected-error {{initializing 'id<P1,P2>' with an expression of incompatible type 'void (^)()'}}
+id<P1,P2> anQualId = aBlock; // expected-error {{initializing 'id<P1,P2>' with an expression of incompatible type 'void (^)(void)'}}
-NSArray* anArray = aBlock; // expected-error {{initializing 'NSArray *' with an expression of incompatible type 'void (^)()'}}
+NSArray* anArray = aBlock; // expected-error {{initializing 'NSArray *' with an expression of incompatible type 'void (^)(void)'}}
aBlock = anId; // OK
id<P1,P2> anQualId1;
-aBlock = anQualId1; // expected-error {{assigning to 'void (^)()' from incompatible type 'id<P1,P2>'}}
+aBlock = anQualId1; // expected-error {{assigning to 'void (^)(void)' from incompatible type 'id<P1,P2>'}}
NSArray* anArray1;
-aBlock = anArray1; // expected-error {{assigning to 'void (^)()' from incompatible type 'NSArray *'}}
+aBlock = anArray1; // expected-error {{assigning to 'void (^)(void)' from incompatible type 'NSArray *'}}
}
-void Test2() {
- void (^aBlock)();
+void Test2(void) {
+ void (^aBlock)(void);
id<NSObject> anQualId1 = aBlock; // Ok
id<NSObject, NSCopying> anQualId2 = aBlock; // Ok
id<NSObject, NSCopying, NSObject, NSCopying> anQualId3 = aBlock; // Ok
- id <P1> anQualId4 = aBlock; // expected-error {{initializing 'id<P1>' with an expression of incompatible type 'void (^)()'}}
- id<NSObject, P1, NSCopying> anQualId5 = aBlock; // expected-error {{initializing 'id<NSObject,P1,NSCopying>' with an expression of incompatible type 'void (^)()'}}
+ id <P1> anQualId4 = aBlock; // expected-error {{initializing 'id<P1>' with an expression of incompatible type 'void (^)(void)'}}
+ id<NSObject, P1, NSCopying> anQualId5 = aBlock; // expected-error {{initializing 'id<NSObject,P1,NSCopying>' with an expression of incompatible type 'void (^)(void)'}}
id<NSCopying> anQualId6 = aBlock; // Ok
}
-void Test3() {
- void (^aBlock)();
+void Test3(void) {
+ void (^aBlock)(void);
NSObject *NSO = aBlock; // Ok
NSObject<NSObject> *NSO1 = aBlock; // Ok
NSObject<NSObject, NSCopying> *NSO2 = aBlock; // Ok
NSObject<NSObject, NSCopying, NSObject, NSCopying> *NSO3 = aBlock; // Ok
- NSObject <P1> *NSO4 = aBlock; // expected-error {{initializing 'NSObject<P1> *' with an expression of incompatible type 'void (^)()'}}
- NSObject<NSObject, P1, NSCopying> *NSO5 = aBlock; // expected-error {{initializing 'NSObject<NSObject,P1,NSCopying> *' with an expression of incompatible type 'void (^)()'}}
+ NSObject <P1> *NSO4 = aBlock; // expected-error {{initializing 'NSObject<P1> *' with an expression of incompatible type 'void (^)(void)'}}
+ NSObject<NSObject, P1, NSCopying> *NSO5 = aBlock; // expected-error {{initializing 'NSObject<NSObject,P1,NSCopying> *' with an expression of incompatible type 'void (^)(void)'}}
NSObject<NSCopying> *NSO6 = aBlock; // Ok
}
diff --git a/clang/test/SemaObjC/boxing-illegal.m b/clang/test/SemaObjC/boxing-illegal.m
index 44938192887a..87e9e5e86e50 100644
--- a/clang/test/SemaObjC/boxing-illegal.m
+++ b/clang/test/SemaObjC/boxing-illegal.m
@@ -28,19 +28,19 @@ + (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value;
int x, y, z;
} point;
-void testStruct() {
+void testStruct(void) {
point p = { 0, 0, 0 };
id boxed = @(p); // expected-error {{illegal type 'point' used in a boxed expression}}
}
-void testPointers() {
+void testPointers(void) {
void *null = 0;
id boxed_null = @(null); // expected-error {{illegal type 'void *' used in a boxed expression}}
int numbers[] = { 0, 1, 2 };
id boxed_numbers = @(numbers); // expected-error {{illegal type 'int *' used in a boxed expression}}
}
-void testInvalid() {
+void testInvalid(void) {
@(not_defined); // expected-error {{use of undeclared identifier 'not_defined'}}
}
@@ -60,7 +60,7 @@ void testEnum(void *p) {
@interface NSString
@end
-void testStringLiteral() {
+void testStringLiteral(void) {
NSString *s;
s = @("abc");
s = @(u8"abc");
diff --git a/clang/test/SemaObjC/builtin_objc_lib_functions.m b/clang/test/SemaObjC/builtin_objc_lib_functions.m
index 2496bf2b1cf7..a884038487ab 100644
--- a/clang/test/SemaObjC/builtin_objc_lib_functions.m
+++ b/clang/test/SemaObjC/builtin_objc_lib_functions.m
@@ -1,10 +1,10 @@
// RUN: %clang_cc1 -x objective-c %s -fsyntax-only -verify
// rdar://8592641
-Class f0() { return objc_getClass("a"); } // expected-warning {{implicitly declaring library function 'objc_getClass' with type 'id (const char *)'}} \
+Class f0(void) { return objc_getClass("a"); } // expected-warning {{implicitly declaring library function 'objc_getClass' with type 'id (const char *)'}} \
// expected-note {{include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getClass'}}
// rdar://8735023
-Class f1() { return objc_getMetaClass("a"); } // expected-warning {{implicitly declaring library function 'objc_getMetaClass' with type 'id (const char *)'}} \
+Class f1(void) { return objc_getMetaClass("a"); } // expected-warning {{implicitly declaring library function 'objc_getMetaClass' with type 'id (const char *)'}} \
// expected-note {{include the header <objc/runtime.h> or explicitly provide a declaration for 'objc_getMetaClass'}}
void f2(id val) { objc_enumerationMutation(val); } // expected-warning {{implicitly declaring library function 'objc_enumerationMutation' with type 'void (id)'}} \
diff --git a/clang/test/SemaObjC/call-unavailable-init-in-self.m b/clang/test/SemaObjC/call-unavailable-init-in-self.m
index 48fc2326af45..078f485f616b 100644
--- a/clang/test/SemaObjC/call-unavailable-init-in-self.m
+++ b/clang/test/SemaObjC/call-unavailable-init-in-self.m
@@ -69,7 +69,7 @@ - (void)subClassContext {
@end
-void unrelatedContext() {
+void unrelatedContext(void) {
(void)[[Sub alloc] init]; // expected-error {{'init' is unavailable}}
(void)[Sub new]; // expected-error {{'new' is unavailable}}
}
diff --git a/clang/test/SemaOpenCL/array-init.cl b/clang/test/SemaOpenCL/array-init.cl
index c2cc5e686960..59424ff6d664 100644
--- a/clang/test/SemaOpenCL/array-init.cl
+++ b/clang/test/SemaOpenCL/array-init.cl
@@ -11,8 +11,8 @@ __kernel void k2(read_only pipe int p) {
reserve_id_t i[] = {i1, i2};
}
-event_t create_event();
-__kernel void k3() {
+event_t create_event(void);
+__kernel void k3(void) {
event_t e1 = create_event();
event_t e2 = create_event();
event_t e[] = {e1, e2};
diff --git a/clang/test/SemaOpenCL/block-array-capturing.cl b/clang/test/SemaOpenCL/block-array-capturing.cl
index 6ad4d1e493af..ced16b7bb159 100644
--- a/clang/test/SemaOpenCL/block-array-capturing.cl
+++ b/clang/test/SemaOpenCL/block-array-capturing.cl
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -O0 -cl-std=CL2.0 -triple spir64-unknown-unknown -emit-llvm %s -o -| FileCheck %s
// expected-no-diagnostics
-typedef int (^block_t)();
+typedef int (^block_t)(void);
int block_typedef_kernel(global int* res) {
// CHECK: %{{.*}} = alloca <{ i32, i32, i8 addrspace(4)*, [3 x i32] }>
int a[3] = {1, 2, 3};
// CHECK: call void @llvm.memcpy{{.*}}
- block_t b = ^() { return a[0]; };
+ block_t b = ^(void) { return a[0]; };
return b();
}
diff --git a/clang/test/SemaOpenCL/invalid-block.cl b/clang/test/SemaOpenCL/invalid-block.cl
index dfa0726e1315..ddc0f80d1da4 100644
--- a/clang/test/SemaOpenCL/invalid-block.cl
+++ b/clang/test/SemaOpenCL/invalid-block.cl
@@ -1,27 +1,27 @@
// RUN: %clang_cc1 -verify -fblocks -cl-std=CL2.0 %s
// RUN: %clang_cc1 -verify -fblocks -cl-std=CL3.0 -cl-ext=-all,+__opencl_c_device_enqueue,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables %s
// OpenCL v2.0 s6.12.5
-void f0(int (^const bl)()); // expected-error{{declaring function parameter of type 'int (__generic ^const __private)(void)' is not allowed}}
+void f0(int (^const bl)(void)); // expected-error{{declaring function parameter of type 'int (__generic ^const __private)(void)' is not allowed}}
// All blocks declarations must be const qualified and initialized.
-void f1() {
- int (^bl1)(void) = ^() {
+void f1(void) {
+ int (^bl1)(void) = ^(void) {
return 1;
};
- int (^const bl2)(void) = ^() {
+ int (^const bl2)(void) = ^(void) {
return 1;
};
f0(bl1);
f0(bl2);
bl1 = bl2; // expected-error{{invalid operands to binary expression ('int (__generic ^const __private)(void)' and 'int (__generic ^const __private)(void)')}}
- int (^const bl3)(); // expected-error{{invalid block variable declaration - must be initialized}}
+ int (^const bl3)(void); // expected-error{{invalid block variable declaration - must be initialized}}
}
// A block with extern storage class is not allowed.
-extern int (^bl)(void) = ^() { // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+extern int (^bl)(void) = ^(void) { // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
return 1;
};
void f2() {
- extern int (^bl)(void) = ^() { // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
+ extern int (^bl)(void) = ^(void) { // expected-error{{invalid block variable declaration - using 'extern' storage class is disallowed}}
return 1;
};
}
@@ -32,9 +32,9 @@ bl_t f3a(int); // expected-error{{declaring function return value of type 'b
bl_t f3b(bl_t bl);
// expected-error at -1{{declaring function return value of type 'bl_t' (aka 'int (__generic ^const)(void)') is not allowed}}
// expected-error at -2{{declaring function parameter of type '__private bl_t' (aka 'int (__generic ^const __private)(void)') is not allowed}}
-void f3c() {
+void f3c(void) {
// Block with a block argument.
- int (^const bl2)(bl_t block_arg) = ^() { // expected-error{{declaring function parameter of type '__private bl_t' (aka 'int (__generic ^const __private)(void)') is not allowed}}
+ int (^const bl2)(bl_t block_arg) = ^(void) { // expected-error{{declaring function parameter of type '__private bl_t' (aka 'int (__generic ^const __private)(void)') is not allowed}}
return block_arg(); // expected-error{{implicit declaration of function 'block_arg' is invalid in OpenCL}}
};
}
@@ -76,7 +76,7 @@ void f6(bl2_t *bl_ptr) { // expected-error{{pointer to type 'bl2_t' (aka 'int (_
&bl; // expected-error {{invalid argument type '__private bl2_t' (aka 'int (__generic ^const __private)(__private int)') to unary expression}}
}
// A block can't reference another block
-kernel void f7() {
+kernel void f7(void) {
bl2_t bl1 = ^(int i) {
return 1;
};
diff --git a/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl b/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
index 0493bc61c51e..9958c429ba1f 100644
--- a/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
+++ b/clang/test/SemaOpenCL/invalid-pipes-cl2.0.cl
@@ -8,7 +8,7 @@
global pipe int gp; // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
-extern pipe write_only int get_pipe(); // expected-error {{'write_only' attribute only applies to parameters and typedefs}}
+extern pipe write_only int get_pipe(void); // expected-error {{'write_only' attribute only applies to parameters and typedefs}}
#if (__OPENCL_CPP_VERSION__ == 100) || (__OPENCL_C_VERSION__ == 200) || ((__OPENCL_CPP_VERSION__ == 202100 || __OPENCL_C_VERSION__ == 300) && defined(__opencl_c_program_scope_global_variables))
// expected-error-re at -2{{type '__global write_only pipe int ({{(void)?}})' can only be used as a function parameter in OpenCL}}
#else
@@ -25,7 +25,7 @@ void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}}
}
void test3(int pipe p) {// expected-error {{cannot combine with previous 'int' declaration specifier}}
}
-void test4() {
+void test4(void) {
pipe int p; // expected-error {{type '__private read_only pipe int' can only be used as a function parameter}}
//TODO: fix parsing of this pipe int (*p);
}
@@ -38,7 +38,7 @@ void test5(pipe int p) {
}
typedef pipe int pipe_int_t;
-pipe_int_t test6() {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}}
+pipe_int_t test6(void) {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}}
bool test_id_comprision(void) {
reserve_id_t id1, id2;
diff --git a/clang/test/SemaOpenCL/nosvm.cl b/clang/test/SemaOpenCL/nosvm.cl
index b1ca9bc94635..a29624d316ab 100644
--- a/clang/test/SemaOpenCL/nosvm.cl
+++ b/clang/test/SemaOpenCL/nosvm.cl
@@ -13,7 +13,7 @@ kernel void f(__attribute__((nosvm)) global int* a);
// expected-error at -6 {{attribute 'nosvm' is supported in the OpenCL version 2.0 onwards}}
#endif
-__attribute__((nosvm)) void g(); // expected-warning {{'nosvm' attribute only applies to variables}}
+__attribute__((nosvm)) void g(void); // expected-warning {{'nosvm' attribute only applies to variables}}
#else
void f(__attribute__((nosvm)) int* a); // expected-warning {{'nosvm' attribute ignored}}
diff --git a/clang/test/SemaOpenCL/null_queue.cl b/clang/test/SemaOpenCL/null_queue.cl
index a0b33d48dbf7..a74082f77285 100644
--- a/clang/test/SemaOpenCL/null_queue.cl
+++ b/clang/test/SemaOpenCL/null_queue.cl
@@ -1,21 +1,21 @@
// RUN: %clang_cc1 %s -cl-std=CL2.0 -verify -pedantic -fsyntax-only
-extern queue_t get_default_queue();
+extern queue_t get_default_queue(void);
void queue_arg(queue_t); // expected-note {{passing argument to parameter here}}
-void init() {
+void init(void) {
queue_t q1 = 1; // expected-error{{initializing '__private queue_t' with an expression of incompatible type 'int'}}
queue_t q = 0;
}
-void assign() {
+void assign(void) {
queue_t q2, q3;
q2 = 5; // expected-error{{assigning to '__private queue_t' from incompatible type 'int'}}
q3 = 0;
q2 = q3 = 0;
}
-bool compare() {
+bool compare(void) {
queue_t q4, q5;
return 1 == get_default_queue() && // expected-error{{invalid operands to binary expression ('int' and 'queue_t')}}
get_default_queue() == 1 && // expected-error{{invalid operands to binary expression ('queue_t' and 'int')}}
@@ -24,7 +24,7 @@ bool compare() {
q4 != 0.0f; // expected-error{{invalid operands to binary expression ('__private queue_t' and 'float')}}
}
-void call() {
+void call(void) {
queue_arg(5); // expected-error {{passing 'int' to parameter of incompatible type 'queue_t'}}
queue_arg(0);
}
More information about the cfe-commits
mailing list