Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / objc.dg / attributes / method-noreturn-1.m
blobaf051a61d34b0d0b6d9a0009661ad02440e5e9ad
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" } */
22 - (id) method2
24   return self;  /* { dg-warning "function declared .noreturn. has a .return. statement" } */
25 }               /* { dg-warning ".noreturn. function does return" } */
26 + (id) method3
28   abort ();
30 - (id) method4
32   abort ();
34 @end