summaryrefslogtreecommitdiffstats
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-24 21:28:38 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-24 21:28:38 +0000
commit96faf93e05be4e1f76b025b799ec899d14a17be7 (patch)
tree36c8035a96cc911760ed8fd295e9fcba32d8a983 /gcc/c-decl.c
parent5ceb27aaa26f13db94068cf2c3c1d888f43b5f28 (diff)
downloadppe42-gcc-96faf93e05be4e1f76b025b799ec899d14a17be7.tar.gz
ppe42-gcc-96faf93e05be4e1f76b025b799ec899d14a17be7.zip
PR c/29955
* c-tree.h (c_maybe_initialize_eh): New prototype. * c-decl.c (finish_decl): Move EH initialization... (c_maybe_initialize_eh): ... here. New function. * c-parser.c (c_parser_omp_construct): Call c_maybe_initialize_eh if not #pragma omp atomic. * gcc.dg/gomp/pr29955.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119168 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 80f1a1a621f..fa1c3406d95 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -3385,6 +3385,23 @@ start_decl (struct c_declarator *declarator, struct c_declspecs *declspecs,
return tem;
}
+/* Initialize EH if not initialized yet and exceptions are enabled. */
+
+void
+c_maybe_initialize_eh (void)
+{
+ if (!flag_exceptions || c_eh_initialized_p)
+ return;
+
+ c_eh_initialized_p = true;
+ eh_personality_libfunc
+ = init_one_libfunc (USING_SJLJ_EXCEPTIONS
+ ? "__gcc_personality_sj0"
+ : "__gcc_personality_v0");
+ default_init_unwind_resume_libfunc ();
+ using_eh_for_cleanups ();
+}
+
/* Finish processing of a declaration;
install its initial value.
If the length of an array type is not known before,
@@ -3676,16 +3693,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
TREE_USED (cleanup_decl) = 1;
/* Initialize EH, if we've been told to do so. */
- if (flag_exceptions && !c_eh_initialized_p)
- {
- c_eh_initialized_p = true;
- eh_personality_libfunc
- = init_one_libfunc (USING_SJLJ_EXCEPTIONS
- ? "__gcc_personality_sj0"
- : "__gcc_personality_v0");
- default_init_unwind_resume_libfunc ();
- using_eh_for_cleanups ();
- }
+ c_maybe_initialize_eh ();
push_cleanup (decl, cleanup, false);
}
OpenPOWER on IntegriCloud