summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-28 17:58:55 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-28 17:58:55 +0000
commitea446b0bb9467cd9b535627d91601fec66fc9e69 (patch)
tree222e7d1bcfa9a85e0e42abfaa76ed4e639156e1f /gcc/testsuite/objc.dg
parentc4bdb14e03dae134ad9a5d1e84d5facc62315841 (diff)
downloadgcc-ea446b0bb9467cd9b535627d91601fec66fc9e69.tar.gz
In gcc/objc/:
2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. 2005-08-23 Stuart Hastings <stuart@apple.com> Ziemowit Laski <zlaski@apple.com> Radar 4209854 * objc-act.c (objc_decay_parm_type): New function. (get_arg_type_list): Decay types for all named arguments. (objc_push_parm): Rebuild the PARM_DECL if its type has been decayed. In gcc/testsuite/: 2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers (test method-20.m from the branch renamed to method-20b.m to avoid clashes). 2005-08-23 Stuart Hastings <stuart@apple.com> Ziemowit Laski <zlaski@apple.com> Radar 4209854 * obj-c++.dg/method-23.mm: New. * objc.dg/method-20.m: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164694 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/objc.dg')
-rw-r--r--gcc/testsuite/objc.dg/method-20b.m43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/method-20b.m b/gcc/testsuite/objc.dg/method-20b.m
new file mode 100644
index 00000000000..9b8625a9b17
--- /dev/null
+++ b/gcc/testsuite/objc.dg/method-20b.m
@@ -0,0 +1,43 @@
+/* Check if array and function parameters get decayed to pointers as
+ they should. */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+#include "../objc-obj-c++-shared/Object1.h"
+#include <string.h>
+#include <stdlib.h>
+
+static char global_buf[20];
+
+char *strcpy_like_callee(const char *s) {
+ strcpy(global_buf, s);
+ return global_buf;
+}
+
+typedef char io_string_t[512];
+typedef char *(func_type)(const char *);
+
+@interface DeviceObject: Object
+- (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath;
+@end
+@implementation DeviceObject
+- (void) func:(func_type)func stucPathInIORegistry:(io_string_t)ioRegPath
+{
+ func(ioRegPath);
+}
+@end
+
+int main (void) {
+ io_string_t my_string;
+ DeviceObject *obj = [DeviceObject new];
+
+ strcpy (my_string, "Hello!");
+ strcpy (global_buf, "Good-bye!");
+
+ [obj func:strcpy_like_callee stucPathInIORegistry:my_string];
+
+ if (strcmp (global_buf, "Hello!"))
+ abort ();
+
+ return 0;
+}