This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: speculative instantiation and diagnostics
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, "jason at redhat dot com" <jason at redhat dot com>
- Date: Fri, 13 Sep 2002 14:45:59 -0700
- Subject: Re: speculative instantiation and diagnostics
I've been worried about these problems for a long time, but I'm not quite
sure what to do. The rules for template instantiation are very hard to
get right.
Mark, it occurs to me that this is a similar requirement to the
speculative parsing that the new parser must do, so a similar machinery
should be used for both. Also the compiler's full of annoying checks for
error_mark_node. Starting from a clean slate, something like
if (push_error_handler (&errorcatcher)) {
handle error from do stuff
either rethrow (errorcatcher)
or return
}
... do stuff
pop_error_handler ()
This is something that could be implemented with setjmp/longjmp. And we'd
need some way of squirrelling away a diagnostic, without the overhead of
actually formatting it (until it really is emitted)
The first draft of the new parser did something a bit like this; it
actually queued up diagnostics until it was sure it wanted to emit
them. That was complex and error-prone; in the new new parser, I've
thus far avoided having to do that. EDG does not queue, so there
is an existence proof that it can be done.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com