aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/cgo/ast.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/cgo/ast.go')
-rw-r--r--src/cmd/cgo/ast.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/cgo/ast.go b/src/cmd/cgo/ast.go
index 28879e349c..a78640f8e8 100644
--- a/src/cmd/cgo/ast.go
+++ b/src/cmd/cgo/ast.go
@@ -80,6 +80,11 @@ func (f *File) ParseGo(abspath string, src []byte) {
cg = d.Doc
}
if cg != nil {
+ if strings.ContainsAny(abspath, "\r\n") {
+ // This should have been checked when the file path was first resolved,
+ // but we double check here just to be sure.
+ fatalf("internal error: ParseGo: abspath contains unexpected newline character: %q", abspath)
+ }
f.Preamble += fmt.Sprintf("#line %d %q\n", sourceLine(cg), abspath)
f.Preamble += commentText(cg) + "\n"
f.Preamble += "#line 1 \"cgo-generated-wrapper\"\n"