PR target/84336
[official-gcc.git] / gcc / testsuite / objc.dg / attributes / method-noreturn-1.m
bloba83048bb7ed73565b4bf1984ac71bbd85ff68b9c
1 /* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
2 /* { dg-do compile } */
4 #include <objc/objc.h>
5 #include <stdlib.h>
7 @interface MyClass
9   Class isa;
10
11 + (id) method1 __attribute__ ((noreturn));
12 - (id) method2 __attribute__ ((noreturn));
13 + (id) method3 __attribute__ ((noreturn));
14 - (id) method4 __attribute__ ((noreturn));
15 @end
17 @implementation MyClass
18 + (id) method1
20   return self;  /* { dg-warning "function declared .noreturn. has a .return. statement" } */
21 }               /* { dg-warning ".noreturn. function does return" "" { target *-*-* } .-1 } */
22 - (id) method2
24   return self;  /* { dg-warning "function declared .noreturn. has a .return. statement" } */
25 }               /* { dg-warning ".noreturn. function does return" "" { target *-*-* } .-1 } */
26 + (id) method3
28   abort ();
30 - (id) method4
32   abort ();
34 @end