aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc.dg/zero-link-3.m
blob: 18f21db4e653d053123e374b361ccf7f7885c9cd (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
/* Check that the '-fzero-link' flag doesn't prevent messaging from working. */
/* Contributed by Ziemowit Laski <zlaski@apple.com>.  */

/* { dg-do run { target *-*-darwin* } } */
/* { dg-additional-options "-fzero-link" } */
/* { dg-additional-options "-framework Foundation" { target { *-*-darwin* } } } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */

#ifdef __NEXT_RUNTIME__
#include <Foundation/NSObject.h>
#define OBJECT NSObject
#else
#include <objc/Object.h>
#include <objc/Protocol.h>
#define OBJECT Object
#endif

extern void abort(void);
#define CHECK_IF(expr) if(!(expr)) abort();

@interface Base: OBJECT
+ (int) getValue;
@end

@implementation Base
+ (int) getValue { return 1593; }
@end

int main(void) {
  int val = [Base getValue];
  CHECK_IF(val == 1593);
  return 0;
}