From: Ian Lance Taylor Date: Wed, 21 Sep 2011 21:06:42 +0000 (+0000) Subject: Better handling of unexpected EOF in parser. X-Git-Tag: releases/gcc-4.7.0~3655 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a5682d15250e10bb47ebfc29d696160951855eed;p=thirdparty%2Fgcc.git Better handling of unexpected EOF in parser. From-SVN: r179060 --- diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index b91bfbdbf030..d914bebd36bd 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