aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-09-19 15:51:16 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-09-19 15:51:16 +0000
commit69d4d74dff077c4587c836052c931fc23a6a9679 (patch)
tree1530ed2de0a22ef1af76227cf5bee910ada88f5f
parent17fff17b06f8a9fe4aad1e117cce060be0c6ef61 (diff)
downloadgcc-69d4d74dff077c4587c836052c931fc23a6a9679.zip
gcc-69d4d74dff077c4587c836052c931fc23a6a9679.tar.gz
gcc-69d4d74dff077c4587c836052c931fc23a6a9679.tar.bz2
compiler: Ignore byte-order-mark at start of file.
From-SVN: r191485
-rw-r--r--gcc/go/gofrontend/lex.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/lex.cc b/gcc/go/gofrontend/lex.cc
index 42d444b..fa9db1f 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();