diff --git a/clang/test/ARCMT/autoreleases.m b/clang/test/ARCMT/autoreleases.m index 4c268c09a715c..7c046dc227a06 100644 --- a/clang/test/ARCMT/autoreleases.m +++ b/clang/test/ARCMT/autoreleases.m @@ -69,7 +69,7 @@ id test2(A* val) { return val; } -id test3(void) { +void test3(void) { id a = [[A alloc] init]; [a autorelease]; } diff --git a/clang/test/ARCMT/autoreleases.m.result b/clang/test/ARCMT/autoreleases.m.result index b3aad804a45be..29d00ea60deed 100644 --- a/clang/test/ARCMT/autoreleases.m.result +++ b/clang/test/ARCMT/autoreleases.m.result @@ -64,6 +64,6 @@ id test2(A* val) { return val; } -id test3(void) { +void test3(void) { id a = [[A alloc] init]; } diff --git a/clang/test/ARCMT/retains.m b/clang/test/ARCMT/retains.m index 43a94fc16cecf..a38efe1596403 100644 --- a/clang/test/ARCMT/retains.m +++ b/clang/test/ARCMT/retains.m @@ -21,7 +21,7 @@ @implementation Foo @synthesize bar; --(id)something {} +-(id)something { return (id)0; } -(id)test:(id)obj { id x = self.bar; diff --git a/clang/test/ARCMT/retains.m.result b/clang/test/ARCMT/retains.m.result index 4e720d6bb4c11..cd3bb3848fcec 100644 --- a/clang/test/ARCMT/retains.m.result +++ b/clang/test/ARCMT/retains.m.result @@ -21,7 +21,7 @@ id IhaveSideEffect(void); @synthesize bar; --(id)something {} +-(id)something { return (id)0; } -(id)test:(id)obj { id x = self.bar; diff --git a/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp index 1b385e0fc3331..854d12b4cdba6 100644 --- a/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp +++ b/clang/test/AST/ast-dump-cxx2b-deducing-this.cpp @@ -5,7 +5,7 @@ struct S { int f(this S&); }; -int main() { +void main() { S s; int x = s.f(); // CHECK: CallExpr 0x{{[^ ]*}} 'int diff --git a/clang/test/AST/ast-dump-special-member-functions.cpp b/clang/test/AST/ast-dump-special-member-functions.cpp index b98c90f676043..0fe2cee615c82 100644 --- a/clang/test/AST/ast-dump-special-member-functions.cpp +++ b/clang/test/AST/ast-dump-special-member-functions.cpp @@ -253,25 +253,25 @@ struct TrivialCopyAssignment { struct NontrivialCopyAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition // CHECK: CopyAssignment {{.*}}non_trivial{{.*}} - NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {} + NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) { return *this; } }; struct CopyAssignmentHasConstParam { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition // CHECK: CopyAssignment {{.*}}has_const_param{{.*}} - CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {} + CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) { return *this; } }; struct CopyAssignmentDoesNotHaveConstParam { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition // CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}} - CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {} + CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) { return *this; } }; struct UserDeclaredCopyAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition // CHECK: CopyAssignment {{.*}}user_declared{{.*}} - UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {} + UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) { return *this; } }; struct NonUserDeclaredCopyAssignment { @@ -288,7 +288,7 @@ struct NeedsImplicitCopyAssignment { struct DoesNotNeedImplicitCopyAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition // CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}} - DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {} + DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) { return *this; } }; struct DeclaresCopyAssignment { @@ -352,13 +352,13 @@ struct TrivialMoveAssignment { struct NontrivialMoveAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition // CHECK: MoveAssignment {{.*}}non_trivial{{.*}} - NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {} + NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) { return *this; } }; struct UserDeclaredMoveAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition // CHECK: MoveAssignment {{.*}}user_declared{{.*}} - UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {} + UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) { return *this; } }; struct NonUserDeclaredMoveAssignment { @@ -375,7 +375,7 @@ struct NeedsImplicitMoveAssignment { struct DoesNotNeedImplicitMoveAssignment { // CHECK: CXXRecordDecl 0x{{[^ ]*}} line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition // CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}} - DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {} + DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) { return *this; } }; struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor { diff --git a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist index 32244329c434a..8b8cc3239bd4b 100644 --- a/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist +++ b/clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist @@ -6151,7 +6151,7 @@ typeArgument with 'nonnull' attribute passed null check_namecore.NonNullParamChecker - issue_hash_content_of_line_in_contextc0b359a043c633f1b8d1581f68743361 + issue_hash_content_of_line_in_context4c580a2a9cf15947fa485a0a9e625306 issue_context_kindfunction issue_contextRDar13295437 issue_hash_function_offset3 diff --git a/clang/test/Analysis/const-method-call.cpp b/clang/test/Analysis/const-method-call.cpp index 7da7ca5554a23..b37ce17447bdd 100644 --- a/clang/test/Analysis/const-method-call.cpp +++ b/clang/test/Analysis/const-method-call.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s +// RUN: %clang_analyze_cc1 -Wno-error=return-type -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s void clang_analyzer_eval(bool); diff --git a/clang/test/Analysis/inline-unique-reports.c b/clang/test/Analysis/inline-unique-reports.c index e58870ea74ab8..306e314a94e43 100644 --- a/clang/test/Analysis/inline-unique-reports.c +++ b/clang/test/Analysis/inline-unique-reports.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -o %t > /dev/null 2>&1 +// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -Wno-error=return-type -o %t > /dev/null 2>&1 // RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-unique-reports.c.plist - static inline bug(int *p) { diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index f2f8975b5f0e2..0dc667bc1ed50 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -1914,8 +1914,8 @@ variable 'buf', which is not memory allocated by 'malloc()' [unix.Malloc]}} (*crash_a)(); // expected-warning{{type specifier missing}} // A CallEvent without a corresponding FunctionDecl. -crash_b() { crash_a(); } // no-crash -// expected-warning@-1{{type specifier missing}} expected-warning@-1{{non-void}} +crash_b() { crash_a(); return 0; } // no-crash +// expected-warning@-1{{type specifier missing}} long *global_a; void realloc_crash(void) { diff --git a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m index bfc3cb92b639a..300337e3b977f 100644 --- a/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m +++ b/clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m @@ -1,8 +1,8 @@ -// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1 +// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1 // RUN: FileCheck -input-file=%t.1 -check-prefix=CHECK-darwin8 %s -// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1 +// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1 // RUN: FileCheck -input-file=%t.2 -check-prefix=CHECK-darwin9 %s -// RUN: %clang_analyze_cc1 -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1 +// RUN: %clang_analyze_cc1 -Wno-error=return-type -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1 // RUN: FileCheck -input-file=%t.3 -check-prefix=CHECK-darwin9 %s @interface MyClass {} diff --git a/clang/test/Analysis/novoidtypecrash.c b/clang/test/Analysis/novoidtypecrash.c index 197516a259618..5af30c2010438 100644 --- a/clang/test/Analysis/novoidtypecrash.c +++ b/clang/test/Analysis/novoidtypecrash.c @@ -1,4 +1,4 @@ -// RUN: %clang_analyze_cc1 -std=c89 -Wno-int-conversion -analyzer-checker=core %s +// RUN: %clang_analyze_cc1 -Wno-error=return-type -std=c89 -Wno-int-conversion -analyzer-checker=core %s x; y(void **z) { // no-crash *z = x; diff --git a/clang/test/Analysis/plist-output.m b/clang/test/Analysis/plist-output.m index 96123243a833a..b89aab0a7c4cf 100644 --- a/clang/test/Analysis/plist-output.m +++ b/clang/test/Analysis/plist-output.m @@ -177,7 +177,7 @@ - (void)test { struct RDar13295437_S { int *i; }; -int RDar13295437(void) { +void RDar13295437(void) { struct RDar13295437_S s = {0}; struct RDar13295437_S *sp = &s; RDar13295437_f(sp->i); diff --git a/clang/test/Analysis/plist-stats-output.c b/clang/test/Analysis/plist-stats-output.c index 4bcae557d9276..42e0a802d3e37 100644 --- a/clang/test/Analysis/plist-stats-output.c +++ b/clang/test/Analysis/plist-stats-output.c @@ -2,7 +2,7 @@ // REQUIRES: asserts // RUN: FileCheck --input-file=%t.plist %s -int foo(void) {} +void foo(void) {} // CHECK: diagnostics diff --git a/clang/test/Analysis/scopes-cfg-output.cpp b/clang/test/Analysis/scopes-cfg-output.cpp index 5e6706602d456..c082bb179545f 100644 --- a/clang/test/Analysis/scopes-cfg-output.cpp +++ b/clang/test/Analysis/scopes-cfg-output.cpp @@ -1074,7 +1074,7 @@ void test_switch_with_compound_with_default() { // CHECK-NEXT: Succs (1): B4 // CHECK: [B0 (EXIT)] // CHECK-NEXT: Preds (1): B1 -int test_switch_with_compound_without_default() { +void test_switch_with_compound_without_default() { char c = '1'; switch (int i = getX()) { case 0: diff --git a/clang/test/Analysis/structured_bindings.cpp b/clang/test/Analysis/structured_bindings.cpp index 7004c2e7dcf43..989c584189ab2 100644 --- a/clang/test/Analysis/structured_bindings.cpp +++ b/clang/test/Analysis/structured_bindings.cpp @@ -3,10 +3,10 @@ void clang_analyzer_eval(bool); struct s { int a; }; -int foo() { +void foo() { auto [a] = s{1}; clang_analyzer_eval(a == 1); // expected-warning{{TRUE}} -} // expected-warning{{non-void function does not return a value}} +} struct s2 { int &x; diff --git a/clang/test/CXX/drs/cwg605.cpp b/clang/test/CXX/drs/cwg605.cpp index 2fd9e8155bf77..b98c483f3118e 100644 --- a/clang/test/CXX/drs/cwg605.cpp +++ b/clang/test/CXX/drs/cwg605.cpp @@ -12,7 +12,7 @@ template static T f(T t) {} template <> -int f(int t) {} +int f(int t) { return 0; } void g(int a) { f(a); diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp index 2a99ff0ea44f9..84d84a61a8d26 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp @@ -1,9 +1,9 @@ -// RUN: %clang_cc1 -std=c++11 %s -Winvalid-noreturn -verify +// RUN: %clang_cc1 -Werror=return-type -std=c++11 %s -Winvalid-noreturn -verify // An attribute-specifier-seq in a lambda-declarator appertains to the // type of the corresponding function call operator. void test_attributes() { - auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-warning{{on-void lambda does not return a value in all control paths}} + auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-error{{non-void lambda does not return a value in all control paths}} // FIXME: GCC accepts the [[gnu::noreturn]] attribute here. auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}} diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp index 73714f1a947a1..cb04d9567d2e4 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify +// RUN: %clang_cc1 -Werror=return-type -fsyntax-only -std=c++11 %s -verify // Check that analysis-based warnings work in lambda bodies. void analysis_based_warnings() { - (void)[]() -> int { }; // expected-warning{{non-void lambda does not return a value}} + (void)[]() -> int { }; // expected-error{{non-void lambda does not return a value}} } // Check that we get the right types of captured variables (the diff --git a/clang/test/CodeGen/2003-06-26-CFECrash.c b/clang/test/CodeGen/2003-06-26-CFECrash.c index aef3aa0253448..b92d9d8b18bf1 100644 --- a/clang/test/CodeGen/2003-06-26-CFECrash.c +++ b/clang/test/CodeGen/2003-06-26-CFECrash.c @@ -13,7 +13,7 @@ typedef struct Globals { extern Uz_Globs G; -int extract_or_test_files(void) { +void extract_or_test_files(void) { G.pInfo = G.info; } diff --git a/clang/test/CodeGen/2003-08-18-SigSetJmp.c b/clang/test/CodeGen/2003-08-18-SigSetJmp.c index 986bcb8bd74c3..cf7abaef7eff8 100644 --- a/clang/test/CodeGen/2003-08-18-SigSetJmp.c +++ b/clang/test/CodeGen/2003-08-18-SigSetJmp.c @@ -5,7 +5,7 @@ typedef int sigjmp_buf[_JBLEN + 1]; int sigsetjmp(sigjmp_buf env, int savemask); void bar(void); sigjmp_buf B; -int foo(void) { +void foo(void) { sigsetjmp(B, 1); bar(); } diff --git a/clang/test/CodeGen/2003-08-23-LocalUnionTest.c b/clang/test/CodeGen/2003-08-23-LocalUnionTest.c index 50b01e4258784..01b830f284f38 100644 --- a/clang/test/CodeGen/2003-08-23-LocalUnionTest.c +++ b/clang/test/CodeGen/2003-08-23-LocalUnionTest.c @@ -4,7 +4,7 @@ union foo { int X; }; -int test(union foo* F) { +void test(union foo* F) { { union foo { float X; } A; } diff --git a/clang/test/CodeGen/2003-10-29-AsmRename.c b/clang/test/CodeGen/2003-10-29-AsmRename.c index 746ff15dd0e31..0db2e862ae00e 100644 --- a/clang/test/CodeGen/2003-10-29-AsmRename.c +++ b/clang/test/CodeGen/2003-10-29-AsmRename.c @@ -16,7 +16,7 @@ int Func64(struct bar* B) { } -int test(void) { +void test(void) { Func(0); /* should be renamed to call Func64 */ Func64(0); } diff --git a/clang/test/CodeGen/2003-11-20-ComplexDivision.c b/clang/test/CodeGen/2003-11-20-ComplexDivision.c index 51198b81ee2e1..29873f5673dd2 100644 --- a/clang/test/CodeGen/2003-11-20-ComplexDivision.c +++ b/clang/test/CodeGen/2003-11-20-ComplexDivision.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -emit-llvm %s -o /dev/null -int test(void) { +void test(void) { __complex__ double C; double D; C / D; diff --git a/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c b/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c index abf78fb095566..5ad837ab4bcb8 100644 --- a/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c +++ b/clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c @@ -3,7 +3,7 @@ struct S { }; -int xxxx(int a) { +void xxxx(int a) { struct S comps[a]; comps[0]; } diff --git a/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c b/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c index 0650c744e46c4..b9deeb0e2bf63 100644 --- a/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c +++ b/clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c @@ -14,4 +14,4 @@ void bar(void) { int func(void); foo(func); } -static int func(char** A, char ** B) {} +static int func(char** A, char ** B) { return 0; } diff --git a/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c b/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c index 39439d7c614cd..4f9a536be5276 100644 --- a/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c +++ b/clang/test/CodeGen/2005-01-02-VAArgError-ICE.c @@ -2,7 +2,7 @@ // PR481 // RUN: %clang_cc1 %s -Wno-implicit-function-declaration -emit-llvm -o /dev/null -int flags(int a, int b, ...) { +void flags(int a, int b, ...) { __builtin_va_list args; __builtin_va_start(args,a); // not the last named arg foo(args); diff --git a/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c b/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c index 521e698661515..597b0bd9afe95 100644 --- a/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c +++ b/clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | \ +// RUN: %clang_cc1 -Wno-error=return-type -std=c99 %s -emit-llvm -o - | \ // RUN: opt -O3 -disable-output // PR580 diff --git a/clang/test/CodeGen/2007-01-06-KNR-Proto.c b/clang/test/CodeGen/2007-01-06-KNR-Proto.c index d56a786fce538..f38979b670081 100644 --- a/clang/test/CodeGen/2007-01-06-KNR-Proto.c +++ b/clang/test/CodeGen/2007-01-06-KNR-Proto.c @@ -6,5 +6,6 @@ int svc_register (void (*dispatch) (int)); int svc_register (dispatch) void (*dispatch) (); { + return 0; } diff --git a/clang/test/CodeGen/2008-05-06-CFECrash.c b/clang/test/CodeGen/2008-05-06-CFECrash.c index 11775673a7cc7..7ca157969ac38 100644 --- a/clang/test/CodeGen/2008-05-06-CFECrash.c +++ b/clang/test/CodeGen/2008-05-06-CFECrash.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -O2 %s -o /dev/null +// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -O2 %s -o /dev/null // PR2292. __inline__ __attribute__ ((__pure__)) int g (void) {} void f (int k) { k = g (); } diff --git a/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c b/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c index 70f3aaf6abfc7..910b5fdde7fc6 100644 --- a/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c +++ b/clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c @@ -22,6 +22,6 @@ static void bar(void *db) { char s[5] = "hi"; -int foo(void) { +void foo(void) { bar(0); } diff --git a/clang/test/CodeGen/2008-10-13-FrontendCrash.c b/clang/test/CodeGen/2008-10-13-FrontendCrash.c index da28bd9b1b9b1..f303224a44942 100644 --- a/clang/test/CodeGen/2008-10-13-FrontendCrash.c +++ b/clang/test/CodeGen/2008-10-13-FrontendCrash.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 %s -std=c89 -emit-llvm -o - // PR2797 -unsigned int +void func_48 (signed char p_49) { signed char l_340; diff --git a/clang/test/CodeGen/2009-01-21-InvalidIterator.c b/clang/test/CodeGen/2009-01-21-InvalidIterator.c index 83353da68beb1..b16e6d2d24ac3 100644 --- a/clang/test/CodeGen/2009-01-21-InvalidIterator.c +++ b/clang/test/CodeGen/2009-01-21-InvalidIterator.c @@ -63,6 +63,7 @@ frame_hdr_cache[8]; _Unwind_Ptr base_from_cb_data (struct unw_eh_callback_data *data) { + return 0; } void diff --git a/clang/test/CodeGen/2009-05-04-EnumInreg.c b/clang/test/CodeGen/2009-05-04-EnumInreg.c index 0ea18b92691e0..491678647b846 100644 --- a/clang/test/CodeGen/2009-05-04-EnumInreg.c +++ b/clang/test/CodeGen/2009-05-04-EnumInreg.c @@ -14,4 +14,4 @@ enum kobject_action { struct kobject; // CHECK: i32 inreg %action -int kobject_uevent(struct kobject *kobj, enum kobject_action action) {} +void kobject_uevent(struct kobject *kobj, enum kobject_action action) {} diff --git a/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c b/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c index 7be237d11a4dd..78bc0e8eb6a96 100644 --- a/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c +++ b/clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c @@ -14,4 +14,5 @@ typedef __WCHAR_TYPE__ wchar_t; signed short _iodbcdm_sqlerror(void) { wchar_t _sqlState[6] = { L"\0" }; + return 0; } diff --git a/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c b/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c index c19fd17a9684d..d0cc7615dd6bd 100644 --- a/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c +++ b/clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c @@ -11,7 +11,7 @@ typedef __attribute__((vector_size(16))) int v4i32; v4i32 (*bar)(int); static int foo() { - (*bar)(0)[0]; + return (*bar)(0)[0]; } int fun() { return foo(); } diff --git a/clang/test/CodeGen/X86/avx512fp16-abi.c b/clang/test/CodeGen/X86/avx512fp16-abi.c index 3d1b713a610a5..1856f1e22715c 100644 --- a/clang/test/CodeGen/X86/avx512fp16-abi.c +++ b/clang/test/CodeGen/X86/avx512fp16-abi.c @@ -206,6 +206,8 @@ struct fsd { struct fsd pr52011(void) { // CHECK: define{{.*}} { float, double } @ + struct fsd x; + return x; } struct hsd { @@ -216,6 +218,8 @@ struct hsd { struct hsd pr52011_2(void) { // CHECK: define{{.*}} { half, double } @ + struct hsd x; + return x; } struct hsf { @@ -226,6 +230,8 @@ struct hsf { struct hsf pr52011_3(void) { // CHECK: define{{.*}} <4 x half> @ + struct hsf x; + return x; } struct fds { @@ -237,4 +243,6 @@ struct fds { struct fds pr52011_4(void) { // CHECK-C: define{{.*}} { float, double } @pr52011_4 // CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret + struct fds x; + return x; } diff --git a/clang/test/CodeGen/X86/x86_64-atomic-128.c b/clang/test/CodeGen/X86/x86_64-atomic-128.c index f682ffc75f825..bf050788fa87a 100644 --- a/clang/test/CodeGen/X86/x86_64-atomic-128.c +++ b/clang/test/CodeGen/X86/x86_64-atomic-128.c @@ -26,4 +26,5 @@ __int128 test_expression(_Atomic __int128 *addr) { // CHECK-LABEL: @test_expression // CHECK: atomicrmw and ptr {{.*}} seq_cst, align 16 *addr &= 1; + return 0; } diff --git a/clang/test/CodeGen/align-local.c b/clang/test/CodeGen/align-local.c index 9e8a56066e1a0..a88dd1637a742 100644 --- a/clang/test/CodeGen/align-local.c +++ b/clang/test/CodeGen/align-local.c @@ -4,7 +4,7 @@ typedef struct __attribute((aligned(16))) {int x[4];} ff; // CHECK: alloca %struct.ff, align 16 // CHECK: alloca %struct.anon, align 16 -int a(void) { +void a(void) { ff a; struct {int x[4];} b __attribute((aligned(16))); } diff --git a/clang/test/CodeGen/arm-cmse-nonsecure.c b/clang/test/CodeGen/arm-cmse-nonsecure.c index 3310f0cbd0e9b..42221ac775cd8 100644 --- a/clang/test/CodeGen/arm-cmse-nonsecure.c +++ b/clang/test/CodeGen/arm-cmse-nonsecure.c @@ -41,8 +41,8 @@ typedef struct { int x, y, z; } Point; -void *test_pointed_object(void *p) { -// CHECK: define {{.*}} ptr @test_pointed_object +void test_pointed_object(void *p) { +// CHECK: define {{.*}} void @test_pointed_object Point *pt = (Point *)p; cmse_check_pointed_object(pt, CMSE_MPU_READ); // CHECK: call i32 @llvm.arm.cmse.tt diff --git a/clang/test/CodeGen/arm-cmse-secure.c b/clang/test/CodeGen/arm-cmse-secure.c index 132172b6c8702..305d25ad7388c 100644 --- a/clang/test/CodeGen/arm-cmse-secure.c +++ b/clang/test/CodeGen/arm-cmse-secure.c @@ -53,8 +53,8 @@ typedef struct { int x, y, z; } Point; -void *test_pointed_object(void *p) { -// CHECK: define {{.*}} ptr @test_pointed_object +void test_pointed_object(void *p) { +// CHECK: define {{.*}} void @test_pointed_object Point *pt = (Point *)p; cmse_check_pointed_object(pt, CMSE_NONSECURE | CMSE_MPU_READ diff --git a/clang/test/CodeGen/attr-noinline.cpp b/clang/test/CodeGen/attr-noinline.cpp index c1fb9941b5251..69916be319535 100644 --- a/clang/test/CodeGen/attr-noinline.cpp +++ b/clang/test/CodeGen/attr-noinline.cpp @@ -8,7 +8,7 @@ static int baz(int x) { return x * 10; } -[[clang::noinline]] bool noi() { } +[[clang::noinline]] bool noi() { return true; } [[msvc::noinline]] bool ms_noi() { return true; } void foo(int i) { diff --git a/clang/test/CodeGen/attr-noreturn.c b/clang/test/CodeGen/attr-noreturn.c index 93816b7570e87..c3f41d8424bed 100644 --- a/clang/test/CodeGen/attr-noreturn.c +++ b/clang/test/CodeGen/attr-noreturn.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -emit-llvm -std=c2x %s -o - | FileCheck %s -// RUN: %clang_cc1 -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX +// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -std=c2x %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple %itanium_abi_triple -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=CHECK-CXX typedef void (*fptrs_t[4])(void); fptrs_t p __attribute__((noreturn)); diff --git a/clang/test/CodeGen/block-copy.c b/clang/test/CodeGen/block-copy.c index 4679fe19b78f8..69881264c932f 100644 --- a/clang/test/CodeGen/block-copy.c +++ b/clang/test/CodeGen/block-copy.c @@ -6,7 +6,7 @@ void foo(float *); -float bar(void) { +void bar(void) { float lookupTable[] = {-1,-1,-1,0, -1,-1,0,-1, -1,-1,0,1, -1,-1,1,0, -1,0,-1,-1, -1,0,-1,1, -1,0,1,-1, -1,0,1,1, -1,1,-1,0, -1,1,0,-1, -1,1,0,1, -1,1,1,0, diff --git a/clang/test/CodeGen/builtin-memfns.c b/clang/test/CodeGen/builtin-memfns.c index 581eb85eb28e6..40e287c065177 100644 --- a/clang/test/CodeGen/builtin-memfns.c +++ b/clang/test/CodeGen/builtin-memfns.c @@ -56,7 +56,7 @@ int test6(char *X) { // CHECK: @test7 // PR12094 -int test7(int *p) { +void test7(int *p) { struct snd_pcm_hw_params_t* hwparams; // incomplete type. // CHECK: call void @llvm.memset{{.*}} align 4 {{.*}}256, i1 false) diff --git a/clang/test/CodeGen/catch-undef-behavior.c b/clang/test/CodeGen/catch-undef-behavior.c index 7580290b0b033..14cb7705c3783 100644 --- a/clang/test/CodeGen/catch-undef-behavior.c +++ b/clang/test/CodeGen/catch-undef-behavior.c @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN -// RUN: %clang_cc1 -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP -// RUN: %clang_cc1 -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW +// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-UBSAN +// RUN: %clang_cc1 -Wno-error=return-type -fsanitize-trap=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize=alignment,null,object-size,shift-base,shift-exponent,return,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -fsanitize-recover=alignment,null,object-size,shift-base,shift-exponent,signed-integer-overflow,vla-bound,float-cast-overflow,integer-divide-by-zero,bool,returns-nonnull-attribute,nonnull-attribute -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-COMMON --check-prefix=CHECK-TRAP +// RUN: %clang_cc1 -Wno-error=return-type -fsanitize=signed-integer-overflow -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-OVERFLOW // CHECK-UBSAN: @[[INT:.*]] = private unnamed_addr constant { i16, i16, [6 x i8] } { i16 0, i16 11, [6 x i8] c"'int'\00" } diff --git a/clang/test/CodeGen/cfi-unrelated-cast.cpp b/clang/test/CodeGen/cfi-unrelated-cast.cpp index abd67901f0020..4095d67450d37 100644 --- a/clang/test/CodeGen/cfi-unrelated-cast.cpp +++ b/clang/test/CodeGen/cfi-unrelated-cast.cpp @@ -29,7 +29,7 @@ class C1 { virtual void f() {} }; -C1 *f1() { +void f1() { myalloc allocator; (void)allocator.allocate(16); (void)allocator.allocate(16, 0); diff --git a/clang/test/CodeGen/const-label-addr.c b/clang/test/CodeGen/const-label-addr.c index edfff0f8f6399..8030f96cb8aed 100644 --- a/clang/test/CodeGen/const-label-addr.c +++ b/clang/test/CodeGen/const-label-addr.c @@ -2,7 +2,7 @@ // REQUIRES: asserts // CHECK: @a.a = internal global ptr blockaddress(@a, %A) -int a(void) { +void a(void) { A:;static void* a = &&A; } diff --git a/clang/test/CodeGen/debug-info-crash.c b/clang/test/CodeGen/debug-info-crash.c index b53dbc50676d4..e3a8f81d3508b 100644 --- a/clang/test/CodeGen/debug-info-crash.c +++ b/clang/test/CodeGen/debug-info-crash.c @@ -6,7 +6,7 @@ __attribute__((visibility("default"))) extern struct dispatch_queue_s _dispatch_main_q; typedef struct dispatch_item_s *dispatch_item_t; typedef void (^dispatch_legacy_block_t)(dispatch_item_t); -dispatch_item_t LEGACY_dispatch_call(dispatch_queue_t dq, +void LEGACY_dispatch_call(dispatch_queue_t dq, dispatch_legacy_block_t dispatch_block, dispatch_legacy_block_t callback_block) { dispatch_queue_t lq = _dispatch_queue_get_current() ?: (&_dispatch_main_q); diff --git a/clang/test/CodeGen/debug-info.c b/clang/test/CodeGen/debug-info.c index 4c444515757bd..024e9579843d4 100644 --- a/clang/test/CodeGen/debug-info.c +++ b/clang/test/CodeGen/debug-info.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s -// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unk-unk -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple powerpc64-ibm-aix-xcoff -o - -emit-llvm -debug-info-kind=limited %s | FileCheck %s // PR3023 void convert(void) { diff --git a/clang/test/CodeGen/empty-union-init.c b/clang/test/CodeGen/empty-union-init.c index f1cdfb12f6246..386aeb260fae5 100644 --- a/clang/test/CodeGen/empty-union-init.c +++ b/clang/test/CodeGen/empty-union-init.c @@ -8,6 +8,7 @@ struct Mem { struct Mem *columnMem(void){ static const struct Mem nullMem = { {} }; + return 0; } diff --git a/clang/test/CodeGen/exceptions-seh.c b/clang/test/CodeGen/exceptions-seh.c index a102afb1d271c..25d622419b09c 100644 --- a/clang/test/CodeGen/exceptions-seh.c +++ b/clang/test/CodeGen/exceptions-seh.c @@ -276,6 +276,7 @@ int exception_code_in_except(void) { } __except(1) { return _exception_code(); } + return 0; } // CHECK-LABEL: define dso_local i32 @exception_code_in_except() diff --git a/clang/test/CodeGen/exprs.c b/clang/test/CodeGen/exprs.c index 13a64f0271065..5cca9722dcb3a 100644 --- a/clang/test/CodeGen/exprs.c +++ b/clang/test/CodeGen/exprs.c @@ -7,7 +7,7 @@ int x=sizeof(zxcv); int y=__alignof__(zxcv); -void *test(int *i) { +void test(int *i) { short a = 1; i += a; i + a; @@ -18,7 +18,7 @@ _Bool test2b; int test2(void) { if (test2b); return 0; } // PR1921 -int test3(void) { +void test3(void) { const unsigned char *bp; bp -= (short)1; } diff --git a/clang/test/CodeGen/ext-int-cc.c b/clang/test/CodeGen/ext-int-cc.c index 05b2bf1bec81e..14efd54e24ffb 100644 --- a/clang/test/CodeGen/ext-int-cc.c +++ b/clang/test/CodeGen/ext-int-cc.c @@ -162,7 +162,7 @@ void ParamPassing4(_BitInt(129) a) {} // LA32-NOT: define{{.*}} void @ParamPassing4(ptr %{{.+}}) #endif -_BitInt(63) ReturnPassing(void){} +_BitInt(63) ReturnPassing(void) { return 0; } // LIN64: define{{.*}} i64 @ReturnPassing( // WIN64: define dso_local i63 @ReturnPassing( // LIN32: define{{.*}} i63 @ReturnPassing( @@ -193,7 +193,7 @@ _BitInt(63) ReturnPassing(void){} // LA64: define{{.*}} signext i63 @ReturnPassing( // LA32: define{{.*}} i63 @ReturnPassing( -_BitInt(64) ReturnPassing2(void){} +_BitInt(64) ReturnPassing2(void) { return 0; } // LIN64: define{{.*}} i64 @ReturnPassing2( // WIN64: define dso_local i64 @ReturnPassing2( // LIN32: define{{.*}} i64 @ReturnPassing2( @@ -224,7 +224,7 @@ _BitInt(64) ReturnPassing2(void){} // LA64: define{{.*}} i64 @ReturnPassing2( // LA32: define{{.*}} i64 @ReturnPassing2( -_BitInt(127) ReturnPassing3(void){} +_BitInt(127) ReturnPassing3(void) { return 0; } // LIN64: define{{.*}} { i64, i64 } @ReturnPassing3( // WIN64: define dso_local void @ReturnPassing3(ptr dead_on_unwind noalias writable sret // LIN32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret @@ -257,7 +257,7 @@ _BitInt(127) ReturnPassing3(void){} // LA64: define{{.*}} i127 @ReturnPassing3( // LA32: define{{.*}} void @ReturnPassing3(ptr dead_on_unwind noalias writable sret -_BitInt(128) ReturnPassing4(void){} +_BitInt(128) ReturnPassing4(void) { return 0; } // LIN64: define{{.*}} { i64, i64 } @ReturnPassing4( // WIN64: define dso_local void @ReturnPassing4(ptr dead_on_unwind noalias writable sret // LIN32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret @@ -289,7 +289,7 @@ _BitInt(128) ReturnPassing4(void){} // LA32: define{{.*}} void @ReturnPassing4(ptr dead_on_unwind noalias writable sret #if __BITINT_MAXWIDTH__ > 128 -_BitInt(129) ReturnPassing5(void){} +_BitInt(129) ReturnPassing5(void) { return 0; } // LIN64: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret // WIN64: define dso_local void @ReturnPassing5(ptr dead_on_unwind noalias writable sret // LIN32: define{{.*}} void @ReturnPassing5(ptr dead_on_unwind noalias writable sret @@ -322,8 +322,8 @@ _BitInt(129) ReturnPassing5(void){} // SparcV9 is odd in that it has a return-size limit of 256, not 128 or 64 // like other platforms, so test to make sure this behavior will still work. -_BitInt(256) ReturnPassing6(void) {} +_BitInt(256) ReturnPassing6(void) { return 0; } // SPARCV9-NOT: define{{.*}} i256 @ReturnPassing6( -_BitInt(257) ReturnPassing7(void) {} +_BitInt(257) ReturnPassing7(void) { return 0; } // SPARCV9-NOT: define{{.*}} void @ReturnPassing7(ptr dead_on_unwind noalias writable sret #endif diff --git a/clang/test/CodeGen/implicit-arg.c b/clang/test/CodeGen/implicit-arg.c index 9959419f9b7c8..3630fbbbdb1a6 100644 --- a/clang/test/CodeGen/implicit-arg.c +++ b/clang/test/CodeGen/implicit-arg.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -emit-llvm -o - -// RUN: %clang_cc1 %s -emit-llvm -O1 -o - +// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -o - +// RUN: %clang_cc1 %s -Wno-error=return-type -emit-llvm -O1 -o - static int bar(); void foo() { diff --git a/clang/test/CodeGen/msan-param-retval.c b/clang/test/CodeGen/msan-param-retval.c index 269a759fac10e..439ae98799c68 100644 --- a/clang/test/CodeGen/msan-param-retval.c +++ b/clang/test/CodeGen/msan-param-retval.c @@ -1,12 +1,12 @@ -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK void bar(int x) { diff --git a/clang/test/CodeGen/msan-param-retval.cpp b/clang/test/CodeGen/msan-param-retval.cpp index c4960a4702f6c..caebb38fa50ce 100644 --- a/clang/test/CodeGen/msan-param-retval.cpp +++ b/clang/test/CodeGen/msan-param-retval.cpp @@ -1,12 +1,12 @@ -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -fno-sanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,NOUNDEF_ONLY,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -mllvm -msan-eager-checks -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -no-enable-noundef-analysis -fsanitize-memory-param-retval -o - %s | \ // RUN: FileCheck %s --check-prefixes=CLEAN,CHECK -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \ +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-linux-gnu -emit-llvm -fsanitize=memory -o - %s | \ // RUN: FileCheck %s --check-prefixes=NOUNDEF,EAGER,CHECK void bar(int x) { diff --git a/clang/test/CodeGen/object-size.c b/clang/test/CodeGen/object-size.c index 58561a5470f72..2a3dfc8f4b12b 100644 --- a/clang/test/CodeGen/object-size.c +++ b/clang/test/CodeGen/object-size.c @@ -592,7 +592,7 @@ void PR30346(void) { extern char incomplete_char_array[]; // CHECK-LABEL: @incomplete_and_function_types -int incomplete_and_function_types(void) { +void incomplete_and_function_types(void) { // CHECK: call i64 @llvm.objectsize.i64.p0 gi = OBJECT_SIZE_BUILTIN(incomplete_char_array, 0); // CHECK: call i64 @llvm.objectsize.i64.p0 diff --git a/clang/test/CodeGen/sparcv8-abi.c b/clang/test/CodeGen/sparcv8-abi.c index 7a93717643278..c5faf130890f8 100644 --- a/clang/test/CodeGen/sparcv8-abi.c +++ b/clang/test/CodeGen/sparcv8-abi.c @@ -4,16 +4,19 @@ float __complex__ p (float __complex__ a, float __complex__ b) { + return 0; } // CHECK-LABEL: define{{.*}} { double, double } @q(ptr noundef byval({ double, double }) align 8 %a, ptr noundef byval({ double, double }) align 8 %b) #0 { double __complex__ q (double __complex__ a, double __complex__ b) { + return 0; } // CHECK-LABEL: define{{.*}} { i64, i64 } @r(ptr noundef byval({ i64, i64 }) align 8 %a, ptr noundef byval({ i64, i64 }) align 8 %b) #0 { long long __complex__ r (long long __complex__ a, long long __complex__ b) { + return 0; } diff --git a/clang/test/CodeGen/sret.c b/clang/test/CodeGen/sret.c index 6d905e89b2c6f..83dce80aa279b 100644 --- a/clang/test/CodeGen/sret.c +++ b/clang/test/CodeGen/sret.c @@ -12,7 +12,7 @@ struct abc foo1(void); // CHECK-DAG: declare {{.*}} @foo1(ptr dead_on_unwind writable sret(%struct.abc) struct abc foo2(); // CHECK-DAG: declare {{.*}} @foo2(ptr dead_on_unwind writable sret(%struct.abc) -struct abc foo3(void){} +struct abc foo3(void) { return (struct abc){0}; } // CHECK-DAG: define {{.*}} @foo3(ptr dead_on_unwind noalias writable sret(%struct.abc) void bar(void) { diff --git a/clang/test/CodeGen/static-order.c b/clang/test/CodeGen/static-order.c index dbd22db96b52c..e128c2f74245f 100644 --- a/clang/test/CodeGen/static-order.c +++ b/clang/test/CodeGen/static-order.c @@ -19,4 +19,5 @@ void *f(void) { if (a.a) return v; + return 0; } diff --git a/clang/test/CodeGen/staticinit.c b/clang/test/CodeGen/staticinit.c index 90b8fa5edb024..ec9b5b34d3ade 100644 --- a/clang/test/CodeGen/staticinit.c +++ b/clang/test/CodeGen/staticinit.c @@ -27,7 +27,7 @@ void foo(void) { } // CHECK: @f1.l0 = internal global i32 ptrtoint (ptr @f1 to i32) -int f1(void) { static int l0 = (unsigned) f1; } +void f1(void) { static int l0 = (unsigned) f1; } // PR7044 char *f2(char key) { diff --git a/clang/test/CodeGen/struct.c b/clang/test/CodeGen/struct.c index c98357160addf..0da9b748ea3b8 100644 --- a/clang/test/CodeGen/struct.c +++ b/clang/test/CodeGen/struct.c @@ -136,7 +136,7 @@ struct a14 { short a; int b; } x = {1, 1}; /* flexible array members */ struct a15 {char a; int b[];} c15; -int a16(void) {c15.a = 1;} +void a16(void) {c15.a = 1;} /* compound literals */ void f13(void) { diff --git a/clang/test/CodeGen/ubsan-debuglog-return.c b/clang/test/CodeGen/ubsan-debuglog-return.c index ecbebc34d2233..0a96465d330e3 100644 --- a/clang/test/CodeGen/ubsan-debuglog-return.c +++ b/clang/test/CodeGen/ubsan-debuglog-return.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -x c -debug-info-kind=line-tables-only -emit-llvm -fsanitize=returns-nonnull-attribute -o - %s | FileCheck %s // The UBSAN function call in the epilogue needs to have a debug location. __attribute__((returns_nonnull)) void *allocate(void) {} diff --git a/clang/test/CodeGen/union.c b/clang/test/CodeGen/union.c index 60e9e2d771ff1..fb47d7140bed1 100644 --- a/clang/test/CodeGen/union.c +++ b/clang/test/CodeGen/union.c @@ -34,7 +34,7 @@ void fS65(void) { enum E9 e = s65.a; } typedef union{ unsigned char x[65536]; } q; -int qfunc(void) {q buf; unsigned char* x = buf.x;} +void qfunc(void) {q buf; unsigned char* x = buf.x;} union RR {_Bool a : 1;} RRU; int RRF(void) {return RRU.a;} diff --git a/clang/test/CodeGen/ve-abi.c b/clang/test/CodeGen/ve-abi.c index 25ec3ed07b7dd..4e73b7eec16c1 100644 --- a/clang/test/CodeGen/ve-abi.c +++ b/clang/test/CodeGen/ve-abi.c @@ -52,6 +52,7 @@ unsigned long fun_zi64(unsigned long a, unsigned long b) { // CHECK-LABEL: define{{.*}} i128 @fun_si128(i128 noundef %a, i128 noundef %b) #0 { __int128 fun_si128(__int128 a, __int128 b) { + return a; } // CHECK-LABEL: define{{.*}} i128 @fun_zi128(i128 noundef %a, i128 noundef %b) #0 { diff --git a/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp b/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp index 37005c5e9df77..465f55f9f8ecf 100644 --- a/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp +++ b/clang/test/CodeGenCXX/2007-01-06-PtrMethodInit.cpp @@ -20,6 +20,8 @@ extern "C++" { static const nsIID & GetIID () { + static const nsIID i = {}; + return i; } }; } @@ -31,6 +33,8 @@ class nsIDOMEventListener:public nsISupports { public:static const nsIID & GetIID () { + static const nsIID i = {}; + return i; } virtual nsresult __attribute__ ((regparm (0), cdecl)) HandleEvent (nsIDOMEvent * event) = @@ -42,6 +46,7 @@ public:static const nsIID & GetIID () { static const nsIID iid = { }; + return iid; } virtual nsresult __attribute__ ((regparm (0), diff --git a/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp b/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp index ec8a516c696b1..b8d55ced2c2a6 100644 --- a/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp +++ b/clang/test/CodeGenCXX/2007-09-10-RecursiveTypeResolution.cpp @@ -55,6 +55,7 @@ namespace Manta vector < _Tp, _Alloc > > iterator; iterator end () { + return {}; } }; class MantaInterface diff --git a/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp b/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp index 8e5750d3c4ef4..ce1886c2e5032 100644 --- a/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp +++ b/clang/test/CodeGenCXX/2007-10-01-StructResize.cpp @@ -7,7 +7,7 @@ struct Bork { unsigned int f2 : 30; }; -int Foo(Bork *hdr) { +void Foo(Bork *hdr) { hdr->f1 = 7; hdr->f2 = 927; } diff --git a/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp b/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp index fe6f32a6969cd..04b1067aabdec 100644 --- a/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp +++ b/clang/test/CodeGenCXX/2009-08-11-VectorRetTy.cpp @@ -1,7 +1,7 @@ // RUN: %clang_cc1 %s -emit-llvm -o /dev/null typedef void (*Func) (); typedef long long m64 __attribute__((__vector_size__(8), __may_alias__)); -static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() {} +static inline m64 __attribute__((__always_inline__, __nodebug__)) _mm_set1_pi16() { return {}; } template static void Bork() { const m64 mmx_0x00ff = _mm_set1_pi16(); diff --git a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp index a88d605f565ee..ef589e0537974 100644 --- a/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp +++ b/clang/test/CodeGenCXX/2010-07-23-DeclLoc.cpp @@ -16,7 +16,7 @@ namespace std { public: typedef _Tp element_type; auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { } - element_type& operator*() const throw() { } + element_type& operator*() const throw() { return *_M_ptr; } }; } class Pointer32 { @@ -69,17 +69,17 @@ template void extract_dwarf_data_from_header(TExt TRawSymbolOwnerData& symbol_owner_data, TAddressRelocator* address_relocator) {} struct CSCppSymbolOwnerHashFunctor { - size_t operator()(const CSCppSymbolOwner& symbol_owner) const { + void operator()(const CSCppSymbolOwner& symbol_owner) const { # 97 "wrong_place_for_decl.cpp" } }; -template CSCppSymbolOwnerData* create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { +template void create_symbol_owner_data_arch_specific(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { typedef typename SIZE_AND_ENDIANNESS::SIZE SIZE; std::auto_ptr< TRawSymbolOwnerData > data(new TRawSymbolOwnerData()); std::auto_ptr< TExtendedMachOHeader > header; extract_dwarf_data_from_header(*header, *data, (TAddressRelocator*)__null); } -CSCppSymbolOwnerData* create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { +void create_symbol_owner_data2(CSCppSymbolOwner* symbol_owner, const char* dsym_path) { create_symbol_owner_data_arch_specific< ISA32Little >(symbol_owner, dsym_path); create_symbol_owner_data_arch_specific< ISA32Big >(symbol_owner, dsym_path); create_symbol_owner_data_arch_specific< ISA64Little >(symbol_owner, dsym_path); diff --git a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp index 1ad46042b6efd..ed575e14244f5 100644 --- a/clang/test/CodeGenCXX/address-space-cast-coerce.cpp +++ b/clang/test/CodeGenCXX/address-space-cast-coerce.cpp @@ -41,7 +41,7 @@ template using char1 = my_vector_type; -int mane() { +void mane() { char1 f1{1}; char1 f2{1}; diff --git a/clang/test/CodeGenCXX/array-value-initialize.cpp b/clang/test/CodeGenCXX/array-value-initialize.cpp index 27607c1c75445..b3dc24871b495 100644 --- a/clang/test/CodeGenCXX/array-value-initialize.cpp +++ b/clang/test/CodeGenCXX/array-value-initialize.cpp @@ -22,7 +22,7 @@ struct Foo { S sbar_[5]; }; -int test1(void) { +void test1(void) { Foo a; } diff --git a/clang/test/CodeGenCXX/attr.cpp b/clang/test/CodeGenCXX/attr.cpp index 3890f2018c9a6..78df87c6e0888 100644 --- a/clang/test/CodeGenCXX/attr.cpp +++ b/clang/test/CodeGenCXX/attr.cpp @@ -4,7 +4,7 @@ // CHECK: define{{.*}} i32 @_Z3foov() [[NUW:#[0-9]+]] align 1024 int foo() __attribute__((aligned(1024))); -int foo() { } +int foo() { return 0; } class C { virtual void bar1() __attribute__((aligned(1))); diff --git a/clang/test/CodeGenCXX/c-linkage.cpp b/clang/test/CodeGenCXX/c-linkage.cpp index 0f4c3277253f7..bc2c0c5380f42 100644 --- a/clang/test/CodeGenCXX/c-linkage.cpp +++ b/clang/test/CodeGenCXX/c-linkage.cpp @@ -29,5 +29,6 @@ extern "C" { struct test3_s { }; bool operator==(const int& a, const test3_s& b) { + return false; } } diff --git a/clang/test/CodeGenCXX/catch-undef-behavior.cpp b/clang/test/CodeGenCXX/catch-undef-behavior.cpp index 419d1292551a0..15feebe0c0993 100644 --- a/clang/test/CodeGenCXX/catch-undef-behavior.cpp +++ b/clang/test/CodeGenCXX/catch-undef-behavior.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN -// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN -// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL -// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN -// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN +// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,unreachable,return,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -fsanitize-recover=signed-integer-overflow,integer-divide-by-zero,float-divide-by-zero,shift-base,shift-exponent,vla-bound,alignment,null,vptr,object-size,float-cast-overflow,bool,enum,array-bounds,function -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefixes=CHECK,CHECK-FUNCSAN +// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr,address -fsanitize-recover=vptr,address -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=CHECK-ASAN +// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=vptr -fsanitize-recover=vptr -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s --check-prefix=DOWNCAST-NULL +// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple x86_64-linux-gnux32 | FileCheck %s --check-prefix=CHECK-FUNCSAN +// RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -Wno-error=return-type -fsanitize=function -emit-llvm %s -o - -triple i386-linux-gnu | FileCheck %s --check-prefix=CHECK-FUNCSAN struct S { double d; diff --git a/clang/test/CodeGenCXX/conditional-gnu-ext.cpp b/clang/test/CodeGenCXX/conditional-gnu-ext.cpp index 3d3d210f22f69..4411d4269b8cd 100644 --- a/clang/test/CodeGenCXX/conditional-gnu-ext.cpp +++ b/clang/test/CodeGenCXX/conditional-gnu-ext.cpp @@ -11,7 +11,7 @@ void test0() { namespace radar8446940 { extern "C" void abort(); -int main () { +void main () { char x[1]; char *y = x ? : 0; diff --git a/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp b/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp index ac542870f1f4b..7bc82eff66790 100644 --- a/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp +++ b/clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp @@ -55,6 +55,9 @@ static const int &foo() { // CHECK-DAG: @_Z1tIKiE return t; } + + static int x; + return x; } diff --git a/clang/test/CodeGenCXX/debug-info-cxx0x.cpp b/clang/test/CodeGenCXX/debug-info-cxx0x.cpp index 4c31f60c0d965..c21a0bb1ad5a1 100644 --- a/clang/test/CodeGenCXX/debug-info-cxx0x.cpp +++ b/clang/test/CodeGenCXX/debug-info-cxx0x.cpp @@ -12,7 +12,7 @@ namespace PR13570 { template struct P {}; template struct A { template static P isa(U); - decltype(isa(int())) f() {} + decltype(isa(int())) f() { return {}; } }; template struct A; } diff --git a/clang/test/CodeGenCXX/debug-info-scoped-class.cpp b/clang/test/CodeGenCXX/debug-info-scoped-class.cpp index de4aee9a1b448..7424487df418b 100644 --- a/clang/test/CodeGenCXX/debug-info-scoped-class.cpp +++ b/clang/test/CodeGenCXX/debug-info-scoped-class.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -std=c++11 \ +// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -debug-info-kind=standalone -std=c++11 \ // RUN: -triple thumbv7-apple-ios %s -o - | FileCheck %s // This forward-declared scoped enum will be created while building its own diff --git a/clang/test/CodeGenCXX/debug-lambda-this.cpp b/clang/test/CodeGenCXX/debug-lambda-this.cpp index eecbac6520ac9..019d09c48f858 100644 --- a/clang/test/CodeGenCXX/debug-lambda-this.cpp +++ b/clang/test/CodeGenCXX/debug-lambda-this.cpp @@ -4,9 +4,9 @@ struct D { D(); D(const D&); int x; - int d(int x); + void d(int x); }; -int D::d(int x) { +void D::d(int x) { [=] { return this->x; }(); diff --git a/clang/test/CodeGenCXX/expr.cpp b/clang/test/CodeGenCXX/expr.cpp index 33e8e63de2f4a..d1af538d8c6c8 100644 --- a/clang/test/CodeGenCXX/expr.cpp +++ b/clang/test/CodeGenCXX/expr.cpp @@ -24,7 +24,7 @@ int test3g = test3(__PRETTY_FUNCTION__); struct test4A { int j : 2; }; -int test4() { +void test4() { test4A a; (a.j = 2) = 3; } diff --git a/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp b/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp index 18d2080a611e8..bb21c87eed8ff 100644 --- a/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp +++ b/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp @@ -56,6 +56,7 @@ inline int foo() { }; }; L(3)('a'); + return 0; } int use = foo(); } diff --git a/clang/test/CodeGenCXX/mangle-exprs.cpp b/clang/test/CodeGenCXX/mangle-exprs.cpp index b666eaadf4576..b75f2cf3607b3 100644 --- a/clang/test/CodeGenCXX/mangle-exprs.cpp +++ b/clang/test/CodeGenCXX/mangle-exprs.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -fclang-abi-compat=latest -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s namespace std { typedef decltype(sizeof(int)) size_t; @@ -327,7 +327,7 @@ namespace test7 { template decltype(T{{1,2}}) fTB(T t) {} template decltype(T({1,2})) fTC(T t) {} - int main() { + void main() { fA1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA1IiEEDTcmtlNS_1AELi1ELi2EEcvT__EES2_ fA2(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fA2IiEEDTcmcvNS_1AEilLi1ELi2EEcvT__EES2_ fB1(1); // CHECK-LABEL: define {{.*}} @_ZN5test73fB1IiEEDTcmtlNS_1BELi1ELi2EEcvT__EES2_ diff --git a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp index d2c1b77265903..2fc2cb262a440 100644 --- a/clang/test/CodeGenCXX/mangle-variadic-templates.cpp +++ b/clang/test/CodeGenCXX/mangle-variadic-templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -std=c++11 -emit-llvm -triple=x86_64-apple-darwin9 -o - %s | FileCheck %s template struct X { }; @@ -47,7 +47,7 @@ template void f3(const int*); template void f3(const int*, const float*); // Mangling of type pack expansions in a template argument -template tuple f4() {} +template tuple f4() { return {}; } // CHECK-LABEL: define weak_odr void @_Z2f4IJifdEE5tupleIJDpT_EEv template tuple f4(); diff --git a/clang/test/CodeGenCXX/mangle.cpp b/clang/test/CodeGenCXX/mangle.cpp index d0800af55c87e..c5b472670e8c0 100644 --- a/clang/test/CodeGenCXX/mangle.cpp +++ b/clang/test/CodeGenCXX/mangle.cpp @@ -645,7 +645,7 @@ namespace test24 { foo(); } - static char bar() {} + static char bar() { return 0; } void test1() { // CHECK: call noundef signext i8 @_ZN6test24L3barEv() bar(); @@ -839,7 +839,7 @@ namespace test36 { template struct A { }; template - auto f1(Types... values) -> A { } + auto f1(Types... values) -> A { return {}; } // CHECK: define weak_odr {{.*}} @_ZN6test362f1IJifEEENS_1AIXsZfp_EEEDpT_ template A<2> f1(int, float); diff --git a/clang/test/CodeGenCXX/matrix-type-operators.cpp b/clang/test/CodeGenCXX/matrix-type-operators.cpp index 8854a718fb13e..739008d3d0d37 100644 --- a/clang/test/CodeGenCXX/matrix-type-operators.cpp +++ b/clang/test/CodeGenCXX/matrix-type-operators.cpp @@ -300,7 +300,11 @@ int test_extract_template(MyMatrix Mat1) { using double4x4 = double __attribute__((matrix_type(4, 4))); template -auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) {} +auto matrix_subscript(double4x4 m, R r, C c) -> decltype(m[r][c]) { + // FIXME: We can't actually do 'return m[r][c]' here currently. + static double d; + return d; +} double test_matrix_subscript(double4x4 m) { // CHECK-LABEL: @_Z21test_matrix_subscriptu11matrix_typeILm4ELm4EdE( diff --git a/clang/test/CodeGenCXX/matrix-type.cpp b/clang/test/CodeGenCXX/matrix-type.cpp index c3a299e7feee8..de28dcd24507a 100644 --- a/clang/test/CodeGenCXX/matrix-type.cpp +++ b/clang/test/CodeGenCXX/matrix-type.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -no-enable-noundef-analysis -fenable-matrix -fclang-abi-compat=latest -triple x86_64-apple-darwin %s -emit-llvm -disable-llvm-passes -o - -std=c++17 | FileCheck %s typedef double dx5x5_t __attribute__((matrix_type(5, 5))); typedef float fx3x4_t __attribute__((matrix_type(3, 4))); diff --git a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp index fa7670c744814..55dc71a009857 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-static-initializers.cpp @@ -194,6 +194,7 @@ inline int switch_test(int x) { return b + c++; } }; + return 0; } int f(); diff --git a/clang/test/CodeGenCXX/new-alias.cpp b/clang/test/CodeGenCXX/new-alias.cpp index 5310d47297bbd..2496e38362181 100644 --- a/clang/test/CodeGenCXX/new-alias.cpp +++ b/clang/test/CodeGenCXX/new-alias.cpp @@ -3,11 +3,12 @@ using size_t = decltype(sizeof(0)); extern "C" char *something(long long x) { + return nullptr; } // CHECK: @_Znwm ={{.*}} alias ptr (i64), ptr @something void *operator new(size_t) __attribute__((alias("something"))); // PR16715: don't assert here. -// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) #3{{$}} +// CHECK: call noalias noundef nonnull ptr @_Znwm(i64 noundef 4) int *pr16715 = new int; diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp index d5bb1c0e45a5c..1141bc35de582 100644 --- a/clang/test/CodeGenCXX/nrvo.cpp +++ b/clang/test/CodeGenCXX/nrvo.cpp @@ -1,7 +1,7 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s -// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++03 -o - %s | FileCheck --check-prefixes=CHECK-EH-03 %s +// RUN: %clang_cc1 -triple i386-unknown-unknown -Wno-error=return-type -emit-llvm -fcxx-exceptions -fexceptions -disable-llvm-passes -std=c++11 -DCXX11 -o - %s | FileCheck --check-prefixes=CHECK-EH-11 %s // Test code generation for the named return value optimization. class X { diff --git a/clang/test/CodeGenCXX/reference-field.cpp b/clang/test/CodeGenCXX/reference-field.cpp index 54e914d0f3fce..7c78c99eb3d8f 100644 --- a/clang/test/CodeGenCXX/reference-field.cpp +++ b/clang/test/CodeGenCXX/reference-field.cpp @@ -3,6 +3,6 @@ // Make sure the call to b() doesn't get optimized out. extern struct x {char& x,y;}y; int b(); -int a() { if (!&y.x) b(); } +void a() { if (!&y.x) b(); } // CHECK: @_Z1bv diff --git a/clang/test/CodeGenCXX/return.cpp b/clang/test/CodeGenCXX/return.cpp index 584c2921c1e7f..a281d71a271c6 100644 --- a/clang/test/CodeGenCXX/return.cpp +++ b/clang/test/CodeGenCXX/return.cpp @@ -1,8 +1,8 @@ -// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s -// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON -// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON +// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -o - %s | FileCheck --check-prefixes=CHECK,CHECK-COMMON %s +// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-OPT,CHECK-COMMON +// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-return-type -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT,CHECK-COMMON -// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON +// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -std=c++11 -fno-strict-return -Wno-error=return-type -O -o - %s | FileCheck %s --check-prefixes=CHECK-NOSTRICT-OPT,CHECK-COMMON // CHECK-COMMON-LABEL: @_Z9no_return int no_return() { diff --git a/clang/test/CodeGenCXX/template-instantiation.cpp b/clang/test/CodeGenCXX/template-instantiation.cpp index 8453bcefc7ebb..f1797cb69870d 100644 --- a/clang/test/CodeGenCXX/template-instantiation.cpp +++ b/clang/test/CodeGenCXX/template-instantiation.cpp @@ -140,7 +140,7 @@ namespace test4 { B b; } - unsigned test() { + void test() { A::foo(); } } diff --git a/clang/test/CodeGenCXX/trap-fnattr.cpp b/clang/test/CodeGenCXX/trap-fnattr.cpp index 21422bc94f6fb..ed7162fc43a6c 100644 --- a/clang/test/CodeGenCXX/trap-fnattr.cpp +++ b/clang/test/CodeGenCXX/trap-fnattr.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC -// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION +// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC +// RUN: %clang_cc1 -O0 -emit-llvm -Wno-error=return-type -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION // TRAPFUNC-LABEL: define {{(dso_local )?}}void @{{_Z12test_builtinv|\"\?test_builtin@@YAXXZ\"}} // TRAPFUNC: call void @llvm.trap() [[ATTR0:#[0-9]+]] diff --git a/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp b/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp index 96a697aca5eb1..81db5c4912613 100644 --- a/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp +++ b/clang/test/CodeGenCXX/ubsan-check-debuglocs.cpp @@ -8,7 +8,7 @@ // CHECK-SAME: !dbg struct SourceLocation { - SourceLocation acquire() {}; + SourceLocation acquire() { return {}; }; }; extern "C" void __ubsan_handle_type_mismatch_v1(SourceLocation *Loc); static void handleTypeMismatchImpl(SourceLocation *Loc) { Loc->acquire(); } diff --git a/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m b/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m index 35a0df3a1a9f2..b3eda57eec5d2 100644 --- a/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m +++ b/clang/test/CodeGenObjC/2007-10-18-ProDescriptor.m @@ -14,5 +14,6 @@ @interface AGy:O < AB > { @end @implementation AGy - (unsigned) ver { + return 0; } @end diff --git a/clang/test/CodeGenObjC/2008-11-25-Blocks.m b/clang/test/CodeGenObjC/2008-11-25-Blocks.m index f0be6de338980..60615f78a049b 100644 --- a/clang/test/CodeGenObjC/2008-11-25-Blocks.m +++ b/clang/test/CodeGenObjC/2008-11-25-Blocks.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -emit-llvm %s -o /dev/null +// RUN: %clang_cc1 -Wno-error=return-type -fblocks -emit-llvm %s -o /dev/null @interface bork - (id)B:(void (^)(void))blk; diff --git a/clang/test/CodeGenObjC/debug-info-crash.m b/clang/test/CodeGenObjC/debug-info-crash.m index 85b9b7d334f94..845a65ec41d58 100644 --- a/clang/test/CodeGenObjC/debug-info-crash.m +++ b/clang/test/CodeGenObjC/debug-info-crash.m @@ -36,5 +36,6 @@ + (void)initialize { } + (NSAttributedString *)attributedStringWithString:(id)string image:(NSImage *)image { NSMutableAttributedString *attrStr; + return 0; } @end diff --git a/clang/test/CodeGenObjC/encode-test.m b/clang/test/CodeGenObjC/encode-test.m index 78a70a00e072e..b07e9e9926dc3 100644 --- a/clang/test/CodeGenObjC/encode-test.m +++ b/clang/test/CodeGenObjC/encode-test.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s +// RUN: %clang_cc1 -Wno-error=return-type -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s // RUN: FileCheck < %t %s // // CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant [16 x i8] c"v12@0:4[3[4@]]8\00" diff --git a/clang/test/CodeGenObjC/message-arrays.m b/clang/test/CodeGenObjC/message-arrays.m index 3e8697fc93760..bd5b05fda31dc 100644 --- a/clang/test/CodeGenObjC/message-arrays.m +++ b/clang/test/CodeGenObjC/message-arrays.m @@ -9,7 +9,7 @@ @interface A -(void) m: (int) arg0, ...; @end -int f1(A *a) { +void f1(A *a) { // This should also get an implicit cast (for the vararg) [a m: 1, "test"]; } diff --git a/clang/test/CodeGenObjC/metadata-symbols-32.m b/clang/test/CodeGenObjC/metadata-symbols-32.m index 825b2c61c55df..716b26790bd33 100644 --- a/clang/test/CodeGenObjC/metadata-symbols-32.m +++ b/clang/test/CodeGenObjC/metadata-symbols-32.m @@ -80,7 +80,7 @@ @interface J0 @implementation J0(Category) @end -void *f0(void) { +void f0(void) { [B im0]; [C im1]; } diff --git a/clang/test/CodeGenObjC/metadata-symbols-64.m b/clang/test/CodeGenObjC/metadata-symbols-64.m index 96a79470bfdde..944acd20f0d50 100644 --- a/clang/test/CodeGenObjC/metadata-symbols-64.m +++ b/clang/test/CodeGenObjC/metadata-symbols-64.m @@ -116,7 +116,7 @@ - (long double) RET_LONGDOUBLE } @end -void *f0(id x) { +void f0(id x) { Example* pe; double dd = [pe RET_DOUBLE]; dd = [pe RET_FLOAT]; diff --git a/clang/test/CodeGenObjC/objc2-weak-compare.m b/clang/test/CodeGenObjC/objc2-weak-compare.m index 093a78abc4892..b42fc5b396ed3 100644 --- a/clang/test/CodeGenObjC/objc2-weak-compare.m +++ b/clang/test/CodeGenObjC/objc2-weak-compare.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s -// RUN: %clang_cc1 -x objective-c++ -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s +// RUN: %clang_cc1 -Wno-error=return-type -x objective-c++ -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s @interface PBXTarget { diff --git a/clang/test/CodeGenObjC/objc2-write-barrier-2.m b/clang/test/CodeGenObjC/objc2-write-barrier-2.m index 6bc2f509083bc..68a9e7726e5c1 100644 --- a/clang/test/CodeGenObjC/objc2-write-barrier-2.m +++ b/clang/test/CodeGenObjC/objc2-write-barrier-2.m @@ -78,6 +78,7 @@ @implementation DSATextSearch inner.inner_most.nestedDeeperNames[filteredPos] = 0; inner.inner_most.arrI[3].is1[5] = 0; inner.inner_most.arrI[3].is2[5] = 0; + return 0; } @end diff --git a/clang/test/CodeGenObjC/protocols-lazy.m b/clang/test/CodeGenObjC/protocols-lazy.m index 6764d0487fe36..5e5e78c4be75e 100644 --- a/clang/test/CodeGenObjC/protocols-lazy.m +++ b/clang/test/CodeGenObjC/protocols-lazy.m @@ -41,7 +41,7 @@ @interface UserP5 // This generates a forward @protocol P5 -im1; @end @implementation UserP5 -- im1 { } +- im1 { __builtin_unreachable(); } @end diff --git a/clang/test/CodeGenObjC/strong-in-c-struct.m b/clang/test/CodeGenObjC/strong-in-c-struct.m index d7febd2741217..36f50aa98561b 100644 --- a/clang/test/CodeGenObjC/strong-in-c-struct.m +++ b/clang/test/CodeGenObjC/strong-in-c-struct.m @@ -819,10 +819,10 @@ id test_conditional0(int c) { return (c ? g2 : g1).f1; } -// CHECK-LABEL: define{{.*}} ptr @test_conditional1( +// CHECK-LABEL: define{{.*}} void @test_conditional1( // CHECK-NOT: call void @__destructor -id test_conditional1(int c) { +void test_conditional1(int c) { calleeStrongSmall(c ? g2 : g1); } @@ -836,10 +836,10 @@ id test_assignment0(void) { return (g2 = g1).f1; } -// CHECK-LABEL: define{{.*}} ptr @test_assignment1( +// CHECK-LABEL: define{{.*}} void @test_assignment1( // CHECK-NOT: call void @__destructor -id test_assignment1(void) { +void test_assignment1(void) { calleeStrongSmall(g2 = g1); } diff --git a/clang/test/CodeGenObjCXX/debug-info-line.mm b/clang/test/CodeGenObjCXX/debug-info-line.mm index bb6eaa50d7cca..9f543dbaf962d 100644 --- a/clang/test/CodeGenObjCXX/debug-info-line.mm +++ b/clang/test/CodeGenObjCXX/debug-info-line.mm @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-tables-only -fblocks -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-directives-only -fblocks -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-tables-only -fblocks -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-unknown-windows-gnu -fcxx-exceptions -fexceptions -debug-info-kind=line-directives-only -fblocks -emit-llvm %s -o - | FileCheck %s void fn(); diff --git a/clang/test/CodeGenObjCXX/instantiate-return.mm b/clang/test/CodeGenObjCXX/instantiate-return.mm index fe59602b395db..6e41d9b3d2666 100644 --- a/clang/test/CodeGenObjCXX/instantiate-return.mm +++ b/clang/test/CodeGenObjCXX/instantiate-return.mm @@ -18,5 +18,6 @@ @interface C1 @implementation C1 - (TemplateClass)m1 { + __builtin_unreachable(); } @end diff --git a/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm b/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm index cfc6d78b6b888..01fa98bd72f5b 100644 --- a/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm +++ b/clang/test/CodeGenObjCXX/pr14474-gline-tables-only.mm @@ -1,7 +1,7 @@ // PR 14474 -// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-tables-only -x objective-c++ -o /dev/null %s -// RUN: %clang_cc1 -triple i386-apple-macosx10.6.0 -emit-llvm \ +// RUN: %clang_cc1 -Wno-error=return-type -triple i386-apple-macosx10.6.0 -emit-llvm \ // RUN: -debug-info-kind=line-directives-only -x objective-c++ -o /dev/null %s typedef signed char BOOL; diff --git a/clang/test/CodeGenObjCXX/property-dot-reference.mm b/clang/test/CodeGenObjCXX/property-dot-reference.mm index 245aa4176c7df..ad745b566beab 100644 --- a/clang/test/CodeGenObjCXX/property-dot-reference.mm +++ b/clang/test/CodeGenObjCXX/property-dot-reference.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -o - %s | FileCheck %s struct TFENode { void GetURL() const; diff --git a/clang/test/CodeGenObjCXX/return.mm b/clang/test/CodeGenObjCXX/return.mm index fb77f336dfc00..c544e54131908 100644 --- a/clang/test/CodeGenObjCXX/return.mm +++ b/clang/test/CodeGenObjCXX/return.mm @@ -1,6 +1,6 @@ /// -fstrict-return is the default. -// RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -o - %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -fblocks -triple x86_64-apple-darwin -O -o - %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -fblocks -triple x86_64-apple-darwin -o - %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -fblocks -triple x86_64-apple-darwin -O -o - %s | FileCheck %s @interface I @end diff --git a/clang/test/CoverageMapping/switch.cpp b/clang/test/CoverageMapping/switch.cpp index db4cddbc6b941..1d44e7adeee4c 100644 --- a/clang/test/CoverageMapping/switch.cpp +++ b/clang/test/CoverageMapping/switch.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s +// RUN: %clang_cc1 -Wno-error=return-type -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -std=c++1z -triple %itanium_abi_triple -main-file-name switch.cpp %s | FileCheck %s // CHECK: foo void foo(int i) { // CHECK-NEXT: File 0, [[@LINE]]:17 -> [[@LINE+11]]:2 = #0 diff --git a/clang/test/Driver/cc-log-diagnostics.c b/clang/test/Driver/cc-log-diagnostics.c index 1e21c6a76022c..8cca0e9535c38 100644 --- a/clang/test/Driver/cc-log-diagnostics.c +++ b/clang/test/Driver/cc-log-diagnostics.c @@ -4,7 +4,7 @@ // RUN: %clang -Wfoobar --target=x86_64-apple-darwin11 -fsyntax-only %s // RUN: FileCheck %s < %t.log -int f0(void) {} +int; // CHECK: // CHECK: main-file @@ -27,9 +27,9 @@ int f0(void) {} // CHECK: line // CHECK: 7 // CHECK: column -// CHECK: 15 +// CHECK: 1 // CHECK: message -// CHECK: non-void function does not return a value +// CHECK: declaration does not declare anything // CHECK: // CHECK: // CHECK: diff --git a/clang/test/FixIt/fixit-availability-maccatalyst.m b/clang/test/FixIt/fixit-availability-maccatalyst.m index 1b4cec8a9fe4d..c63c9dd09c743 100644 --- a/clang/test/FixIt/fixit-availability-maccatalyst.m +++ b/clang/test/FixIt/fixit-availability-maccatalyst.m @@ -5,7 +5,7 @@ void anotherFunction(int function); -int use(void) { +void use(void) { function(); // CHECK: fix-it:{{.*}}:{[[@LINE-1]]:3-[[@LINE-1]]:3}:"if (@available(macCatalyst 13.2, *)) {\n " // CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:14-[[@LINE-2]]:14}:"\n } else {\n // Fallback on earlier versions\n }" diff --git a/clang/test/FixIt/fixit-c++11.cpp b/clang/test/FixIt/fixit-c++11.cpp index e635c14e0c215..acbc1b11f88e4 100644 --- a/clang/test/FixIt/fixit-c++11.cpp +++ b/clang/test/FixIt/fixit-c++11.cpp @@ -59,7 +59,7 @@ void S2::f(int i) { (void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}} (void)[&, i, i]{ }; // expected-error{{'i' can appear only once in a capture list}} (void)[] mutable {}; - (void)[]->int{}; + (void)[]->int{ return 0; }; #if __cplusplus <= 202002L // expected-warning@-3{{is a C++23 extension}} // expected-warning@-3{{is a C++23 extension}} diff --git a/clang/test/Frontend/absolute-paths.c b/clang/test/Frontend/absolute-paths.c index 8a9687195c36b..e06cf262dd8e2 100644 --- a/clang/test/Frontend/absolute-paths.c +++ b/clang/test/Frontend/absolute-paths.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=NORMAL -check-prefix=CHECK %s -// RUN: %clang_cc1 -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. -fdiagnostics-absolute-paths %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=ABSOLUTE -check-prefix=CHECK %s +// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=NORMAL -check-prefix=CHECK %s +// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -I %S/Inputs/SystemHeaderPrefix/.. -fdiagnostics-absolute-paths %s 2>&1 | FileCheck -DROOT_ABSOLUTE=%s -check-prefix=ABSOLUTE -check-prefix=CHECK %s #include "absolute-paths-import.h" // NORMAL: In file included from {{.*}}absolute-paths.c:4: diff --git a/clang/test/Frontend/ast-codegen.c b/clang/test/Frontend/ast-codegen.c index 53721a463217f..2e2e3d360dd17 100644 --- a/clang/test/Frontend/ast-codegen.c +++ b/clang/test/Frontend/ast-codegen.c @@ -8,6 +8,6 @@ __asm__("foo"); // CHECK: @g0 = dso_local global i32 0, align 4 int g0; -// CHECK: define dso_local i32 @f0() -int f0(void) { +// CHECK: define dso_local void @f0() +void f0(void) { } diff --git a/clang/test/Frontend/ast-main.cpp b/clang/test/Frontend/ast-main.cpp index e6e2825bb332a..fe47ce435f068 100644 --- a/clang/test/Frontend/ast-main.cpp +++ b/clang/test/Frontend/ast-main.cpp @@ -1,6 +1,6 @@ -// RUN: env SDKROOT="/" %clang -emit-llvm -S -o %t1.ll -x c++ - < %s -// RUN: env SDKROOT="/" %clang -fno-delayed-template-parsing -emit-ast -o %t.ast %s -// RUN: env SDKROOT="/" %clang -emit-llvm -S -o %t2.ll -x ast - < %t.ast +// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o %t1.ll -x c++ - < %s +// RUN: env SDKROOT="/" %clang -Wno-error=return-type -fno-delayed-template-parsing -emit-ast -o %t.ast %s +// RUN: env SDKROOT="/" %clang -Wno-error=return-type -emit-llvm -S -o %t2.ll -x ast - < %t.ast // RUN: diff %t1.ll %t2.ll // http://llvm.org/bugs/show_bug.cgi?id=15377 diff --git a/clang/test/Misc/serialized-diags-stable.c b/clang/test/Misc/serialized-diags-stable.c index e8ee83ec7499d..f2278a3ed9dc4 100644 --- a/clang/test/Misc/serialized-diags-stable.c +++ b/clang/test/Misc/serialized-diags-stable.c @@ -1,5 +1,5 @@ // RUN: rm -f %t -// RUN: not %clang -Wall -fsyntax-only %s --serialize-diagnostics %t.dia > /dev/null 2>&1 +// RUN: not %clang -Wno-error=return-type -Wall -fsyntax-only %s --serialize-diagnostics %t.dia > /dev/null 2>&1 // RUN: c-index-test -read-diagnostics %t.dia 2>&1 | FileCheck %s // RUN: c-index-test -read-diagnostics %S/Inputs/serialized-diags-stable.dia 2>&1 | FileCheck %s diff --git a/clang/test/Modules/pr61067.cppm b/clang/test/Modules/pr61067.cppm index 50ab7ba201298..9e33123ee6dbe 100644 --- a/clang/test/Modules/pr61067.cppm +++ b/clang/test/Modules/pr61067.cppm @@ -49,6 +49,7 @@ import a; int c() { (void)(a() == a()); + return 0; } // CHECK: define{{.*}}linkonce_odr{{.*}}@_ZW1aeqS_1aS0_( diff --git a/clang/test/Modules/redecl-merge.m b/clang/test/Modules/redecl-merge.m index 746be5ec4e774..d2a2490572610 100644 --- a/clang/test/Modules/redecl-merge.m +++ b/clang/test/Modules/redecl-merge.m @@ -1,5 +1,5 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wreturn-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class +// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -Wno-error=return-type -fmodules-cache-path=%t -I %S/Inputs %s -verify -Wno-objc-root-class @class C2; @class C3; diff --git a/clang/test/PCH/irgen-rdar13114142.mm b/clang/test/PCH/irgen-rdar13114142.mm index d3687637eefab..2257587290d7c 100644 --- a/clang/test/PCH/irgen-rdar13114142.mm +++ b/clang/test/PCH/irgen-rdar13114142.mm @@ -20,11 +20,13 @@ public: OOArray matchAll(const OOString &)const { __attribute__((__blocks__(byref))) OOArray out; + return {}; } }; OOArray operator & (const OOPattern & pattern) { pattern.matchAll(0); + return {}; } OOArray operator & (OOString, OOString); diff --git a/clang/test/PCH/late-parsed-instantiations.cpp b/clang/test/PCH/late-parsed-instantiations.cpp index 9ae6b56a09bef..080be09f6748c 100644 --- a/clang/test/PCH/late-parsed-instantiations.cpp +++ b/clang/test/PCH/late-parsed-instantiations.cpp @@ -1,12 +1,12 @@ -// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch %s -o %t.pch -verify -// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify +// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -emit-pch %s -o %t.pch -verify +// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify -// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify -// RUN: %clang_cc1 -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify +// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify +// RUN: %clang_cc1 -Wno-error=return-type -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify // Run this test for i686 as this is the target that modifies default FP options. -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify -// RUN: %clang_cc1 -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify +// RUN: %clang_cc1 -Wno-error=return-type -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -emit-pch -fpch-instantiate-templates %s -o %t.pch -verify +// RUN: %clang_cc1 -Wno-error=return-type -triple i686-pc-linux-gnu -fdelayed-template-parsing -std=c++14 -include-pch %t.pch %s -verify #ifndef HEADER_INCLUDED diff --git a/clang/test/PCH/pr4489.c b/clang/test/PCH/pr4489.c index 574e33f18c0d7..a8f686ca44575 100644 --- a/clang/test/PCH/pr4489.c +++ b/clang/test/PCH/pr4489.c @@ -1,6 +1,6 @@ -// RUN: %clang -x c-header -o %t.pch %s +// RUN: %clang -Wno-error=return-type -x c-header -o %t.pch %s // RUN: echo > %t.empty.c -// RUN: %clang -include %t -x c %t.empty.c -emit-llvm -S -o - +// RUN: %clang -Wno-error=return-type -include %t -x c %t.empty.c -emit-llvm -S -o - // PR 4489: Crash with PCH // PR 4492: Crash with PCH (round two) diff --git a/clang/test/PCH/va_arg.c b/clang/test/PCH/va_arg.c index 2bbf3c5ebd75a..44a7d2b8ba5b6 100644 --- a/clang/test/PCH/va_arg.c +++ b/clang/test/PCH/va_arg.c @@ -10,10 +10,12 @@ char *g0(char** argv, int argc) { return argv[argc]; } char *g(char **argv) { f(g0, argv, 1, 2, 3); + return argv[0]; } char *i0(char **argv, int argc) { return argv[argc]; } char *i(char **argv) { h(i0, argv, 1, 2, 3); + return argv[0]; } diff --git a/clang/test/PCH/va_arg.h b/clang/test/PCH/va_arg.h index 255c6589a7e85..beb49396f7b74 100644 --- a/clang/test/PCH/va_arg.h +++ b/clang/test/PCH/va_arg.h @@ -5,6 +5,7 @@ char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; s = g (p, __builtin_va_arg(v, int)); + return s; } typedef __builtin_ms_va_list __ms_va_list; @@ -12,4 +13,5 @@ char *__attribute__((ms_abi)) h(char *(*i)(char **, int), char **p, ...) { char *s; __ms_va_list v; s = i(p, __builtin_va_arg(v, int)); + return s; } diff --git a/clang/test/Parser/promote_types_in_proto.c b/clang/test/Parser/promote_types_in_proto.c index 969ba28120f23..650dae0a5e727 100644 --- a/clang/test/Parser/promote_types_in_proto.c +++ b/clang/test/Parser/promote_types_in_proto.c @@ -2,7 +2,7 @@ void functionPromotion(void f(char *const [])); void arrayPromotion(char * const argv[]); -int whatever(int argc, char *argv[]) +void whatever(int argc, char *argv[]) { arrayPromotion(argv); functionPromotion(arrayPromotion); diff --git a/clang/test/Rewriter/rewrite-extern-c.mm b/clang/test/Rewriter/rewrite-extern-c.mm index 2941504ab78d8..daebb07f8fbf2 100644 --- a/clang/test/Rewriter/rewrite-extern-c.mm +++ b/clang/test/Rewriter/rewrite-extern-c.mm @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -o - %s extern "C" { - short foo() { } + short foo() { return 0; } } typedef unsigned char Boolean; diff --git a/clang/test/Sema/freemain.c b/clang/test/Sema/freemain.c index 83d7a4d56eac9..7bd08c4ed7904 100644 --- a/clang/test/Sema/freemain.c +++ b/clang/test/Sema/freemain.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i686-pc-openbsd -fsyntax-only -verify -ffreestanding %s +// RUN: %clang_cc1 -Werror=return-type -triple i686-pc-openbsd -fsyntax-only -verify -ffreestanding %s // Tests that -ffreestanding disables all special treatment of main(). @@ -6,4 +6,4 @@ void* allocate(long size); void* main(void* context, long size) { if (context) return allocate(size); -} // expected-warning {{non-void function does not return a value in all control paths}} +} // expected-error {{non-void function does not return a value in all control paths}} diff --git a/clang/test/Sema/return-type-mismatch.c b/clang/test/Sema/return-type-mismatch.c index 79a625d7df1f5..d3d0e37c06db4 100644 --- a/clang/test/Sema/return-type-mismatch.c +++ b/clang/test/Sema/return-type-mismatch.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -Wreturn-type -Wno-return-mismatch -fsyntax-only -verify=return-type %s +// RUN: %clang_cc1 -Wno-error=return-type -Wno-return-mismatch -fsyntax-only -verify=return-type %s // RUN: %clang_cc1 -Wno-return-type -Wreturn-mismatch -fsyntax-only -verify=return-mismatch %s int foo(void) __attribute__((noreturn)); diff --git a/clang/test/SemaCXX/attr-noreturn.cpp b/clang/test/SemaCXX/attr-noreturn.cpp index e6de5ad45d340..f2d4964f8ebd8 100644 --- a/clang/test/SemaCXX/attr-noreturn.cpp +++ b/clang/test/SemaCXX/attr-noreturn.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -Wno-error=return-type -fsyntax-only -verify %s // Reachability tests have to come first because they get suppressed // if any errors have occurred. diff --git a/clang/test/SemaCXX/constant-expression-cxx14.cpp b/clang/test/SemaCXX/constant-expression-cxx14.cpp index 579883ae52cce..e16a69df3830d 100644 --- a/clang/test/SemaCXX/constant-expression-cxx14.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx14.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -triple=x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify=expected,cxx14_20,cxx20_23,cxx20 %s -fcxx-exceptions -triple=x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++14 -fsyntax-only -verify=expected,cxx14_20,cxx14 %s -fcxx-exceptions -triple=x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++23 -Werror=return-type -fsyntax-only -verify=expected,cxx20_23,cxx23 %s -fcxx-exceptions -triple=x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++20 -Werror=return-type -fsyntax-only -verify=expected,cxx14_20,cxx20_23,cxx20 %s -fcxx-exceptions -triple=x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++14 -Werror=return-type -fsyntax-only -verify=expected,cxx14_20,cxx14 %s -fcxx-exceptions -triple=x86_64-linux-gnu struct S { // dummy ctor to make this a literal type @@ -68,7 +68,7 @@ constexpr int j(int k) { } } } // expected-note 2{{control reached end of constexpr function}} - // cxx23-warning@-1 {{does not return a value in all control paths}} + // cxx23-error@-1 {{does not return a value in all control paths}} static_assert(j(0) == -3, ""); static_assert(j(1) == 5, ""); static_assert(j(2), ""); // expected-error {{constant expression}} expected-note {{in call to 'j(2)'}} diff --git a/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp b/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp index e3228dddef5f6..713ba90a00349 100644 --- a/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp +++ b/clang/test/SemaCXX/constexpr-return-non-void-cxx2b.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++23 -fsyntax-only -Wimplicit-fallthrough -Wconsumed -verify %s +// RUN: %clang_cc1 -Wno-error=return-type -std=c++23 -fsyntax-only -Wimplicit-fallthrough -Wconsumed -verify %s constexpr int f() { } // expected-warning {{non-void function does not return a value}} static_assert(__is_same(decltype([] constexpr -> int { }( )), int)); // expected-warning {{non-void lambda does not return a value}} diff --git a/clang/test/SemaCXX/err-missing-noreturn-1.cpp b/clang/test/SemaCXX/err-missing-noreturn-1.cpp new file mode 100644 index 0000000000000..29627a7bef1d3 --- /dev/null +++ b/clang/test/SemaCXX/err-missing-noreturn-1.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type -Werror=return-type + +struct rdar8875247 { + ~rdar8875247 (); +}; + +int rdar8875247_test() { + rdar8875247 f; +} // expected-error{{non-void function does not return a value}} diff --git a/clang/test/SemaCXX/err-missing-noreturn-2.cpp b/clang/test/SemaCXX/err-missing-noreturn-2.cpp new file mode 100644 index 0000000000000..b1888fbb33ccf --- /dev/null +++ b/clang/test/SemaCXX/err-missing-noreturn-2.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -Wmissing-noreturn -Wreturn-type +// expected-no-diagnostics + +namespace GH63009 { +struct S1 { + [[noreturn]] S1(); +}; + +int foo(); + +int test_1() { + S1 s1; + foo(); +} +} diff --git a/clang/test/SemaCXX/return-noreturn.cpp b/clang/test/SemaCXX/return-noreturn.cpp index b88e5a519d1bb..873e4c7e12f23 100644 --- a/clang/test/SemaCXX/return-noreturn.cpp +++ b/clang/test/SemaCXX/return-noreturn.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default -// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -std=c++11 -verify -Wreturn-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default +// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -verify -Wreturn-type -Wno-error=return-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default +// RUN: %clang_cc1 %s -fsyntax-only -fcxx-exceptions -std=c++11 -verify -Wreturn-type -Wno-error=return-type -Wmissing-noreturn -Wno-unreachable-code -Wno-covered-switch-default // A destructor may be marked noreturn and should still influence the CFG. void pr6884_abort() __attribute__((noreturn)); diff --git a/clang/test/SemaCXX/warn-missing-noreturn.cpp b/clang/test/SemaCXX/warn-missing-noreturn.cpp index 32b49e0a325f2..208a0fae68cd1 100644 --- a/clang/test/SemaCXX/warn-missing-noreturn.cpp +++ b/clang/test/SemaCXX/warn-missing-noreturn.cpp @@ -88,10 +88,6 @@ struct rdar8875247 { }; void rdar8875247_aux(); -int rdar8875247_test() { - rdar8875247 f; -} // expected-warning{{non-void function does not return a value}} - struct rdar8875247_B { rdar8875247_B(); ~rdar8875247_B(); @@ -124,21 +120,12 @@ namespace PR10801 { } namespace GH63009 { -struct S1 { - [[noreturn]] S1(); -}; - struct S2 { [[noreturn]] ~S2(); }; int foo(); -int test_1() { - S1 s1; - foo(); -} - int test_2() { S2 s2; foo(); diff --git a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp index 1484f7e9d36c2..007b3a43a3d97 100644 --- a/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp +++ b/clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp @@ -46,7 +46,7 @@ void add_assign_test(unsigned int n, int *a, int y) { // CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]:5-[[@LINE-1]]:9}:"p = p.subspan(" } -int expr_test(unsigned x, int *q, int y) { +void expr_test(unsigned x, int *q, int y) { char *p = new char[8]; // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:3-[[@LINE-1]]:9}:"std::span " // CHECK: fix-it:"{{.*}}":{[[@LINE-2]]:13-[[@LINE-2]]:13}:"{" diff --git a/clang/test/SemaObjC/return-noreturn.m b/clang/test/SemaObjC/return-noreturn.m index c7735ca211e6d..c7b611559d86f 100644 --- a/clang/test/SemaObjC/return-noreturn.m +++ b/clang/test/SemaObjC/return-noreturn.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -fsyntax-only -fobjc-exceptions -verify -Wreturn-type -Wmissing-noreturn +// RUN: %clang_cc1 %s -fsyntax-only -fobjc-exceptions -verify -Wreturn-type -Wmissing-noreturn -Werror=return-type id f(id self) { -} // expected-warning {{non-void function does not return a value}} +} // expected-error {{non-void function does not return a value}} id f2(id self) { @try { diff --git a/clang/test/SemaObjC/try-catch.m b/clang/test/SemaObjC/try-catch.m index 0bea7a5150a49..1216b540a8d21 100644 --- a/clang/test/SemaObjC/try-catch.m +++ b/clang/test/SemaObjC/try-catch.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions %s +// RUN: %clang_cc1 -fsyntax-only -verify -fobjc-exceptions -Werror=return-type %s typedef signed char BOOL; typedef struct _NSZone NSZone; @@ -34,7 +34,7 @@ - (NSDictionary *)setUpInfoForTransformKey:(NSString *)transformKey outError:(NS @try {} // the exception name is optional (weird) @catch (NSException *) {} -} // expected-warning {{non-void function does not return a value}} +} // expected-error {{non-void function does not return a value}} - (NSDictionary *)anotherFunction { @try {} diff --git a/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp b/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp index 0e654768787aa..90f4d3261c5a2 100644 --- a/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp +++ b/clang/test/SemaTemplate/late-parsing-eager-instantiation.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++14 -verify %s +// RUN: %clang_cc1 -Wno-error=return-type -std=c++14 -verify %s // pr33561 class ArrayBuffer; diff --git a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp index 92ec79d126575..5e1c12ba26d87 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp @@ -4329,7 +4329,7 @@ TEST_P(ASTMatchersTest, hasOperator) { TEST_P(ASTMatchersTest, IsMain) { EXPECT_TRUE(matches("int main() {}", functionDecl(isMain()))); - EXPECT_TRUE(notMatches("int main2() {}", functionDecl(isMain()))); + EXPECT_TRUE(notMatches("int main2() { return 0; }", functionDecl(isMain()))); } TEST_P(ASTMatchersTest, OMPExecutableDirective_IsStandaloneDirective) { diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp index 75d6ca5ba17f8..068cf66771027 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp @@ -665,6 +665,7 @@ void check_match_co_return() { #include void check_match_co_await() { co_await a; + co_return 1; } )cpp"; EXPECT_TRUE(matchesConditionally(CoAwaitCode, @@ -674,6 +675,7 @@ void check_match_co_await() { #include void check_match_co_yield() { co_yield 1.0; + co_return 1; } )cpp"; EXPECT_TRUE(matchesConditionally(CoYieldCode, @@ -714,7 +716,7 @@ void coro() { void coro() try { int thevar; co_return 1; -} catch (...) {} +} catch (...) { co_return 1; } )cpp"; EXPECT_TRUE(matchesConditionally( CoroWithTryCatchDeclCode, diff --git a/clang/unittests/Tooling/ASTSelectionTest.cpp b/clang/unittests/Tooling/ASTSelectionTest.cpp index 1897bc15196ec..0f60749725cde 100644 --- a/clang/unittests/Tooling/ASTSelectionTest.cpp +++ b/clang/unittests/Tooling/ASTSelectionTest.cpp @@ -384,7 +384,7 @@ TEST(ASTSelectionFinder, SelectionInFunctionInObjCImplementation) { @end @implementation I -int notSelected() { } +int notSelected() { return 0; } int selected(int x) { return x; diff --git a/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp b/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp index b167eb4b81175..c0833dc4a640d 100644 --- a/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp +++ b/clang/unittests/Tooling/LexicallyOrderedRecursiveASTVisitorTest.cpp @@ -107,7 +107,7 @@ TEST(LexicallyOrderedRecursiveASTVisitor, VisitDeclsInImplementation) { @end @implementation I -int nestedFunction() { } +void nestedFunction() { } - (void) method{ } diff --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp index a551f83ff3f9c..d58e190923a1f 100644 --- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp +++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp @@ -4604,7 +4604,7 @@ TEST_P(BuildSyntaxTreeTest, ConstructorCall_DefaultArguments) { struct X { X(int i = 1, char c = '2'); }; -X test() { +void test() { auto x0 = [[X()]]; auto x1 = [[X(1)]]; auto x2 = [[X(1, '2')]];