Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libobjc Handle new objc for gcc-4.8.1. Someone wit...



details:   https://anonhg.NetBSD.org/src/rev/708334bc9dea
branches:  trunk
changeset: 791022:708334bc9dea
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 31 21:02:11 2013 +0000

description:
Handle new objc for gcc-4.8.1. Someone with more objc foo can do this better.

diffstat:

 tests/lib/libobjc/t_threads.m |  34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r 52a615ffb7b4 -r 708334bc9dea tests/lib/libobjc/t_threads.m
--- a/tests/lib/libobjc/t_threads.m     Thu Oct 31 20:31:04 2013 +0000
+++ b/tests/lib/libobjc/t_threads.m     Thu Oct 31 21:02:11 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_threads.m,v 1.1 2010/07/18 12:41:51 jmmv Exp $ */
+/* $NetBSD: t_threads.m,v 1.2 2013/10/31 21:02:11 christos Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -35,8 +35,11 @@
 #include <atf-c.h>
 
 #include <objc/objc.h>
-#include <objc/objc-api.h>
+#include <objc/thr.h>
 #include <objc/Object.h>
+#if __GNUC_PREREQ__(4,8)
+#include <objc/runtime.h>
+#endif
 
 static int IsMultithreaded = 0;
 static objc_mutex_t Mutex;
@@ -46,6 +49,12 @@
 {
 }
 -(void)start;
+#if __GNUC_PREREQ__(4,8)
+-init;
++new;
++alloc;
+-free;
+#endif
 @end
 
 @implementation MyClass
@@ -55,6 +64,27 @@
 
        objc_condition_signal(Condition);
 }
+#if __GNUC_PREREQ__(4,8)
+-init
+{
+       return self;
+}
+
++new
+{
+       return [[self alloc] init];
+}
+
++alloc
+{
+       return class_createInstance(self, 0);
+}
+
+-free
+{
+       return object_dispose(self);
+}
+#endif
 @end
 
 static void



Home | Main Index | Thread Index | Old Index