This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 58633
- From: Jason Merrill <jason at redhat dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "Mitchell, Mark" <mark_mitchell at mentor dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 10 Oct 2013 14:48:27 -0400
- Subject: Re: [C++ Patch] PR 58633
- Authentication-results: sourceware.org; auth=none
- References: <525459D9 dot 1020601 at oracle dot com> <52548F36 dot 4050800 at oracle dot com> <525560A4 dot 1030603 at redhat dot com> <52556B83 dot 50304 at oracle dot com> <F62E2783-3408-479F-9312-238471D80E3B at mentor dot com>
On 10/09/2013 11:14 AM, Mitchell, Mark wrote:
Unfortunately, I no longer remember this code well. My recollection --
such as it is -- is just that I couldn't find a case where it was
necessary to commit only a single level. You sometimes had to scan an
unbounded number of tokens to complete the parse -- but once you
determined what you had, you knew exactly what had happened up to this
point. Perhaps you have now found a counter-example, or perhaps
something new in the language has changed the situation -- or perhaps I
just don't remember correctly.
In this case, we're parsing tentatively for the decltype form, and then
within that parsing tentatively for a pseudo-destructor. We see that we
definitely have a pseudo-destructor, but that doesn't mean that the
decltype expression has the form we want.
I think that committing was important for two primary reasons:
1. We should not have irreversible side-effects while in a tentative
state. For example, we shouldn't create a permanent entry in the
symbol table, or issue an error message that might not apply if the
tentative parse is aborted. The "tentative" stuff is only in the
parser; there's no easy way to remove a function or variable from
the symbol table, or undo other pieces of global state in the
compiler as a whole.
Right. In cases where there aren't side-effects, this shouldn't be an
issue. We should only use Paolo's new function in such cases; Paolo,
please add that to the comment. The patch is OK with that change.
2. Committing allows us to flush the buffer of saved tokens, emit any
queued error messages, etc. So, there is a performance benefit in
committing.
I think this particular commit was to improve diagnostics.
I'm sorry not to be able to be of more help.
That was useful, thank you.
Jason