mirror of
https://github.com/golang/go
synced 2024-11-21 17:34:40 -07:00
gc: line comments may end in EOF
R=ken2 CC=golang-dev https://golang.org/cl/2907041
This commit is contained in:
parent
68b4255a96
commit
132e5435e3
@ -728,14 +728,10 @@ l0:
|
|||||||
if(c1 == '/') {
|
if(c1 == '/') {
|
||||||
c = getlinepragma();
|
c = getlinepragma();
|
||||||
for(;;) {
|
for(;;) {
|
||||||
if(c == '\n') {
|
if(c == '\n' || c == EOF) {
|
||||||
ungetc(c);
|
ungetc(c);
|
||||||
goto l0;
|
goto l0;
|
||||||
}
|
}
|
||||||
if(c == EOF) {
|
|
||||||
yyerror("eof in comment");
|
|
||||||
errorexit();
|
|
||||||
}
|
|
||||||
c = getr();
|
c = getr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
9
test/eof1.go
Normal file
9
test/eof1.go
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user