From 4fcedb191b3b8accdc8e986446a07ec035b61aed Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Tue, 22 Dec 1998 10:33:17 +0000 Subject: 1998-12-22 Mark Mitchell * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation. * tree.c (build_exception_variant): Don't crash on empty throw specs. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@24394 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/cp-tree.h | 4 +++- gcc/cp/tree.c | 4 +++- gcc/testsuite/g++.old-deja/g++.eh/spec5.C | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.eh/spec5.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ca7bc01683d..e4b724c7607 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1998-12-22 Mark Mitchell + + * cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation. + * tree.c (build_exception_variant): Don't crash on empty throw + specs. + 1998-12-18 DJ Delorie * cvt.c (convert_to_reference): Check for both error_mark_node diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index cb55b0635da..f4399e7be52 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1143,7 +1143,9 @@ struct lang_type #define TREE_PARMLIST(NODE) ((NODE)->common.unsigned_flag) /* overloaded! */ /* For FUNCTION_TYPE or METHOD_TYPE, a list of the exceptions that - this type can raise. */ + this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE + will be NULL_TREE to indicate a throw specification of `(...)', or, + equivalently, no throw specification. */ #define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE) /* The binding level associated with the namespace. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8bb750a6617..8777a119412 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1476,7 +1476,9 @@ build_exception_variant (type, raises) for (t = TYPE_RAISES_EXCEPTIONS (v), u = raises; t != NULL_TREE && u != NULL_TREE; t = TREE_CHAIN (t), u = TREE_CHAIN (v)) - if (!same_type_p (TREE_VALUE (t), TREE_VALUE (u))) + if (((TREE_VALUE (t) != NULL_TREE) + != (TREE_VALUE (u) != NULL_TREE)) + || !same_type_p (TREE_VALUE (t), TREE_VALUE (u))) break; if (!t && !u) diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec5.C b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C new file mode 100644 index 00000000000..56154f973ee --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec5.C @@ -0,0 +1,3 @@ +// Build don't link: + +extern void *f(unsigned int k) throw(); -- cgit v1.2.3