C++ PATCH for EH-only cleanups, part 1 (for c++/5636)

Jason Merrill jason@redhat.com
Wed Apr 3 15:52:00 GMT 2002


My named return value code was a bit over-enthusiastic about nullifying
cleanups for a chosen local variable; if the function exits with an
exception, we can't expect the caller to handle destroying the variable.
This patch adds support for EH-only cleanups using the usual machinery, and
changes the nrv support to set the EH-only flag on cleanups for the nrv.

Tested i686-pc-linux-gnu, applied trunk and 3.1.
Test in g++.dg/eh/nrv1.C.

2002-04-03  Jason Merrill  <jason@redhat.com>

	PR c++/5636
	* tree.h (CLEANUP_EH_ONLY): New macro.
	* stmt.c (expand_decl_cleanup_eh): New fn.
	(expand_cleanups): Check CLEANUP_EH_ONLY.
	* c-semantics.c (genrtl_decl_cleanup): Just take the CLEANUP_STMT.
	Use expand_decl_cleanup_eh.
	(expand_stmt): Adjust.
	* c-common.h: Adjust prototype.
	* cp/semantics.c (nullify_returns_r): Just set CLEANUP_EH_ONLY on
	cleanup for nrv.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-patch
Size: 6276 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20020403/9f781fa0/attachment.bin>


More information about the Gcc-patches mailing list