aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-06-04 17:21:23 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-06-04 17:21:23 -0400
commit3a55fb4c89d4489cd21a8efde78a6f0de2e72099 (patch)
tree45574d319c9bf599a6b62ec4994fe09f77d4a51b /gcc/cp/tree.c
parent0a766368bd6e51459bfd334086cc04af48f91f08 (diff)
downloadgcc-3a55fb4c89d4489cd21a8efde78a6f0de2e72099.zip
gcc-3a55fb4c89d4489cd21a8efde78a6f0de2e72099.tar.gz
gcc-3a55fb4c89d4489cd21a8efde78a6f0de2e72099.tar.bz2
Implement noexcept-specification (15.4)
Implement noexcept-specification (15.4) * parser.c (cp_parser_exception_specification_opt): Parse it. Give -Wdeprecated warning about throw() specs. * pt.c (tsubst_exception_specification): Handle it. * error.c (dump_exception_spec): Handle it. * cxx-pretty-print.c (pp_cxx_exception_specification): Likewise. * typeck.c (comp_except_specs): Handle compatibility rules. Change exact parm to take an enum. * typeck2.c (merge_exception_specifiers): Handle noexcept. * except.c (nothrow_spec_p, type_noexcept_p): New fns. (type_throw_all_p, build_noexcept_spec): New fns. * cp-tree.h (TYPE_NOTHROW_P, TYPE_NOEXCEPT_P): Use them. (comp_except_specs): Define ce_derived, ce_normal, ce_exact enums. (cp_tree_index): Add CPTI_NOEXCEPT_TRUE_SPEC, CPTI_NOEXCEPT_FALSE_SPEC. (noexcept_true_spec, noexcept_false_spec): New macros. * name-lookup.c (pushdecl_maybe_friend): Adjust. * search.c (check_final_overrider): Adjust. * decl.c (check_redeclaration_exception_specification): Adjust. (use_eh_spec_block): Use type_throw_all_p. (cxx_init_decl_processing): Set noexcept_false_spec,noexcept_true_spec. Give operator new a noexcept-specification in C++0x mode. * tree.c (build_exception_variant, cxx_type_hash_eq): Adjust. (cp_build_type_attribute_variant): Don't test TYPE_RAISES_EXCEPTIONS. From-SVN: r160298
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index c4b9dd5..7d0e476 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1467,12 +1467,16 @@ cxx_printable_name_translate (tree decl, int v)
tree
build_exception_variant (tree type, tree raises)
{
- tree v = TYPE_MAIN_VARIANT (type);
- int type_quals = TYPE_QUALS (type);
+ tree v;
+ int type_quals;
- for (; v; v = TYPE_NEXT_VARIANT (v))
+ if (comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (type), ce_exact))
+ return type;
+
+ type_quals = TYPE_QUALS (type);
+ for (v = TYPE_MAIN_VARIANT (type); v; v = TYPE_NEXT_VARIANT (v))
if (check_qualified_type (v, type, type_quals)
- && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), 1))
+ && comp_except_specs (raises, TYPE_RAISES_EXCEPTIONS (v), ce_exact))
return v;
/* Need to build a new variant. */
@@ -2645,10 +2649,8 @@ cp_build_type_attribute_variant (tree type, tree attributes)
tree new_type;
new_type = build_type_attribute_variant (type, attributes);
- if ((TREE_CODE (new_type) == FUNCTION_TYPE
- || TREE_CODE (new_type) == METHOD_TYPE)
- && (TYPE_RAISES_EXCEPTIONS (new_type)
- != TYPE_RAISES_EXCEPTIONS (type)))
+ if (TREE_CODE (new_type) == FUNCTION_TYPE
+ || TREE_CODE (new_type) == METHOD_TYPE)
new_type = build_exception_variant (new_type,
TYPE_RAISES_EXCEPTIONS (type));
@@ -2669,7 +2671,7 @@ cxx_type_hash_eq (const_tree typea, const_tree typeb)
gcc_assert (TREE_CODE (typea) == FUNCTION_TYPE);
return comp_except_specs (TYPE_RAISES_EXCEPTIONS (typea),
- TYPE_RAISES_EXCEPTIONS (typeb), 1);
+ TYPE_RAISES_EXCEPTIONS (typeb), ce_exact);
}
/* Apply FUNC to all language-specific sub-trees of TP in a pre-order