summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-07 06:25:49 +0000
committerzlaski <zlaski@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-07 06:25:49 +0000
commit99469381d269adb4d1d9930e164cb243559e420b (patch)
tree93c09ea889a25a12734d437c45ac4d1457f89401
parent96c8d283ee08bf43490b3dcd4e084facaecc1994 (diff)
downloadgcc-99469381d269adb4d1d9930e164cb243559e420b.tar.gz
/objc/ChangeLog]
2005-07-07 Ziemowit Laski <zlaski@apple.com> PR objc/22274 * objc-act.c (objc_build_string_object): For GNU-style constants, use the @interface type rather than the built-in type. [gcc/testsuite/ChangeLog] 2005-07-07 Ziemowit Laski <zlaski@apple.com> PR objc/22274 * obj-c++.dg/gnu-runtime-[1-2].mm: New. * objc.dg/gnu-runtime-2.m: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101686 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/objc/ChangeLog6
-rw-r--r--gcc/objc/objc-act.c2
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-runtime-1.mm19
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm30
-rw-r--r--gcc/testsuite/objc.dg/gnu-runtime-2.m30
6 files changed, 92 insertions, 1 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index c9edce22608..6d7b9a4d9f1 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-07 Ziemowit Laski <zlaski@apple.com>
+
+ PR objc/22274
+ * objc-act.c (objc_build_string_object): For GNU-style constants,
+ use the @interface type rather than the built-in type.
+
2005-07-03 Kazu Hirata <kazu@codesourcery.com>
* Make-lang.in (cc1plus-checksum.c): Use
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index a3d32d8ffa6..48cf7075863 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -1915,7 +1915,7 @@ objc_build_string_object (tree string)
if (!flag_next_runtime)
constructor
- = objc_add_static_instance (constructor, internal_const_str_type);
+ = objc_add_static_instance (constructor, constant_string_type);
else
{
var = build_decl (CONST_DECL, NULL, TREE_TYPE (constructor));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7c793be17c0..d8efcde2a63 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-07 Ziemowit Laski <zlaski@apple.com>
+
+ PR objc/22274
+ * obj-c++.dg/gnu-runtime-[1-2].mm: New.
+ * objc.dg/gnu-runtime-2.m: New.
+
2005-07-06 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/vrp17.c: New test.
diff --git a/gcc/testsuite/obj-c++.dg/gnu-runtime-1.mm b/gcc/testsuite/obj-c++.dg/gnu-runtime-1.mm
new file mode 100644
index 00000000000..dab921554f1
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/gnu-runtime-1.mm
@@ -0,0 +1,19 @@
+/* Test that compiling for the GNU runtime works (regardless of
+ the system runtime used). */
+/* Author: Ziemowit Laski <zlaski@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-fgnu-runtime" } */
+
+#include <objc/Object.h>
+
+@interface FooBar: Object
+- (void)boo;
+@end
+
+int main ()
+{
+ id fooBarInst = [[FooBar alloc] init];
+ [fooBarInst boo];
+ return 0;
+}
+
diff --git a/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm b/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm
new file mode 100644
index 00000000000..09204e3c918
--- /dev/null
+++ b/gcc/testsuite/obj-c++.dg/gnu-runtime-2.mm
@@ -0,0 +1,30 @@
+/* Sanity check for GNU-runtime version of constant strings,
+ regardless of runtime used on target system. */
+
+/* { dg-do run } */
+/* { dg-options "-fgnu-runtime" } */
+
+#include <objc/Object.h>
+#include <string.h>
+#include <stdlib.h>
+
+@interface NXConstantString: Object
+{
+ char *c_string;
+ unsigned int len;
+}
+-(const char *) cString;
+-(unsigned int) length;
+@end
+
+@implementation NXConstantString
+-(const char *) cString { return c_string; }
+-(unsigned int) length { return len; }
+@end
+
+int main(int argc, void **args)
+{
+ if (strcmp ([@"this is a string" cString], "this is a string"))
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/objc.dg/gnu-runtime-2.m b/gcc/testsuite/objc.dg/gnu-runtime-2.m
new file mode 100644
index 00000000000..09204e3c918
--- /dev/null
+++ b/gcc/testsuite/objc.dg/gnu-runtime-2.m
@@ -0,0 +1,30 @@
+/* Sanity check for GNU-runtime version of constant strings,
+ regardless of runtime used on target system. */
+
+/* { dg-do run } */
+/* { dg-options "-fgnu-runtime" } */
+
+#include <objc/Object.h>
+#include <string.h>
+#include <stdlib.h>
+
+@interface NXConstantString: Object
+{
+ char *c_string;
+ unsigned int len;
+}
+-(const char *) cString;
+-(unsigned int) length;
+@end
+
+@implementation NXConstantString
+-(const char *) cString { return c_string; }
+-(unsigned int) length { return len; }
+@end
+
+int main(int argc, void **args)
+{
+ if (strcmp ([@"this is a string" cString], "this is a string"))
+ abort ();
+ return 0;
+}