From 6347cf3119969c89259c269f8eba9c267ff098b8 Mon Sep 17 00:00:00 2001 From: Nicola Pero Date: Wed, 8 Dec 2010 23:46:28 +0000 Subject: In gcc/objc/: 2010-12-08 Nicola Pero In gcc/objc/: 2010-12-08 Nicola Pero * objc-act.c (objc_build_throw_stmt): Check that the argument of @throw is an object and emit an error if not. In gcc/testsuite/: 2010-12-08 Nicola Pero * objc.dg/exceptions-7.m: New. * obj-c++.dg/exceptions-7.mm: New. * obj-c++.dg/exceptions-3.mm: Adjust for new C++ messages. * obj-c++.dg/exceptions-5.mm: Same change. From-SVN: r167615 --- gcc/objc/ChangeLog | 5 +++++ gcc/objc/objc-act.c | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'gcc/objc') diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 0997727..09cc1f6 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,5 +1,10 @@ 2010-12-08 Nicola Pero + * objc-act.c (objc_build_throw_stmt): Check that the argument of + @throw is an object and emit an error if not. + +2010-12-08 Nicola Pero + * objc-act.c (objc_finish_foreach_loop): Use error_at() instead of error() when printing an error about the iterating variable or collection not being an object. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index f760aad..1b815df 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -5528,6 +5528,14 @@ objc_build_throw_stmt (location_t loc, tree throw_expr) value that we get from the runtime. */ throw_expr = objc_build_exc_ptr (); } + else if (throw_expr != error_mark_node) + { + if (!objc_type_valid_for_messaging (TREE_TYPE (throw_expr), true)) + { + error_at (loc, "%<@throw%> argument is not an object"); + return error_mark_node; + } + } /* A throw is just a call to the runtime throw function with the object as a parameter. */ -- cgit v1.1