diff mbox series

Go patch committed: Don't advance past unexpected semicolon

Message ID CAOyqgcXERfyaD9kfBzp9wJLGgG26nPZ-WfPZKG2YfGz4E4YZTw@mail.gmail.com
State New
Headers show
Series Go patch committed: Don't advance past unexpected semicolon | expand

Commit Message

Ian Lance Taylor Dec. 2, 2020, 3:47 p.m. UTC
This Go frontend patch changes the parser to not advance past an
unexpected semicolon, after it gives an error.  We've already read the
unexpected semicolon, so advancing again causes us to skip the next
token, causing future errors to be out of sync.  Bootstrapped and ran
Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
91bbf4342966cee0f8557068a116c4f2622a3539

Comments

Ian Lance Taylor Dec. 2, 2020, 5:44 p.m. UTC | #1
On Wed, Dec 2, 2020 at 7:47 AM Ian Lance Taylor <iant@golang.org> wrote:
>
> This Go frontend patch changes the parser to not advance past an
> unexpected semicolon, after it gives an error.  We've already read the
> unexpected semicolon, so advancing again causes us to skip the next
> token, causing future errors to be out of sync.  Bootstrapped and ran
> Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

This requires updating a test, which I forgot to do.  Committed this
patch to mainline.

Ian
55ba4ab02661bf4710bd7e58ed0f1b99922cabe9
diff --git a/gcc/testsuite/go.test/test/syntax/semi6.go b/gcc/testsuite/go.test/test/syntax/semi6.go
index c1e1cc363a2..9bc730d43d6 100644
--- a/gcc/testsuite/go.test/test/syntax/semi6.go
+++ b/gcc/testsuite/go.test/test/syntax/semi6.go
@@ -1,13 +1,11 @@
 // errorcheck
 
-// Copyright 2010 The Go Authors.  All rights reserved.
+// Copyright 2010 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
 package main
 
-type T	// ERROR "unexpected semicolon or newline in type declaration"
-{
-
-
+type T1	// ERROR "newline in type declaration"
 
+type T2 /* // ERROR "(semicolon.*|EOF) in type declaration" */
\ No newline at end of file
diff mbox series

Patch

diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 45f62b3bec5..8cba9aa5a3d 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@ 
-2cc5c746ddfbaeb731f10f2232b9a488df12b71e
+81d3afed2b7f7eba4eed4599dfdd10081f67391e
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index c9a5485049f..b062a471008 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -1567,7 +1567,6 @@  Parse::type_spec(void*, unsigned int pragmas)
       go_error_at(this->location(),
 		  "unexpected semicolon or newline in type declaration");
       type = Type::make_error_type();
-      this->advance_token();
     }
 
   if (type->is_error_type())