aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg
diff options
context:
space:
mode:
authorZiemowit Laski <zlaski@apple.com>2005-07-07 06:25:49 +0000
committerZiemowit Laski <zlaski@gcc.gnu.org>2005-07-07 06:25:49 +0000
commitf5d21c4ca15a9423443ce33efb3c9b8ebcde051e (patch)
tree93c09ea889a25a12734d437c45ac4d1457f89401 /gcc/testsuite/objc.dg
parent1a5577239fdf250e3fde521810339981d90c11c8 (diff)
downloadgcc-f5d21c4ca15a9423443ce33efb3c9b8ebcde051e.zip
gcc-f5d21c4ca15a9423443ce33efb3c9b8ebcde051e.tar.gz
gcc-f5d21c4ca15a9423443ce33efb3c9b8ebcde051e.tar.bz2
re PR objc/22274 (string[1-4].m, const-str-5.m fails with the gnu runtime)
/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. From-SVN: r101686
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r--gcc/testsuite/objc.dg/gnu-runtime-2.m30
1 files changed, 30 insertions, 0 deletions
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 0000000..09204e3
--- /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;
+}