summaryrefslogtreecommitdiff
path: root/gcc/cp/except.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-16 02:27:02 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-16 02:27:02 +0000
commit54f6ea65c2f6dd92b6ddf40bb1f4e28575cd1218 (patch)
tree699ab721514cf76b302460b68157f29fee95d298 /gcc/cp/except.c
parent00b7ca84db5fc0fb4085836d7a5cf277ab132168 (diff)
downloadgcc-54f6ea65c2f6dd92b6ddf40bb1f4e28575cd1218.tar.gz
gcc:
* c.opt: Add -fnothrow-opt. gcc/cp: * cp-tree.h (TYPE_NOEXCEPT_P): New macro. * except.c (begin_eh_spec_block): Use MUST_NOT_THROW_EXPR if TYPE_NOEXCEPT_P. (finish_eh_spec_block): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159450 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/except.c')
-rw-r--r--gcc/cp/except.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 48ace536c54..c0867ef6656 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -513,9 +513,18 @@ expand_end_catch_block (void)
tree
begin_eh_spec_block (void)
{
- tree r = build_stmt (input_location, EH_SPEC_BLOCK, NULL_TREE, NULL_TREE);
+ tree r;
+ /* A noexcept specification (or throw() with -fnothrow-opt) is a
+ MUST_NOT_THROW_EXPR. */
+ if (TYPE_NOEXCEPT_P (TREE_TYPE (current_function_decl)))
+ {
+ r = build_stmt (input_location, MUST_NOT_THROW_EXPR, NULL_TREE);
+ TREE_SIDE_EFFECTS (r) = 1;
+ }
+ else
+ r = build_stmt (input_location, EH_SPEC_BLOCK, NULL_TREE, NULL_TREE);
add_stmt (r);
- EH_SPEC_STMTS (r) = push_stmt_list ();
+ TREE_OPERAND (r, 0) = push_stmt_list ();
return r;
}
@@ -524,7 +533,11 @@ finish_eh_spec_block (tree raw_raises, tree eh_spec_block)
{
tree raises;
- EH_SPEC_STMTS (eh_spec_block) = pop_stmt_list (EH_SPEC_STMTS (eh_spec_block));
+ TREE_OPERAND (eh_spec_block, 0)
+ = pop_stmt_list (TREE_OPERAND (eh_spec_block, 0));
+
+ if (TREE_CODE (eh_spec_block) == MUST_NOT_THROW_EXPR)
+ return;
/* Strip cv quals, etc, from the specification types. */
for (raises = NULL_TREE;