OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [objc.dg/] [category-1.m] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 309 jeremybenn
/* Test class methods inside categories.  */
2
/* Author: Ziemowit Laski <zlaski@apple.com>.  */
3
 
4
/* { dg-do run } */
5
/* { dg-xfail-run-if "need OBJC2 ABI" { *-*-darwin* && { lp64 &&  { ! objc2 } } } { "-fnext-runtime" } { "" } } */
6
 
7
#include "../objc-obj-c++-shared/Object1.h"
8
extern int strcmp(const char *s1, const char *s2);
9
extern void abort(void);
10
 
11
#ifdef __NEXT_RUNTIME__
12
#define SUPERCLASS superclass
13
#else
14
#define SUPERCLASS superClass
15
#endif
16
 
17
#define CHECK_IF(expr) if(!(expr)) abort()
18
 
19
@interface MyObject: Object
20
+ (Class)whatever1;
21
@end
22
 
23
@implementation MyObject
24
+ (Class)whatever1 { return [super SUPERCLASS]; }
25
@end
26
 
27
@interface MyObject (ThisWontCompile)
28
+(Class)whatever2;
29
@end
30
 
31
@implementation MyObject (ThisWontCompile)
32
+(Class)whatever2 { return [super SUPERCLASS]; }
33
@end
34
 
35
int main (int argc, const char * argv[])
36
{
37
  Class w1 = [MyObject whatever1];
38
  Class w2 = [MyObject whatever2];
39
 
40
#ifdef NEXT_OBJC_USE_NEW_INTERFACE
41
  CHECK_IF(!strcmp( object_getClassName( w1 ), "Object"));
42
  CHECK_IF(!strcmp( object_getClassName( w2 ), "Object"));
43
#else
44
  CHECK_IF(!strcmp(w1->name, "Object"));
45
  CHECK_IF(!strcmp(w2->name, "Object"));
46
#endif
47
 
48
  return 0;
49
}
50
 
51
#include "../objc-obj-c++-shared/Object1-implementation.h"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.