Commit e6f052b7 by Mark Mitchell Committed by Mark Mitchell

re PR c++/7679 (The compiler crashes wen a right parentesis is missing)

	PR c++/7679
	* spew.c (next_token): Do not return an endless stream of
	END_OF_SAVED_INPUT tokens.
	(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
	the cached token stream.
	(snarf_defarg): Likewise.

	PR c++/7679
	* g++.dg/parse/inline1.C: New test.

From-SVN: r58465
parent 16448fd4
2002-10-23 Mark Mitchell <mark@codesourcery.com>
PR c++/7679
* spew.c (next_token): Do not return an endless stream of
END_OF_SAVED_INPUT tokens.
(snarf_method): Add three END_OF_SAVED_INPUT tokens to the end of
the cached token stream.
(snarf_defarg): Likewise.
2002-10-23 Zack Weinberg <zack@codesourcery.com>
* cp-lang.c (cp_var_mod_type_p): New: C++ hook for
......
......@@ -477,8 +477,7 @@ next_token (t)
return t->yychar;
}
memcpy (t, &Teosi, sizeof (struct token));
return END_OF_SAVED_INPUT;
return 0;
}
/* Shift the next token onto the fifo. */
......@@ -1195,6 +1194,14 @@ snarf_method (decl)
: (interface_only ? 0 : 2)));
snarf_block (meth);
/* Add three END_OF_SAVED_INPUT tokens. We used to provide an
infinite stream of END_OF_SAVED_INPUT tokens -- but that can
cause the compiler to get stuck in an infinite loop when
encountering invalid code. We need more than one because the
parser sometimes peeks ahead several tokens. */
memcpy (space_for_token (meth), &Teosi, sizeof (struct token));
memcpy (space_for_token (meth), &Teosi, sizeof (struct token));
memcpy (space_for_token (meth), &Teosi, sizeof (struct token));
/* Happens when we get two declarations of the same function in the
same scope. */
......@@ -1253,6 +1260,14 @@ snarf_defarg ()
/* Unget the last token. */
push_token (remove_last_token (buf));
/* Add three END_OF_SAVED_INPUT tokens. We used to provide an
infinite stream of END_OF_SAVED_INPUT tokens -- but that can
cause the compiler to get stuck in an infinite loop when
encountering invalid code. We need more than one because the
parser sometimes peeks ahead several tokens. */
memcpy (space_for_token (buf), &Teosi, sizeof (struct token));
memcpy (space_for_token (buf), &Teosi, sizeof (struct token));
memcpy (space_for_token (buf), &Teosi, sizeof (struct token));
done:
#ifdef SPEW_DEBUG
......
2002-10-23 Mark Mitchell <mark@codesourcery.com>
PR c++/7679
* g++.dg/parse/inline1.C: New test.
2002-10-23 Richard Henderson <rth@redhat.com>
* g++.dg/inherit/thunk1.C: Enable for x86_64.
......
struct f
{
int oo()
{
return (2; // { dg-error "" }
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment