Debian Codegraph @

gcc/testsuite/objc.dg/method-17.m

raw
1 /* Test for spurious "may or may not return a value" warnings. */
2
3 /* { dg-do compile } */
4 /* { dg-options "-Wreturn-type -Wextra" } */
5
6 #include "../objc-obj-c++-shared/TestsuiteObject.h"
7
8 @interface Foo: TestsuiteObject
9 - (id) meth1;
10 - (void) meth2;
11 @end
12
13 extern int bar;
14
15 @implementation Foo
16 - (id) meth1 {
17 if (bar)
18 return [TestsuiteObject new];
19 return; /* { dg-warning "'return' with no value, in function returning non-void" } */
20 }
21 - (void) meth2 {
22 if (!bar)
23 return;
24 bar = 0;
25 } /* { dg-bogus "'return' with no value, in function returning non-void" } */
26 @end