]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: Ignore byte-order-mark at start of file.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Sep 2012 15:51:16 +0000 (15:51 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 19 Sep 2012 15:51:16 +0000 (15:51 +0000)
From-SVN: r191485

gcc/go/gofrontend/lex.cc

index 42d444b5fbc6a9b31ad459bac05241ddd1ef6d41..fa9db1f29aca1924f4e3b16aac2ebac0414d8c5c 100644 (file)
@@ -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();