2012-12-01 Alessandro Fanfarillo <alessandro.fanfarillo@gmail.com>
[official-gcc.git] / gcc / testsuite / objc-obj-c++-shared / TestsuiteObject.m
blob2068a91643620b9751d1f306c19566e07da08b5e
1 /* Very simple root class for writing testcases.
2    Copyright (C) 2011 Free Software Foundation, Inc.
3    Contributed by Nicola Pero
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
21 /* This is the implementation, but in all simple testcases we
22    recommend simply including it in the testcase.  */
24 #include "TestsuiteObject.h"
25 #include "runtime.h"
27 @implementation TestsuiteObject
28 + (id) initialize
30   return self;
32 + (id) new
34   return [[self alloc] init];
36 + (id) alloc
38   return class_createInstance (self, 0);
40 - (id) init
42   return self;
44 /* We return 'id' to have the same signature as [Object -free] in
45    older runtimes and avoid warnings about conflicting signatures.  */
46 - (id) free
48   /* Cast 'self' to 'id' because the NeXT runtime in darwin8 (Apple
49      Mac OS X 10.4) declares object_dispose to take an "Object *"
50      argument.  */
51   return object_dispose ((id)self);
53 + (Class) class
55   return self;
57 + (Class) superclass
59   return class_getSuperclass (self);
61 + (const char *)name
63   return class_getName (self);
65 - (const char *)name
67   return class_getName (isa);
69 @end