diff options
author | Nicola Pero <nicola@gcc.gnu.org> | 2010-12-18 20:28:07 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-12-18 20:28:07 +0000 |
commit | 46270f141bec8186f01faf7ec216c57fd81e1463 (patch) | |
tree | 7e133229359caed0887f2fb805a0c54ecaa63de2 /gcc/objc | |
parent | b5dca6ea71c1de8775d723d5af41618c3581ae68 (diff) | |
download | gcc-46270f141bec8186f01faf7ec216c57fd81e1463.zip gcc-46270f141bec8186f01faf7ec216c57fd81e1463.tar.gz gcc-46270f141bec8186f01faf7ec216c57fd81e1463.tar.bz2 |
In gcc/: 2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
In gcc/:
2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
* c-parser.c (c_parser_objc_try_catch_finally_statement): Call
objc_maybe_warn_exceptions.
(c_parser_objc_synchronized_statement): Call
objc_maybe_warn_exceptions.
In gcc/cp/:
2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
* parser.c (cp_parser_objc_try_catch_finally_statement): Call
objc_maybe_warn_exceptions.
(cp_parser_objc_synchronized_statement): Same change.
In gcc/c-family/:
2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
* c-objc.h (objc_maybe_warn_exceptions): New.
* stub-objc.c (objc_maybe_warn_exceptions): New.
In gcc/objc/:
2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_init): Call using_eh_for_cleanups.
(objc_init_exceptions): Renamed to objc_maybe_warn_exceptions. Do
not call using_eh_for_cleanups.
(objc_begin_try_stmt): Do not call objc_init_exceptions.
(objc_build_throw_stmt): Updated call to
objc_maybe_warn_exceptions.
In gcc/testsuite/:
2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/fobjc-exceptions-1.m: Updated.
* objc.dg/fobjc-exceptions-2.m: New.
* objc.dg/fobjc-exceptions-3.m: New.
* obj-c++.dg/fobjc-exceptions-1.mm: New.
* obj-c++.dg/fobjc-exceptions-2.mm: New.
* obj-c++.dg/fobjc-exceptions-3.mm: New.
From-SVN: r168032
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 37 |
2 files changed, 26 insertions, 20 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 15af19d..d519ad7 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,12 @@ +2010-12-18 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc-act.c (objc_init): Call using_eh_for_cleanups. + (objc_init_exceptions): Renamed to objc_maybe_warn_exceptions. Do + not call using_eh_for_cleanups. + (objc_begin_try_stmt): Do not call objc_init_exceptions. + (objc_build_throw_stmt): Updated call to + objc_maybe_warn_exceptions. + 2010-12-18 Iain Sandoe <iains@gcc.gnu.org> * objc/objc-act.c (objc_eh_personality): Select personality name on diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index f05ab19..2076111 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -626,6 +626,11 @@ objc_init (void) if (print_struct_values && !flag_compare_debug) generate_struct_by_value_array (); +#ifndef OBJCPLUS + if (flag_objc_exceptions && !flag_objc_sjlj_exceptions) + using_eh_for_cleanups (); +#endif + return true; } @@ -5036,32 +5041,26 @@ objc_eh_personality (void) } #endif -static void -objc_init_exceptions (location_t loc) +void +objc_maybe_warn_exceptions (location_t loc) { - static bool done = false; - /* -fobjc-exceptions is required to enable Objective-C exceptions. For example, on Darwin, ObjC exceptions require a sufficiently recent version of the runtime, so the user must ask for them explicitly. On other platforms, at the moment -fobjc-exceptions triggers -fexceptions which again is required for exceptions to - work. - */ - /* TODO: we only really need one error message when the flag is missing. */ + work. */ if (!flag_objc_exceptions) { - error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax"); - } + /* Warn only once per compilation unit. */ + static bool warned = false; - if (done) - return; - done = true; - -#ifndef OBJCPLUS - if (!flag_objc_sjlj_exceptions) - using_eh_for_cleanups (); -#endif + if (!warned) + { + error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax"); + warned = true; + } + } } /* Build __builtin_eh_pointer, or the moral equivalent. In the case @@ -5365,8 +5364,6 @@ objc_begin_try_stmt (location_t try_locus, tree body) c->end_try_locus = input_location; cur_try_context = c; - objc_init_exceptions (try_locus); - /* Collect the list of local variables. We'll mark them as volatile at the end of compilation of this function to prevent them being clobbered by setjmp/longjmp. */ @@ -5573,7 +5570,7 @@ objc_build_throw_stmt (location_t loc, tree throw_expr) { tree args; - objc_init_exceptions (loc); + objc_maybe_warn_exceptions (loc); if (throw_expr == NULL) { |