Skip to content

Commit

Permalink
cmd/cgo: add column number to line directives
Browse files Browse the repository at this point in the history
Due to a new specification of //line: directives, missing
column info is now treated as column 0, aka "unknown column"
(see #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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
  • Loading branch information
kolyshkin authored and ianlancetaylor committed Jul 31, 2018
1 parent 344d0e0 commit 6bea321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cmd/cgo/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6bea321

Please sign in to comment.