This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to parse errors and feed_input
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH to parse errors and feed_input
- From: Jason Merrill <jason_merrill at redhat dot com>
- Date: 02 Oct 2001 16:40:04 +0100
This patch fixes a bug whereby we fed an endless stream of
END_OF_SAVED_INPUT to the parser because had ignored the
PRE_PARSED_FUNCTION_DECL token due to an earlier error.
2001-10-02 Jason Merrill <jason_merrill@redhat.com>
* spew.c (end_input): No longer static.
* cp-tree.h: Declare it.
* parse.y (datadef): Add "error END_OF_SAVED_INPUT" expansion.
*** parse.y.~1~ Sun Sep 23 16:36:15 2001
--- parse.y Tue Oct 2 15:11:43 2001
*************** datadef:
*** 736,741 ****
--- 736,743 ----
}
| error ';'
| error '}'
+ | error END_OF_SAVED_INPUT
+ { end_input (); }
| ';'
| bad_decl
;
*** cp-tree.h.~1~ Mon Oct 1 13:52:24 2001
--- cp-tree.h Tue Oct 2 15:34:32 2001
*************** extern void do_pending_defargs PARAMS
*** 4142,4147 ****
--- 4142,4148 ----
extern void done_pending_defargs PARAMS ((void));
extern void unprocessed_defarg_fn PARAMS ((tree));
extern void replace_defarg PARAMS ((tree, tree));
+ extern void end_input PARAMS ((void));
/* in tree.c */
extern void init_tree PARAMS ((void));
*** spew.c.~1~ Sun Sep 23 16:38:55 2001
--- spew.c Tue Oct 2 15:34:40 2001
*************** static SPEW_INLINE void consume_token PA
*** 113,119 ****
static SPEW_INLINE int read_process_identifier PARAMS ((YYSTYPE *));
static SPEW_INLINE void feed_input PARAMS ((struct unparsed_text *));
- static SPEW_INLINE void end_input PARAMS ((void));
static SPEW_INLINE void snarf_block PARAMS ((const char *, int));
static tree snarf_defarg PARAMS ((void));
static int frob_id PARAMS ((int, int, tree *));
--- 113,118 ----
*************** read_token (t)
*** 358,364 ****
return t->yychar;
}
! static SPEW_INLINE void
feed_input (input)
struct unparsed_text *input;
{
--- 357,363 ----
return t->yychar;
}
! static void
feed_input (input)
struct unparsed_text *input;
{
*************** feed_input (input)
*** 397,403 ****
feed = f;
}
! static SPEW_INLINE void
end_input ()
{
struct feed *f = feed;
--- 396,402 ----
feed = f;
}
! void
end_input ()
{
struct feed *f = feed;
// Test that the parser doesn't go into an infinite loop from ignoring the
// PRE_PARSED_FUNCTION_DECL token.
class C { static void* operator new(size_t); }; // { dg-error "" "" }
void* C::operator new(size_t) { return 0; } // { dg-error "" "" }
class D { D(int i): integer(i){}}; // { dg-error "" "" }