aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIain Sandoe <iains@gcc.gnu.org>2010-12-18 11:28:46 +0000
committerIain Sandoe <iains@gcc.gnu.org>2010-12-18 11:28:46 +0000
commit5287cfd5944f7329c956ccd6c7ebf7c943e35b4a (patch)
treed9eecc4792d7fa400b89788724c58a79b13bb089 /gcc
parent628c4eee537f82b0422fb0990ee75384bf7e984e (diff)
downloadgcc-5287cfd5944f7329c956ccd6c7ebf7c943e35b4a.zip
gcc-5287cfd5944f7329c956ccd6c7ebf7c943e35b4a.tar.gz
gcc-5287cfd5944f7329c956ccd6c7ebf7c943e35b4a.tar.bz2
objc-act.c (objc_eh_personality): Select personality name on runtime.
gcc/objc: * objc/objc-act.c (objc_eh_personality): Select personality name on runtime. (objc_init_exceptions): New. (objc_begin_try_stmt): Use objc_init_exceptions. (objc_build_throw_stmt): Likewise. gcc/testsuite: * fobjc-exceptions.m: Update dg-error syntax. From-SVN: r168020
Diffstat (limited to 'gcc')
-rw-r--r--gcc/objc/ChangeLog8
-rw-r--r--gcc/objc/objc-act.c50
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/objc.dg/fobjc-exceptions.m9
4 files changed, 50 insertions, 21 deletions
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
index f079cb5..15af19d 100644
--- a/gcc/objc/ChangeLog
+++ b/gcc/objc/ChangeLog
@@ -1,3 +1,11 @@
+2010-12-18 Iain Sandoe <iains@gcc.gnu.org>
+
+ * objc/objc-act.c (objc_eh_personality): Select personality name on
+ runtime.
+ (objc_init_exceptions): New.
+ (objc_begin_try_stmt): Use objc_init_exceptions.
+ (objc_build_throw_stmt): Likewise.
+
2010-12-10 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_in_class_extension): New.
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 131ce55..f05ab19 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -5028,11 +5028,42 @@ tree
objc_eh_personality (void)
{
if (!flag_objc_sjlj_exceptions && !objc_eh_personality_decl)
- objc_eh_personality_decl = build_personality_function ("gnu_objc");
+ objc_eh_personality_decl = build_personality_function
+ (flag_next_runtime
+ ? "objc"
+ : "gnu_objc");
return objc_eh_personality_decl;
}
#endif
+static void
+objc_init_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. */
+ if (!flag_objc_exceptions)
+ {
+ error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
+ }
+
+ if (done)
+ return;
+ done = true;
+
+#ifndef OBJCPLUS
+ if (!flag_objc_sjlj_exceptions)
+ using_eh_for_cleanups ();
+#endif
+}
+
/* Build __builtin_eh_pointer, or the moral equivalent. In the case
of Darwin, we'll arrange for it to be initialized (and associated
with a binding) later. */
@@ -5334,17 +5365,7 @@ objc_begin_try_stmt (location_t try_locus, tree body)
c->end_try_locus = input_location;
cur_try_context = c;
- /* -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.
- */
- if (!flag_objc_exceptions)
- {
- error_at (try_locus, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
- }
+ 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
@@ -5552,10 +5573,7 @@ objc_build_throw_stmt (location_t loc, tree throw_expr)
{
tree args;
- if (!flag_objc_exceptions)
- {
- error_at (loc, "%<-fobjc-exceptions%> is required to enable Objective-C exception syntax");
- }
+ objc_init_exceptions (loc);
if (throw_expr == NULL)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5991aac..c49fb12 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-18 Iain Sandoe <iains@gcc.gnu.org>
+
+ * fobjc-exceptions.m: Update dg-error syntax.
+
2010-12-18 Kai Tietz <kai.tietz@onevision.com>
PR target/36834
diff --git a/gcc/testsuite/objc.dg/fobjc-exceptions.m b/gcc/testsuite/objc.dg/fobjc-exceptions.m
index afdc15f..392e307 100644
--- a/gcc/testsuite/objc.dg/fobjc-exceptions.m
+++ b/gcc/testsuite/objc.dg/fobjc-exceptions.m
@@ -5,25 +5,24 @@
int dummy (int number, Object *o)
{
- @try { /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+ @try { /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
number++;
- @throw o; /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+ @throw o; /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
}
@catch (id object)
{
number++;
- @throw; /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+ @throw; /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
}
@finally
{
number++;
}
- @synchronized (o) /* { dg-error "fobjc-exceptions" "is required to enable Objective-C exception syntax" } */
+ @synchronized (o) /* { dg-error ".-fobjc-exceptions. is required to enable Objective-C exception syntax" } */
{
number++;
}
return number;
}
-