This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 58633


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]