summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/gnu-runtime-3.m
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-25 17:40:00 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-25 17:40:00 +0000
commit49710a8559fbd27c8bf21950c6357c2890b299b3 (patch)
tree3e6070d87dad5200eaeafa0c776c9287a12c2793 /gcc/testsuite/objc.dg/gnu-runtime-3.m
parent4798d49714873599cc6135df4e84f74f472dbf41 (diff)
downloadgcc-49710a8559fbd27c8bf21950c6357c2890b299b3.tar.gz
2005-11-25 Andrew Pinski <pinskia@physics.uc.edu>
* objc.dg/gnu-runtime-3.m: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107512 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg/gnu-runtime-3.m')
-rw-r--r--gcc/testsuite/objc.dg/gnu-runtime-3.m30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/gnu-runtime-3.m b/gcc/testsuite/objc.dg/gnu-runtime-3.m
new file mode 100644
index 00000000000..09204e3c918
--- /dev/null
+++ b/gcc/testsuite/objc.dg/gnu-runtime-3.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;
+}