From 69d4d74dff077c4587c836052c931fc23a6a9679 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 19 Sep 2012 15:51:16 +0000 Subject: [PATCH] compiler: Ignore byte-order-mark at start of file. From-SVN: r191485 --- gcc/go/gofrontend/lex.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc index 42d444b5fbc..fa9db1f29ac 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(); -- 2.30.2