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
+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
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));
+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.
--- /dev/null
+/* 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;
+}
+
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}