summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m
blob: 717d6e65e28ee1665140ca4df03b7450406aac30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
/* { dg-do compile } */

#include <objc/objc.h>
#include <stdlib.h>

@interface MyClass
{
  Class isa;
} 
+ (id) method1 __attribute__ ((noreturn));
- (id) method2 __attribute__ ((noreturn));
+ (id) method3 __attribute__ ((noreturn));
- (id) method4 __attribute__ ((noreturn));
@end

@implementation MyClass
+ (id) method1
{
  return self;  /* { dg-warning "function declared .noreturn. has a .return. statement" } */
}               /* { dg-warning ".noreturn. function does return" "" { target *-*-* } 20 } */
- (id) method2
{
  return self;  /* { dg-warning "function declared .noreturn. has a .return. statement" } */
}               /* { dg-warning ".noreturn. function does return" "" { target *-*-* } 24 } */
+ (id) method3
{
  abort ();
}
- (id) method4
{
  abort ();
}
@end