Skip to content

Commit 655a4e1

Browse files
kevinburkemdempsky
authored andcommitted
cmd/compile/internal/gc: document variables and functions
Change-Id: I01b2278eb50585331b8ff7ff5e3c1f9c5ba52b63 Reviewed-on: https://go-review.googlesource.com/33156 Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 0dd7e40 commit 655a4e1

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/cmd/compile/internal/gc/go.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ var linkobj string
119119

120120
var bout *bio.Writer
121121

122+
// nerrors is the number of compiler errors reported
123+
// since the last call to saveerrors.
122124
var nerrors int
123125

126+
// nsavederrors is the total number of compiler errors
127+
// reported before the last call to saveerrors.
124128
var nsavederrors int
125129

126130
var nsyntaxerrors int

src/cmd/compile/internal/gc/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func supportsDynlink(arch *sys.Arch) bool {
9898
var timings Timings
9999
var benchfile string
100100

101+
// Main parses flags and Go source files specified in the command-line
102+
// arguments, type-checks the parsed Go package, compiles functions to machine
103+
// code, and finally writes the compiled package definition to disk.
101104
func Main() {
102105
timings.Start("fe", "init")
103106

@@ -483,6 +486,7 @@ func Main() {
483486
errorexit()
484487
}
485488

489+
// Write object data to disk.
486490
timings.Start("be", "dumpobj")
487491
dumpobj()
488492
if asmhdr != "" {

src/cmd/compile/internal/gc/subr.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func (x byLineno) Len() int { return len(x) }
5858
func (x byLineno) Less(i, j int) bool { return x[i].lineno < x[j].lineno }
5959
func (x byLineno) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
6060

61+
// flusherrors sorts errors seen so far by line number, prints them to stdout,
62+
// and empties the errors array.
6163
func flusherrors() {
6264
Ctxt.Bso.Flush()
6365
if len(errors) == 0 {

0 commit comments

Comments
 (0)