Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm

raw
1 /* Contributed by Nicola Pero <[email protected]>, October 2010. */
2 /* { dg-do compile } */
3 /* { dg-additional-options "-Wno-objc-root-class" } */
4
5 #include <objc/objc.h>
6 #include <stdlib.h>
7
8 @interface MyClass
9 {
10 Class isa;
11 }
12 + (id) method1 __attribute__ ((noreturn));
13 - (id) method2 __attribute__ ((noreturn));
14 + (id) method3 __attribute__ ((noreturn));
15 - (id) method4 __attribute__ ((noreturn));
16 @end
17
18 @implementation MyClass
19 + (id) method1
20 {
21 return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
22 } /* { dg-warning ".noreturn. function does return" "" { target *-*-* } .-1 } */
23 - (id) method2
24 {
25 return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */
26 } /* { dg-warning ".noreturn. function does return" "" { target *-*-* } .-1 } */
27 + (id) method3
28 {
29 abort ();
30 }
31 - (id) method4
32 {
33 abort ();
34 }
35 @end