aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-12-24 20:10:46 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-12-24 20:10:46 +0000
commit9cacfc3eb3244d1f0a17481c75df331cd9d5a749 (patch)
tree82ccf00b97041686d44ec777ecbed412ef03db12 /gcc
parent410644c41a1b10798a0fe442c66f9bf582ecf067 (diff)
downloadgcc-9cacfc3eb3244d1f0a17481c75df331cd9d5a749.zip
gcc-9cacfc3eb3244d1f0a17481c75df331cd9d5a749.tar.gz
gcc-9cacfc3eb3244d1f0a17481c75df331cd9d5a749.tar.bz2
In libobjc/: 2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/: 2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com> * selector.c (sel_getTypedSelector): Return NULL if given a NULL argument. (sel_registerTypedName): Same. (sel_registerName): Same. * objc/runtime.h: Updated documentation. In gcc/testsuite/: 2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com> * objc.dg/gnu-api-2-sel.m: Test calling sel_getUid, sel_registerName and sel_registerTypedName with NULL arguments. Updated the test to work with the Apple runtime as well. * obj-c++.dg/gnu-api-2-sel.mm: Same change. From-SVN: r168231
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog7
-rw-r--r--gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm23
-rw-r--r--gcc/testsuite/objc.dg/gnu-api-2-sel.m23
3 files changed, 51 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2e68afa..2f07ea6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,12 @@
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+ * objc.dg/gnu-api-2-sel.m: Test calling sel_getUid,
+ sel_registerName and sel_registerTypedName with NULL arguments.
+ Updated the test to work with the Apple runtime as well.
+ * obj-c++.dg/gnu-api-2-sel.mm: Same change.
+
+2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
+
* objc.dg/gnu-api-2-class.m: Updated test to pass log_2 of the
alignment to class_addIvar, instead of the alignment itself.
* obj-c++.dg/gnu-api-2-class.mm: Same change.
diff --git a/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm b/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
index 956ba29..6d1d0fc 100644
--- a/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
+++ b/gcc/testsuite/obj-c++.dg/gnu-api-2-sel.mm
@@ -3,7 +3,6 @@
This is test 'sel', covering all functions starting with 'sel'. */
/* { dg-do run } */
-/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
@@ -16,11 +15,13 @@
{ Class isa; }
+ alloc;
- init;
++ initialize;
@end
@implementation MyRootClass
+ alloc { return class_createInstance (self, 0); }
- init { return self; }
++ initialize { return self; }
@end
@protocol MyProtocol
@@ -49,6 +50,7 @@ int main ()
{
/* Functions are tested in alphabetical order. */
+#ifdef __GNU_LIBOBJC__
std::cout << "Testing sel_copyTypedSelectorList ()...\n";
{
unsigned int count;
@@ -72,6 +74,7 @@ int main ()
if (list[2] != NULL)
abort ();
}
+#endif
std::cout << "Testing sel_getName () ...\n";
{
@@ -82,6 +85,7 @@ int main ()
abort ();
}
+#ifdef __GNU_LIBOBJC__
std::cout << "Testing sel_getTypeEncoding () ...\n";
{
/* Get a selector from a real class, so it has interesting
@@ -96,7 +100,9 @@ int main ()
if (sel_getTypeEncoding (NULL) != NULL)
abort ();
}
+#endif
+#ifdef __GNU_LIBOBJC__
std::cout << "Testing sel_getTypedSelector () ...\n";
{
/* First try with a selector where we know that a typed one has
@@ -128,11 +134,15 @@ int main ()
if (selector != NULL)
abort ();
}
+#endif
std::cout << "Testing sel_getUid () ...\n";
{
if (std::strcmp (sel_getName (sel_getUid ("myMethod")), "myMethod") != 0)
abort ();
+
+ if (sel_getUid (NULL) != NULL)
+ abort ();
}
std::cout << "Testing sel_isEqual () ...\n";
@@ -145,8 +155,12 @@ int main ()
{
if (std::strcmp (sel_getName (sel_registerName ("myMethod")), "myMethod") != 0)
abort ();
+
+ if (sel_registerName (NULL) != NULL)
+ abort ();
}
+#ifdef __GNU_LIBOBJC__
std::cout << "Testing set_registerTypedName () ...\n";
{
const char *types = method_getTypeEncoding (class_getInstanceMethod
@@ -159,7 +173,14 @@ int main ()
if (std::strcmp (sel_getTypeEncoding (selector), types) != 0)
abort ();
+
+ if (sel_registerTypedName (NULL, NULL) != NULL)
+ abort ();
+
+ if (sel_registerTypedName (NULL, types) != NULL)
+ abort ();
}
+#endif
return (0);
}
diff --git a/gcc/testsuite/objc.dg/gnu-api-2-sel.m b/gcc/testsuite/objc.dg/gnu-api-2-sel.m
index db2dcd3..70368ca 100644
--- a/gcc/testsuite/objc.dg/gnu-api-2-sel.m
+++ b/gcc/testsuite/objc.dg/gnu-api-2-sel.m
@@ -3,7 +3,6 @@
This is test 'sel', covering all functions starting with 'sel'. */
/* { dg-do run } */
-/* { dg-skip-if "" { *-*-* } { "-fnext-runtime" } { "" } } */
/* To get the modern GNU Objective-C Runtime API, you include
objc/runtime.h. */
@@ -16,11 +15,13 @@
{ Class isa; }
+ alloc;
- init;
++ initialize;
@end
@implementation MyRootClass
+ alloc { return class_createInstance (self, 0); }
- init { return self; }
++ initialize { return self; }
@end
@protocol MyProtocol
@@ -49,6 +50,7 @@ int main(int argc, void **args)
{
/* Functions are tested in alphabetical order. */
+#ifdef __GNU_LIBOBJC__
printf ("Testing sel_copyTypedSelectorList ()...\n");
{
unsigned int count;
@@ -72,6 +74,7 @@ int main(int argc, void **args)
if (list[2] != NULL)
abort ();
}
+#endif
printf ("Testing sel_getName () ...\n");
{
@@ -82,6 +85,7 @@ int main(int argc, void **args)
abort ();
}
+#ifdef __GNU_LIBOBJC__
printf ("Testing sel_getTypeEncoding () ...\n");
{
/* Get a selector from a real class, so it has interesting
@@ -96,7 +100,9 @@ int main(int argc, void **args)
if (sel_getTypeEncoding (NULL) != NULL)
abort ();
}
+#endif
+#ifdef __GNU_LIBOBJC__
printf ("Testing sel_getTypedSelector () ...\n");
{
/* First try with a selector where we know that a typed one has
@@ -128,11 +134,15 @@ int main(int argc, void **args)
if (selector != NULL)
abort ();
}
+#endif
printf ("Testing sel_getUid () ...\n");
{
if (strcmp (sel_getName (sel_getUid ("myMethod")), "myMethod") != 0)
abort ();
+
+ if (sel_getUid (NULL) != NULL)
+ abort ();
}
printf ("Testing sel_isEqual () ...\n");
@@ -145,8 +155,12 @@ int main(int argc, void **args)
{
if (strcmp (sel_getName (sel_registerName ("myMethod")), "myMethod") != 0)
abort ();
+
+ if (sel_registerName (NULL) != NULL)
+ abort ();
}
+#ifdef __GNU_LIBOBJC__
printf ("Testing set_registerTypedName () ...\n");
{
const char *types = method_getTypeEncoding (class_getInstanceMethod
@@ -159,7 +173,14 @@ int main(int argc, void **args)
if (strcmp (sel_getTypeEncoding (selector), types) != 0)
abort ();
+
+ if (sel_registerTypedName (NULL, NULL) != NULL)
+ abort ();
+
+ if (sel_registerTypedName (NULL, types) != NULL)
+ abort ();
}
+#endif
return 0;
}