aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-01-18 12:52:24 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-01-18 12:52:24 +0000
commit96176bb3f185bdb1251f1b427c2a50b0088ac80f (patch)
tree9b37448019297c4ff5a879c2b74fa8cfeeb4bfe9 /gcc
parent2c65d990eb80d25c2e040be14a2918a0311dc37c (diff)
downloadgcc-96176bb3f185bdb1251f1b427c2a50b0088ac80f.zip
gcc-96176bb3f185bdb1251f1b427c2a50b0088ac80f.tar.gz
gcc-96176bb3f185bdb1251f1b427c2a50b0088ac80f.tar.bz2
cp-tree.h: Clarify exception spec node comment.
* cp-tree.h: Clarify exception spec node comment. * except.c (nothrow_spec_p): Simplify by checking node-equality. From-SVN: r244576
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/except.c16
3 files changed, 14 insertions, 8 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7733be7..32bf9e3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2017-01-18 Nathan Sidwell <nathan@acm.org>
+ * cp-tree.h: Clarify exception spec node comment.
+ * except.c (nothrow_spec_p): Simplify by checking node-equality.
+
PR c++/79091
* mangle.c (write_exception_spec): Check nothrow explicitly.
(write_encoding): Don't increment processing_template_decl around
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0c8f147..98e4cbd 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1212,7 +1212,8 @@ extern GTY(()) tree cp_global_trees[CPTI_MAX];
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
-/* Exception specifier used for throw(). */
+/* Exception specifiers used for throw(), noexcept(true) and
+ noexcept(false). We rely on these being uncloned. */
#define empty_except_spec cp_global_trees[CPTI_EMPTY_EXCEPT_SPEC]
#define noexcept_true_spec cp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC]
#define noexcept_false_spec cp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC]
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 034c35a..bfc3290 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -1143,15 +1143,17 @@ bool
nothrow_spec_p (const_tree spec)
{
gcc_assert (!DEFERRED_NOEXCEPT_SPEC_P (spec));
- if (spec == NULL_TREE
- || TREE_VALUE (spec) != NULL_TREE
- || spec == noexcept_false_spec)
- return false;
- if (TREE_PURPOSE (spec) == NULL_TREE
+
+ if (spec == empty_except_spec
|| spec == noexcept_true_spec)
return true;
- gcc_assert (processing_template_decl
- || TREE_PURPOSE (spec) == error_mark_node);
+
+ gcc_assert (!spec
+ || TREE_VALUE (spec)
+ || spec == noexcept_false_spec
+ || TREE_PURPOSE (spec) == error_mark_node
+ || processing_template_decl);
+
return false;
}