[rfc] Return old cleanup when doing a restore_cleanups()
Kevin Buettner
kevinb@cygnus.com
Tue Aug 14 17:37:00 GMT 2001
On Aug 13, 3:28pm, Andrew Cagney wrote:
> The attached patch tweeks the restore_cleanups() family of functions so
> that the old cleanup is returned.
>
> In theory, that returned cleanup should be NULL (since the cleanup chain
> will have been drained just prior to the restore_cleanups() call). In
> reality, I'm not too sure. I'd like to find out what the old chain was
> so I can add an assert to certain callers (e.g. catch_errors()).
>
> I guess the alternative is to just stick the assert in
> restore_cleanups() and see what breaks.
>
> Thoughts? Preference?
At the moment, the only caller of restore_cleanups() is
catch_errors(), so the assert could just as easily go in
restore_cleanups() without causing any more breakage than placing the
assert in catch_errors().
If all (future) callers of restore_cleanups are supposed to drain the
cleanup chain first, then I think the assert belongs in
restore_cleanups(). If you think there might be a good reason to
violate this rule, then the assert belongs in the caller. Personally,
I'd rather see the assert go in restore_cleanups() until someone can
demonstrate a good reason for not draining the cleanup chain.
Kevin
More information about the Gdb-patches
mailing list