ObjC/ObjC++: bug fixes for @catch

IainS developer@sandoe-acoustics.co.uk
Sun Nov 28 17:12:00 GMT 2010


On 28 Nov 2010, at 12:30, Nicola Pero wrote:

>>> (sadly, as it is
>>> well-known (PR objc++/23616), ObjC exceptions don't actually work in
>>> ObjC++, so I had to disable the
>>> ObjC++ execution one as fixing that is not part of this patch.  I
>>> don't think I'll work on that for 4.6,
>>> it's too late)
>>
>> ... but they should work for NeXT runtime ;-)
>
> Sure ... so what do you suggest ?  We don't want to introduce any  
> new failures
> that simply duplicate existing ones.  That just confuses people that  
> try to track
> PRs and regressions. ;-)

Well, I agree - but that's more-or-less what we're doing here --
-- for -next-runtime,  the new tests fail with the same fail existing  
in several of the existing ones...

(I know you're intending to look at this - so this is just a 'heads  
up' not a major complaint ;-))

> Ideally exceptions-2.mm should be compiled only with the GNU  
> runtime, and
> compiled + executed with the NeXT one, but I don't think there is an  
> easy way
> to do this, hence I marked it just for compilation.  Do you know any  
> way that
> doesn't require duplicating the testcase ?

I'll think about it -- I guess the worst case is to XFAIL the run for  
gnu-runtime (like we do for the m64 NeXT ones).

>  Anyway, that can be done in a separate patch.

Indeed, I should have made it clear I wasn't suggesting holding this  
one up ...

>>>       * objc.dg/exceptions-1.m: New.
>>>       * objc.dg/exceptions-2.m: New.
>>>       * objc.dg/exceptions-3.m: New.
>>>       * objc.dg/exceptions-4.m: New.
>>>       * objc.dg/exceptions-5.m: New.
>>>       * obj-c++.dg/exceptions-1.mm: New.
>>>       * obj-c++.dg/exceptions-2.mm: New.
>>>       * obj-c++.dg/exceptions-3.mm: New.
>>>       * obj-c++.dg/exceptions-4.mm: New.
>>>       * obj-c++.dg/exceptions-5.mm: New.
>>
>> I think we can honestly forecast needing enough exception tests to
>> warrant starting a new directory for them --
>> ... also we should identify suitable candidates for torture testing -
>> which is especially weak for Obj-C++
>>
>> obj*.dg/exceptions/
>> obj*.dg/torture/exceptions/
>>
>> the .exp scripts in an existing parallel dir should serve as a
>> template
>> (or let me know off-list and I'll do this and send you an increment  
>> to
>> your patch)
>
> Ok - sounds good - in attach a revised patch:
>
> * I moved the new testcases into objc.dg/exceptions and obj-c++.dg/ 
> exceptions subdirectories
>
> * I changed the top-level dg.exp file to run the testcases in the  
> subdirectories
> as well as the testcases in the top-level (I don't want to duplicate  
> the .exp files
> in each subdirectory unless there is a reason to do so)

there is a good reason to do so --

make check-objc RUNTESTFLAGS="exceptions.exp=* "

(and the existing equivalents) are very useful when tracking down  
categories of problems..

I suspect that automatically including the sub-dirs will double- 
execute a number of existing tests...

>
> * I renamed a variable I had added to the parser code to something  
> better (open_paren_seen
> renamed to seen_open_paren).
>
> There are no good candidates for torture test in this patch, which  
> is a "parser"
> patch.  Even the execution test really only tests that the parser is  
> passing the
> right information to objc-act.c.  So I think the patch is now  
> ready :-)
>
> Ok to commit ?
>
> Thanks
>
> In gcc/objc/:
> 2010-11-28  Nicola Pero  <nicola.pero@meta-innovation.com>
>
>        * objc-act.c (objc_eh_runtime_type): Avoid ICE if  
> error_mark_node
>        is passed as argument.
>        (objc_begin_catch_clause): Added code to deal with an
>        error_mark_node or NULL_TREE argument.  Improved checks for
>        invalid arguments.  Added code to traverse typedefs.
>
> In gcc/testsuite/:
> 2010-11-28  Nicola Pero  <nicola.pero@meta-innovation.com>
>
>        * objc.dg/dg.exp: Run the tests in objc.dg/exceptions as well.
>        * objc.dg/exceptions/exceptions-1.m: New.
>        * objc.dg/exceptions/exceptions-2.m: New.
>        * objc.dg/exceptions/exceptions-3.m: New.
>        * objc.dg/exceptions/exceptions-4.m: New.
>        * objc.dg/exceptions/exceptions-5.m: New.
>        * obj-c++.dg/dg.exp: Run the tests in obj-c++.dg/exceptions  
> as well.
>        * obj-c++.dg/exceptions/exceptions-1.mm: New.
>        * obj-c++.dg/exceptions/exceptions-2.mm: New.
>        * obj-c++.dg/exceptions/exceptions-3.mm: New.
>        * obj-c++.dg/exceptions/exceptions-4.mm: New.
>        * obj-c++.dg/exceptions/exceptions-5.mm: New.
>
> In gcc/cp/:
> 2010-11-28  Nicola Pero  <nicola.pero@meta-innovation.com>
>
>        * parser.c (cp_parser_objc_try_catch_finally_statement): Parse
>        @catch(...)  and pass NULL_TREE to objc_begin_catch_clause() in
>        that case.  Improved error recovery.  Reorganized code to be
>        almost identical to c_parser_objc_try_catch_finally_statement.
>
> In gcc/:
> 2010-11-28  Nicola Pero  <nicola.pero@meta-innovation.com>
>
>        * c-parser.c (c_parser_objc_try_catch_statement): Renamed to
>        c_parser_objc_try_catch_finally_statement for consistency  
> with the
>        C++ parser.  Parse @catch(...) and pass NULL_TREE to
>        objc_begin_catch_clause() in that case.  Improved error  
> recovery.
>        Reorganized code to be almost identical to
>        cp_parser_objc_try_catch_finally_statement.
> <patch.txt>



More information about the Gcc-patches mailing list