This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] ObjC testsuite use simple NSConstantString implementation


Ziemowit Laski wrote:


On 3 Jun, 2004, at 16.06, Nicola Pero wrote:


David's patches make sure that you can test the constant string
functionality with the Apple runtime no matter what platform you're on and
no matter what external libraries you have (you could test them even on
Linux, as soon as you are able to run the Apple runtime on Linux), which
strike me as obviously the best solution.


OK. :-)  David, can you place your NSConstantString @implementation in
next_mapping.h, and then send your patch+ChangeLog as an attached file?


Sure, here you go.


Cheers,
David Ayers

2004-06-04  David Ayers  <d.ayers@inode.at>

	* objc/execute/next_mapping.h
	(_NSConstantStringClassReference): New global variable.
	(NSConstantString): New class.
	* objc/execute/string1.m, objc/execute/string2.m,
	objc/execute/string3.m, objc/execute/string4.m: Include
	next_mapping.h instead of Foundation/NSString.h.

Index: objc/execute/next_mapping.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/objc/execute/next_mapping.h,v
retrieving revision 1.2
diff -u -r1.2 next_mapping.h
--- objc/execute/next_mapping.h	25 Sep 2003 01:26:00 -0000	1.2
+++ objc/execute/next_mapping.h	4 Jun 2004 08:12:45 -0000
@@ -848,4 +848,35 @@
     *type = layout->prev_type;
 }
 
+/* This code was derived from the GNU runtime's 
+   NXConstantString implementation.  */
+#include "objc/Object.h"
+
+struct objc_class _NSConstantStringClassReference;
+
+@interface NSConstantString : Object
+{
+  char *c_string;
+  unsigned int len;
+}
+
+-(const char *) cString;
+-(unsigned int) length;
+
+@end
+
+@implementation NSConstantString
+
+-(const char *) cString
+{
+  return (c_string);
+}
+
+-(unsigned int) length
+{
+  return (len);
+}
+
+@end
+
 #endif  /* #ifdef __NEXT_RUNTIME__ */
Index: objc/execute/string1.m
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/objc/execute/string1.m,v
retrieving revision 1.3
diff -u -r1.3 string1.m
--- objc/execute/string1.m	25 Sep 2003 01:26:00 -0000	1.3
+++ objc/execute/string1.m	4 Jun 2004 08:12:45 -0000
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 
 #ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
 #else
 #include <objc/NXConstStr.h>
 #endif
Index: objc/execute/string2.m
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/objc/execute/string2.m,v
retrieving revision 1.3
diff -u -r1.3 string2.m
--- objc/execute/string2.m	25 Sep 2003 01:26:00 -0000	1.3
+++ objc/execute/string2.m	4 Jun 2004 08:12:45 -0000
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 
 #ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
 #else
 #include <objc/NXConstStr.h>
 #endif
Index: objc/execute/string3.m
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/objc/execute/string3.m,v
retrieving revision 1.2
diff -u -r1.2 string3.m
--- objc/execute/string3.m	25 Sep 2003 01:26:00 -0000	1.2
+++ objc/execute/string3.m	4 Jun 2004 08:12:45 -0000
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 
 #ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
 #else
 #include <objc/NXConstStr.h>
 #endif
Index: objc/execute/string4.m
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/testsuite/objc/execute/string4.m,v
retrieving revision 1.2
diff -u -r1.2 string4.m
--- objc/execute/string4.m	25 Sep 2003 01:26:00 -0000	1.2
+++ objc/execute/string4.m	4 Jun 2004 08:12:45 -0000
@@ -4,7 +4,7 @@
 #include <stdlib.h>
 
 #ifdef __NEXT_RUNTIME__
-#import <Foundation/NSString.h>
+#include "next_mapping.h"
 #else
 #include <objc/NXConstStr.h>
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]