On Wed, Oct 5, 2016 at 11:29 AM, Marek Polacek <pola...@redhat.com> wrote: > On Wed, Oct 05, 2016 at 10:48:19AM -0400, Jason Merrill wrote: >> On Wed, Oct 5, 2016 at 9:14 AM, Marek Polacek <pola...@redhat.com> wrote: >> > +/* Return true if we're looking at (init; cond), false otherwise. */ >> > + >> > +static bool >> > +cp_parser_init_statement_p (cp_parser *parser) >> > +{ >> > + unsigned paren_depth = 0; >> > + unsigned brace_depth = 0; >> >> Do we really need another one of these token scanning functions? >> Can't you write this in terms of >> cp_parser_skip_to_closing_parenthesis? >> >> > + /* Parse the optional init-statement. */ >> > + tree decl; >> > + cp_lexer_save_tokens (parser->lexer); >> > + const bool init_stmt_p = cp_parser_init_statement_p (parser); >> > + /* Roll back the tokens we skipped. */ >> > + cp_lexer_rollback_tokens (parser->lexer); >> >> The save/rollback should be in the the predicate function, not the caller. > > How about the version I just posted, i.e. > <https://gcc.gnu.org/ml/gcc-patches/2016-10/msg00252.html>?
That doesn't address my first comment. Jason