Skip to content

Commit 12f78e7

Browse files
authored
[Clang] [NFC] Fix unintended -Wreturn-type warnings everywhere in the test suite (#123464)
In preparation of making `-Wreturn-type` default to an error (as there is virtually no situation where you’d *want* to fall off the end of a function that is supposed to return a value), this patch fixes tests that have relied on this being only a warning, of which there seem to be 3 kinds: 1. Tests which for no apparent reason have a function that triggers the warning. I suspect that a lot of these were on accident (or from before the warning was introduced), since a lot of people will open issues w/ their problematic code in the `main` function (which is the one case where you don’t need to return from a non-void function, after all...), which someone will then copy, possibly into a namespace, possibly renaming it, the end result of that being that you end up w/ something that definitely is not `main` anymore, but which still is declared as returning `int`, and which still has no return statement (another reason why I think this might apply to a lot of these is because usually the actual return type of such problematic functions is quite literally `int`). A lot of these are really old tests that don’t use `-verify`, which is why no-one noticed or had to care about the extra warning that was already being emitted by them until now. 2. Tests which test either `-Wreturn-type`, `[[noreturn]]`, or what codegen and sanitisers do whenever you do fall off the end of a function. 3. Tests where I struggle to figure out what is even being tested (usually because they’re Objective-C tests, and I don’t know Objective-C), whether falling off the end of a function matters in the first place, and tests where actually spelling out an expression to return would be rather cumbersome (e.g. matrix types currently don’t support list initialisation, so I can’t write e.g. `return {}`). For tests that fall into categories 2 and 3, I just added `-Wno-error=return-type` to the `RUN` lines and called it a day. This was especially necessary for the former since `-Wreturn-type` is an analysis-based warning, meaning that it is currently impossible to test for more than one occurrence of it in the same compilation if it defaults to an error since the analysis pass is skipped for subsequent functions as soon as an error is emitted. I’ve also added `-Werror=return-type` to a few tests that I had already updated as this patch was previously already making the warning an error by default, but we’ve decided to split that into two patches instead.
1 parent a5fb2bb commit 12f78e7

File tree

147 files changed

+271
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+271
-211
lines changed

clang/test/ARCMT/autoreleases.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ id test2(A* val) {
6969
return val;
7070
}
7171

72-
id test3(void) {
72+
void test3(void) {
7373
id a = [[A alloc] init];
7474
[a autorelease];
7575
}

clang/test/ARCMT/autoreleases.m.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ id test2(A* val) {
6464
return val;
6565
}
6666

67-
id test3(void) {
67+
void test3(void) {
6868
id a = [[A alloc] init];
6969
}

clang/test/ARCMT/retains.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ @implementation Foo
2121

2222
@synthesize bar;
2323

24-
-(id)something {}
24+
-(id)something { return (id)0; }
2525

2626
-(id)test:(id)obj {
2727
id x = self.bar;

clang/test/ARCMT/retains.m.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ id IhaveSideEffect(void);
2121

2222
@synthesize bar;
2323

24-
-(id)something {}
24+
-(id)something { return (id)0; }
2525

2626
-(id)test:(id)obj {
2727
id x = self.bar;

clang/test/AST/ast-dump-cxx2b-deducing-this.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct S {
55
int f(this S&);
66
};
77

8-
int main() {
8+
void main() {
99
S s;
1010
int x = s.f();
1111
// CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int

clang/test/AST/ast-dump-special-member-functions.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -253,25 +253,25 @@ struct TrivialCopyAssignment {
253253
struct NontrivialCopyAssignment {
254254
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialCopyAssignment definition
255255
// CHECK: CopyAssignment {{.*}}non_trivial{{.*}}
256-
NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) {}
256+
NontrivialCopyAssignment& operator=(const NontrivialCopyAssignment&) { return *this; }
257257
};
258258

259259
struct CopyAssignmentHasConstParam {
260260
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentHasConstParam definition
261261
// CHECK: CopyAssignment {{.*}}has_const_param{{.*}}
262-
CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) {}
262+
CopyAssignmentHasConstParam& operator=(const CopyAssignmentHasConstParam&) { return *this; }
263263
};
264264

265265
struct CopyAssignmentDoesNotHaveConstParam {
266266
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct CopyAssignmentDoesNotHaveConstParam definition
267267
// CHECK-NOT: CopyAssignment {{.*}} has_const_param{{.*}}
268-
CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) {}
268+
CopyAssignmentDoesNotHaveConstParam& operator=(CopyAssignmentDoesNotHaveConstParam&) { return *this; }
269269
};
270270

271271
struct UserDeclaredCopyAssignment {
272272
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredCopyAssignment definition
273273
// CHECK: CopyAssignment {{.*}}user_declared{{.*}}
274-
UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) {}
274+
UserDeclaredCopyAssignment& operator=(const UserDeclaredCopyAssignment&) { return *this; }
275275
};
276276

277277
struct NonUserDeclaredCopyAssignment {
@@ -288,7 +288,7 @@ struct NeedsImplicitCopyAssignment {
288288
struct DoesNotNeedImplicitCopyAssignment {
289289
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitCopyAssignment definition
290290
// CHECK-NOT: CopyAssignment {{.*}}needs_implicit{{.*}}
291-
DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) {}
291+
DoesNotNeedImplicitCopyAssignment& operator=(const DoesNotNeedImplicitCopyAssignment&) { return *this; }
292292
};
293293

294294
struct DeclaresCopyAssignment {
@@ -352,13 +352,13 @@ struct TrivialMoveAssignment {
352352
struct NontrivialMoveAssignment {
353353
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct NontrivialMoveAssignment definition
354354
// CHECK: MoveAssignment {{.*}}non_trivial{{.*}}
355-
NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) {}
355+
NontrivialMoveAssignment& operator=(NontrivialMoveAssignment&&) { return *this; }
356356
};
357357

358358
struct UserDeclaredMoveAssignment {
359359
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct UserDeclaredMoveAssignment definition
360360
// CHECK: MoveAssignment {{.*}}user_declared{{.*}}
361-
UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) {}
361+
UserDeclaredMoveAssignment& operator=(UserDeclaredMoveAssignment&&) { return *this; }
362362
};
363363

364364
struct NonUserDeclaredMoveAssignment {
@@ -375,7 +375,7 @@ struct NeedsImplicitMoveAssignment {
375375
struct DoesNotNeedImplicitMoveAssignment {
376376
// CHECK: CXXRecordDecl 0x{{[^ ]*}} <line:[[@LINE-1]]:1, line:[[@LINE+3]]:1> line:[[@LINE-1]]:8 struct DoesNotNeedImplicitMoveAssignment definition
377377
// CHECK-NOT: MoveAssignment {{.*}}needs_implicit{{.*}}
378-
DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) {}
378+
DoesNotNeedImplicitMoveAssignment& operator=(DoesNotNeedImplicitMoveAssignment&&) { return *this; }
379379
};
380380

381381
struct MoveAssignmentNeedsOverloadResolution : virtual DeletedDestructor {

clang/test/Analysis/Inputs/expected-plists/plist-output.m.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6151,7 +6151,7 @@
61516151
<key>type</key><string>Argument with &apos;nonnull&apos; attribute passed null</string>
61526152
<key>check_name</key><string>core.NonNullParamChecker</string>
61536153
<!-- This hash is experimental and going to change! -->
6154-
<key>issue_hash_content_of_line_in_context</key><string>c0b359a043c633f1b8d1581f68743361</string>
6154+
<key>issue_hash_content_of_line_in_context</key><string>4c580a2a9cf15947fa485a0a9e625306</string>
61556155
<key>issue_context_kind</key><string>function</string>
61566156
<key>issue_context</key><string>RDar13295437</string>
61576157
<key>issue_hash_function_offset</key><string>3</string>

clang/test/Analysis/const-method-call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
1+
// RUN: %clang_analyze_cc1 -Wno-error=return-type -analyzer-checker=core,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
22

33
void clang_analyzer_eval(bool);
44

clang/test/Analysis/inline-unique-reports.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 %s -analyzer-checker=core.NullDereference -analyzer-output=plist -Wno-error=implicit-int -o %t > /dev/null 2>&1
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
22
// RUN: %normalize_plist <%t | diff -ub %S/Inputs/expected-plists/inline-unique-reports.c.plist -
33

44
static inline bug(int *p) {

clang/test/Analysis/malloc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,8 +1914,8 @@ variable 'buf', which is not memory allocated by 'malloc()' [unix.Malloc]}}
19141914

19151915
(*crash_a)(); // expected-warning{{type specifier missing}}
19161916
// A CallEvent without a corresponding FunctionDecl.
1917-
crash_b() { crash_a(); } // no-crash
1918-
// expected-warning@-1{{type specifier missing}} expected-warning@-1{{non-void}}
1917+
crash_b() { crash_a(); return 0; } // no-crash
1918+
// expected-warning@-1{{type specifier missing}}
19191919

19201920
long *global_a;
19211921
void realloc_crash(void) {

clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.1 2>&1
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
22
// RUN: FileCheck -input-file=%t.1 -check-prefix=CHECK-darwin8 %s
3-
// RUN: %clang_analyze_cc1 -triple i386-apple-darwin9 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.2 2>&1
3+
// 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
44
// RUN: FileCheck -input-file=%t.2 -check-prefix=CHECK-darwin9 %s
5-
// RUN: %clang_analyze_cc1 -triple thumbv6-apple-ios4.0 -analyzer-checker=core,alpha.core -Wno-objc-root-class %s > %t.3 2>&1
5+
// 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
66
// RUN: FileCheck -input-file=%t.3 -check-prefix=CHECK-darwin9 %s
77

88
@interface MyClass {}

clang/test/Analysis/novoidtypecrash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -std=c89 -Wno-int-conversion -analyzer-checker=core %s
1+
// RUN: %clang_analyze_cc1 -Wno-error=return-type -std=c89 -Wno-int-conversion -analyzer-checker=core %s
22
x;
33
y(void **z) { // no-crash
44
*z = x;

clang/test/Analysis/plist-output.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ - (void)test {
177177

178178
struct RDar13295437_S { int *i; };
179179

180-
int RDar13295437(void) {
180+
void RDar13295437(void) {
181181
struct RDar13295437_S s = {0};
182182
struct RDar13295437_S *sp = &s;
183183
RDar13295437_f(sp->i);

clang/test/Analysis/plist-stats-output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// REQUIRES: asserts
33
// RUN: FileCheck --input-file=%t.plist %s
44

5-
int foo(void) {}
5+
void foo(void) {}
66

77

88
// CHECK: <key>diagnostics</key>

clang/test/Analysis/scopes-cfg-output.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ void test_switch_with_compound_with_default() {
10741074
// CHECK-NEXT: Succs (1): B4
10751075
// CHECK: [B0 (EXIT)]
10761076
// CHECK-NEXT: Preds (1): B1
1077-
int test_switch_with_compound_without_default() {
1077+
void test_switch_with_compound_without_default() {
10781078
char c = '1';
10791079
switch (int i = getX()) {
10801080
case 0:

clang/test/Analysis/structured_bindings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
void clang_analyzer_eval(bool);
44

55
struct s { int a; };
6-
int foo() {
6+
void foo() {
77
auto [a] = s{1};
88
clang_analyzer_eval(a == 1); // expected-warning{{TRUE}}
9-
} // expected-warning{{non-void function does not return a value}}
9+
}
1010

1111
struct s2 {
1212
int &x;

clang/test/CXX/drs/cwg605.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ template <class T>
1212
static T f(T t) {}
1313

1414
template <>
15-
int f(int t) {}
15+
int f(int t) { return 0; }
1616

1717
void g(int a) {
1818
f(a);

clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// RUN: %clang_cc1 -std=c++11 %s -Winvalid-noreturn -verify
1+
// RUN: %clang_cc1 -Werror=return-type -std=c++11 %s -Winvalid-noreturn -verify
22

33
// An attribute-specifier-seq in a lambda-declarator appertains to the
44
// type of the corresponding function call operator.
55
void test_attributes() {
6-
auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-warning{{on-void lambda does not return a value in all control paths}}
6+
auto nrl = [](int x) -> int { if (x > 0) return x; }; // expected-error{{non-void lambda does not return a value in all control paths}}
77

88
// FIXME: GCC accepts the [[gnu::noreturn]] attribute here.
99
auto nrl2 = []() [[gnu::noreturn]] { return; }; // expected-warning{{attribute 'noreturn' ignored}}

clang/test/CXX/expr/expr.prim/expr.prim.lambda/p7.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
1+
// RUN: %clang_cc1 -Werror=return-type -fsyntax-only -std=c++11 %s -verify
22

33
// Check that analysis-based warnings work in lambda bodies.
44
void analysis_based_warnings() {
5-
(void)[]() -> int { }; // expected-warning{{non-void lambda does not return a value}}
5+
(void)[]() -> int { }; // expected-error{{non-void lambda does not return a value}}
66
}
77

88
// Check that we get the right types of captured variables (the

clang/test/CodeGen/2003-06-26-CFECrash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef struct Globals {
1313

1414
extern Uz_Globs G;
1515

16-
int extract_or_test_files(void) {
16+
void extract_or_test_files(void) {
1717
G.pInfo = G.info;
1818
}
1919

clang/test/CodeGen/2003-08-18-SigSetJmp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ typedef int sigjmp_buf[_JBLEN + 1];
55
int sigsetjmp(sigjmp_buf env, int savemask);
66
void bar(void);
77
sigjmp_buf B;
8-
int foo(void) {
8+
void foo(void) {
99
sigsetjmp(B, 1);
1010
bar();
1111
}

clang/test/CodeGen/2003-08-23-LocalUnionTest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
union foo { int X; };
66

7-
int test(union foo* F) {
7+
void test(union foo* F) {
88
{
99
union foo { float X; } A;
1010
}

clang/test/CodeGen/2003-10-29-AsmRename.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ int Func64(struct bar* B) {
1616
}
1717

1818

19-
int test(void) {
19+
void test(void) {
2020
Func(0); /* should be renamed to call Func64 */
2121
Func64(0);
2222
}

clang/test/CodeGen/2003-11-20-ComplexDivision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
22

3-
int test(void) {
3+
void test(void) {
44
__complex__ double C;
55
double D;
66
C / D;

clang/test/CodeGen/2004-06-18-VariableLengthArrayOfStructures.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
struct S { };
55

6-
int xxxx(int a) {
6+
void xxxx(int a) {
77
struct S comps[a];
88
comps[0];
99
}

clang/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ void bar(void) {
1414
int func(void);
1515
foo(func);
1616
}
17-
static int func(char** A, char ** B) {}
17+
static int func(char** A, char ** B) { return 0; }

clang/test/CodeGen/2005-01-02-VAArgError-ICE.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// PR481
33
// RUN: %clang_cc1 %s -Wno-implicit-function-declaration -emit-llvm -o /dev/null
44

5-
int flags(int a, int b, ...) {
5+
void flags(int a, int b, ...) {
66
__builtin_va_list args;
77
__builtin_va_start(args,a); // not the last named arg
88
foo(args);

clang/test/CodeGen/2005-06-15-ExpandGotoInternalProblem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -std=c99 %s -emit-llvm -o - | \
1+
// RUN: %clang_cc1 -Wno-error=return-type -std=c99 %s -emit-llvm -o - | \
22
// RUN: opt -O3 -disable-output
33
// PR580
44

clang/test/CodeGen/2007-01-06-KNR-Proto.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ int svc_register (void (*dispatch) (int));
66
int svc_register (dispatch)
77
void (*dispatch) ();
88
{
9+
return 0;
910
}
1011

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_cc1 -emit-llvm -O2 %s -o /dev/null
1+
// RUN: %clang_cc1 -Wno-error=return-type -emit-llvm -O2 %s -o /dev/null
22
// PR2292.
33
__inline__ __attribute__ ((__pure__)) int g (void) {}
44
void f (int k) { k = g (); }

clang/test/CodeGen/2008-07-30-redef-of-bitcasted-decl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ static void bar(void *db) {
2222

2323
char s[5] = "hi";
2424

25-
int foo(void) {
25+
void foo(void) {
2626
bar(0);
2727
}

clang/test/CodeGen/2008-10-13-FrontendCrash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_cc1 %s -std=c89 -emit-llvm -o -
22
// PR2797
33

4-
unsigned int
4+
void
55
func_48 (signed char p_49)
66
{
77
signed char l_340;

clang/test/CodeGen/2009-01-21-InvalidIterator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ frame_hdr_cache[8];
6363
_Unwind_Ptr
6464
base_from_cb_data (struct unw_eh_callback_data *data)
6565
{
66+
return 0;
6667
}
6768

6869
void

clang/test/CodeGen/2009-05-04-EnumInreg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ enum kobject_action {
1414
struct kobject;
1515

1616
// CHECK: i32 inreg %action
17-
int kobject_uevent(struct kobject *kobj, enum kobject_action action) {}
17+
void kobject_uevent(struct kobject *kobj, enum kobject_action action) {}

clang/test/CodeGen/2009-07-15-pad-wchar_t-array.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ typedef __WCHAR_TYPE__ wchar_t;
1414
signed short _iodbcdm_sqlerror(void)
1515
{
1616
wchar_t _sqlState[6] = { L"\0" };
17+
return 0;
1718
}

clang/test/CodeGen/SystemZ/vec-abi-gnuattr-05.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef __attribute__((vector_size(16))) int v4i32;
1111
v4i32 (*bar)(int);
1212

1313
static int foo() {
14-
(*bar)(0)[0];
14+
return (*bar)(0)[0];
1515
}
1616

1717
int fun() { return foo(); }

clang/test/CodeGen/X86/avx512fp16-abi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ struct fsd {
206206

207207
struct fsd pr52011(void) {
208208
// CHECK: define{{.*}} { float, double } @
209+
struct fsd x;
210+
return x;
209211
}
210212

211213
struct hsd {
@@ -216,6 +218,8 @@ struct hsd {
216218

217219
struct hsd pr52011_2(void) {
218220
// CHECK: define{{.*}} { half, double } @
221+
struct hsd x;
222+
return x;
219223
}
220224

221225
struct hsf {
@@ -226,6 +230,8 @@ struct hsf {
226230

227231
struct hsf pr52011_3(void) {
228232
// CHECK: define{{.*}} <4 x half> @
233+
struct hsf x;
234+
return x;
229235
}
230236

231237
struct fds {
@@ -237,4 +243,6 @@ struct fds {
237243
struct fds pr52011_4(void) {
238244
// CHECK-C: define{{.*}} { float, double } @pr52011_4
239245
// CHECK-CPP: define{{.*}} void @_Z9pr52011_4v({{.*}} sret
246+
struct fds x;
247+
return x;
240248
}

0 commit comments

Comments
 (0)