From: Ian Lance Taylor Date: Wed, 19 Sep 2012 15:51:16 +0000 (+0000) Subject: compiler: Ignore byte-order-mark at start of file. X-Git-Tag: misc/gccgo-go1_1_2~751 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69d4d74dff077c4587c836052c931fc23a6a9679;p=thirdparty%2Fgcc.git compiler: Ignore byte-order-mark at start of file. From-SVN: r191485 --- diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 42d444b5fbc6..fa9db1f29aca 100644 --- a/gcc/go/gofrontend/lex.cc +++ b/gcc/go/gofrontend/lex.cc @@ -722,7 +722,16 @@ Lex::next_token() unsigned int ci; bool issued_error; this->lineoff_ = p - this->linebuf_; - this->advance_one_utf8_char(p, &ci, &issued_error); + const char *pnext = this->advance_one_utf8_char(p, &ci, + &issued_error); + + // Ignore byte order mark at start of file. + if (ci == 0xfeff && this->lineno_ == 1 && this->lineoff_ == 0) + { + p = pnext; + break; + } + if (Lex::is_unicode_letter(ci)) return this->gather_identifier();