aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-12-23 05:30:12 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-12-23 05:30:12 +0000
commit828839869831f7b3426b1924cb29b837237d019f (patch)
tree4c03d92f75f328d1525418507d7cd68c4f35720f /gcc
parent1e9402cb3d04add863c5f662b346c8f5f180ebb7 (diff)
downloadgcc-828839869831f7b3426b1924cb29b837237d019f.zip
gcc-828839869831f7b3426b1924cb29b837237d019f.tar.gz
gcc-828839869831f7b3426b1924cb29b837237d019f.tar.bz2
In gcc/testsuite/: 2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/testsuite/: 2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com> * obj-c.dg/gnu-api-2-class.m: Test that class_addMethod() returns NO if the method is already implemented in the class. * obj-c++.dg/gnu-api-2-class.mm: Same change. In libobjc/: 2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com> * sendmsg.c (class_addMethod): Return NO if the method already exists in the class. From-SVN: r168199
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm15
-rw-r--r--gcc/testsuite/objc.dg/gnu-api-2-class.m15
3 files changed, 36 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 22b83bf..7f0c770 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
+
+ * obj-c.dg/gnu-api-2-class.m: Test that class_addMethod() returns
+ NO if the method is already implemented in the class.
+ * obj-c++.dg/gnu-api-2-class.mm: Same change.
+
2010-12-22 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/47019
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
index d6aa827..da25663 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-class.mm
@@ -140,6 +140,12 @@ int main ()
method_getTypeEncoding (method2)))
abort ();
+ /* Test that if the method already exists in the class,
+ class_addMethod() returns NO. */
+ if (class_addMethod (new_class, @selector (variable), method_getImplementation (method2),
+ method_getTypeEncoding (method2)))
+ abort ();
+
objc_registerClassPair (new_class);
/* Now, MySubClass2 is basically the same as MySubClass! We'll
@@ -152,6 +158,15 @@ int main ()
if ([o variable] != o)
abort ();
}
+
+ /* Now, try that if you take an existing class and try to add an
+ already existing method, class_addMethod returns NO. This is
+ subtly different from before, when 'new_class' was still in
+ construction. Now it's a real class and the libobjc internals
+ differ between the two cases. */
+ if (class_addMethod (new_class, @selector (variable), method_getImplementation (method2),
+ method_getTypeEncoding (method2)))
+ abort ();
}
std::cout << "Testing class_addProtocol ()...\n";
diff --git a/gcc/testsuite/objc.dg/gnu-api-2-class.m b/gcc/testsuite/objc.dg/gnu-api-2-class.m
index 5e0df7e..d38d9c2 100644
--- a/gcc/testsuite/objc.dg/gnu-api-2-class.m
+++ b/gcc/testsuite/objc.dg/gnu-api-2-class.m
@@ -140,6 +140,12 @@ int main(int argc, void **args)
method_getTypeEncoding (method2)))
abort ();
+ /* Test that if the method already exists in the class,
+ class_addMethod() returns NO. */
+ if (class_addMethod (new_class, @selector (variable), method_getImplementation (method2),
+ method_getTypeEncoding (method2)))
+ abort ();
+
objc_registerClassPair (new_class);
/* Now, MySubClass2 is basically the same as MySubClass! We'll
@@ -152,6 +158,15 @@ int main(int argc, void **args)
if ([o variable] != o)
abort ();
}
+
+ /* Now, try that if you take an existing class and try to add an
+ already existing method, class_addMethod returns NO. This is
+ subtly different from before, when 'new_class' was still in
+ construction. Now it's a real class and the libobjc internals
+ differ between the two cases. */
+ if (class_addMethod (new_class, @selector (variable), method_getImplementation (method2),
+ method_getTypeEncoding (method2)))
+ abort ();
}
printf ("Testing class_addProtocol ()...\n");