This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH for throw specifications
- To: vonbrand at sleipnir dot valparaiso dot cl
- Subject: C++ PATCH for throw specifications
- From: Mark Mitchell <mark at markmitchell dot com>
- Date: Tue, 22 Dec 1998 09:45:52 -0800
- CC: egcs-patches at cygnus dot com, Jason Merrill <jason at cygnus dot com>
- References: <199812220212.XAA22273@sleipnir.valparaiso.cl>
- Reply-to: mark at markmitchell dot com
Here's a patch which fixes the problem with throw specs in the latest
snapshot. I have not yet checked this in as I am still running tests,
but I will as soon as the tests finish running.
--
Mark Mitchell mark@markmitchell.com
Mark Mitchell Consulting http://www.markmitchell.com
1998-12-22 Mark Mitchell <mark@markmitchell.com>
* cp-tree.h (TYPE_RAISES_EXCEPTIONS): Improve documentation.
* tree.c (build_exception_variant): Don't crash on empty throw
specs.
Index: testsuite/g++.old-deja/g++.eh/spec5.C
===================================================================
RCS file: spec5.C
diff -N spec5.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- spec5.C Tue Dec 22 09:40:50 1998
***************
*** 0 ****
--- 1,3 ----
+ // Build don't link:
+
+ extern void *f(unsigned int k) throw();
Index: cp/cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.182
diff -c -p -r1.182 cp-tree.h
*** cp-tree.h 1998/12/16 21:15:11 1.182
--- cp-tree.h 1998/12/22 17:40:53
*************** struct lang_type
*** 1143,1149 ****
#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. */
#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_NONCOPIED_PARTS (NODE)
/* The binding level associated with the namespace. */
--- 1143,1151 ----
#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. 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. */
Index: cp/tree.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/tree.c,v
retrieving revision 1.85
diff -c -p -r1.85 tree.c
*** tree.c 1998/12/16 21:16:16 1.85
--- tree.c 1998/12/22 17:40:54
*************** build_exception_variant (type, raises)
*** 1476,1482 ****
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)))
break;
if (!t && !u)
--- 1476,1484 ----
for (t = TYPE_RAISES_EXCEPTIONS (v), u = raises;
t != NULL_TREE && u != NULL_TREE;
t = TREE_CHAIN (t), u = TREE_CHAIN (v))
! if (((TREE_VALUE (t) != NULL_TREE)
! != (TREE_VALUE (u) != NULL_TREE))
! || !same_type_p (TREE_VALUE (t), TREE_VALUE (u)))
break;
if (!t && !u)