aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-09-21 21:06:42 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-09-21 21:06:42 +0000
commita5682d15250e10bb47ebfc29d696160951855eed (patch)
treecaf19f369d81c20a26b0bf65ef428541b82e3ecf /gcc
parent70f3cf699d0b0c9892c20fce24a84e6f0a4a3751 (diff)
downloadgcc-a5682d15250e10bb47ebfc29d696160951855eed.zip
gcc-a5682d15250e10bb47ebfc29d696160951855eed.tar.gz
gcc-a5682d15250e10bb47ebfc29d696160951855eed.tar.bz2
Better handling of unexpected EOF in parser.
From-SVN: r179060
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/parse.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index b91bfbd..d914beb 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -1299,6 +1299,13 @@ Parse::declaration_may_start_here()
void
Parse::decl(void (Parse::*pfn)(void*), void* varg)
{
+ if (this->peek_token()->is_eof())
+ {
+ if (!saw_errors())
+ error_at(this->location(), "unexpected end of file");
+ return;
+ }
+
if (!this->peek_token()->is_op(OPERATOR_LPAREN))
(this->*pfn)(varg);
else