]> Cypherpunks repositories - gostls13.git/commitdiff
gc: line comments may end in EOF
authorRuss Cox <rsc@golang.org>
Thu, 4 Nov 2010 20:04:04 +0000 (16:04 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 4 Nov 2010 20:04:04 +0000 (16:04 -0400)
R=ken2
CC=golang-dev
https://golang.org/cl/2907041

src/cmd/gc/lex.c
test/eof1.go [new file with mode: 0644]

index f9d9267709da392835cebbb64e7a21caea520f1f..9dded356d4701e71f8fa9c4c0a9ce84eb404e578 100644 (file)
@@ -728,14 +728,10 @@ l0:
                if(c1 == '/') {
                        c = getlinepragma();
                        for(;;) {
-                               if(c == '\n') {
+                               if(c == '\n' || c == EOF) {
                                        ungetc(c);
                                        goto l0;
                                }
-                               if(c == EOF) {
-                                       yyerror("eof in comment");
-                                       errorexit();
-                               }
                                c = getr();
                        }
                }
diff --git a/test/eof1.go b/test/eof1.go
new file mode 100644 (file)
index 0000000..c39a3cf
--- /dev/null
@@ -0,0 +1,9 @@
+// $G $D/$F.go
+
+// 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
+
+// No newline at the end of this comment.
\ No newline at end of file