view gcc/testsuite/objc.dg/zero-link-3.m @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

/* 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 "../objc-obj-c++-shared/F-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;
}