summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/special/unclaimed-category-1.m
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/objc.dg/special/unclaimed-category-1.m
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/objc.dg/special/unclaimed-category-1.m')
-rw-r--r--gcc/testsuite/objc.dg/special/unclaimed-category-1.m75
1 files changed, 75 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/special/unclaimed-category-1.m b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m
new file mode 100644
index 000000000..88e3d8ea7
--- /dev/null
+++ b/gcc/testsuite/objc.dg/special/unclaimed-category-1.m
@@ -0,0 +1,75 @@
+/* Contributed by Nicola Pero - Fri Dec 14 08:36:00 GMT 2001 */
+/* { dg-do run } */
+/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */
+
+#include <objc/objc.h>
+#ifndef __NEXT_RUNTIME__
+#include <objc/objc-api.h>
+#endif
+#include "../../objc-obj-c++-shared/next-mapping.h"
+
+extern void abort (void);
+
+/* Test loading unclaimed categories - categories of a class defined
+ separately from the class itself. */
+
+
+/* unclaimed-category-1.m contains only the class definition but not
+ the categories. unclaimed-category-1a.m contains only the
+ categories of the class, but not the class itself. We want to
+ check that the runtime can load the class from one module (file)
+ and the categories from another module (file). */
+
+#include "unclaimed-category-1.h"
+
+@implementation TestClass
+- (int)D
+{
+ return 4;
+}
+#ifdef __NEXT_RUNTIME__
++ initialize { return self; }
+#endif
+@end
+
+
+int main (void)
+{
+ TestClass *test;
+ Class testClass;
+
+ testClass = objc_get_class ("TestClass");
+ if (testClass == Nil)
+ {
+ abort ();
+ }
+
+ test = (TestClass *)(class_create_instance (testClass));
+ if (test == nil)
+ {
+ abort ();
+ }
+
+ if ([test A] != 1)
+ {
+ abort ();
+ }
+
+ if ([test B] != 2)
+ {
+ abort ();
+ }
+
+ if ([test C] != 3)
+ {
+ abort ();
+ }
+
+
+ if ([test D] != 4)
+ {
+ abort ();
+ }
+
+ return 0;
+}