From 6bea321ba27a4c0c9424c11c6424697deee7cce2 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 30 Jul 2018 17:05:49 +0300 Subject: [PATCH] cmd/cgo: add column number to line directives Due to a new specification of //line: directives, missing column info is now treated as column 0, aka "unknown column" (see https://github.com/golang/go/issues/24183 for details). As cgo does not add column number to generated //line: directive, resulting files parsed do not have column info. Fix by adding column of 1 to generated line directives. Fixes #26692 Change-Id: Ie9263c0cf666b92d19c34240e745e8f32ffe7174 Reviewed-on: https://go-review.googlesource.com/126675 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/cmd/cgo/out.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 07874974ee..89598c96e8 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -522,7 +522,7 @@ func (p *Package) writeOutput(f *File, srcfile string) { // Write Go output: Go input with rewrites of C.xxx to _C_xxx. fmt.Fprintf(fgo1, "// Code generated by cmd/cgo; DO NOT EDIT.\n\n") - fmt.Fprintf(fgo1, "//line %s:1\n", srcfile) + fmt.Fprintf(fgo1, "//line %s:1:1\n", srcfile) fgo1.Write(f.Edit.Bytes()) // While we process the vars and funcs, also write gcc output. -- 2.50.0