]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: document variables and functions
authorKevin Burke <kev@inburke.com>
Sat, 12 Nov 2016 00:56:07 +0000 (16:56 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 30 Nov 2016 00:14:52 +0000 (00:14 +0000)
Change-Id: I01b2278eb50585331b8ff7ff5e3c1f9c5ba52b63
Reviewed-on: https://go-review.googlesource.com/33156
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/subr.go

index d42775538647253e985356ba2aece7dc82dd4152..ff33e9c1c4b1bc4069c98b3c4902837cf3d239cc 100644 (file)
@@ -119,8 +119,12 @@ var linkobj string
 
 var bout *bio.Writer
 
+// nerrors is the number of compiler errors reported
+// since the last call to saveerrors.
 var nerrors int
 
+// nsavederrors is the total number of compiler errors
+// reported before the last call to saveerrors.
 var nsavederrors int
 
 var nsyntaxerrors int
index edb37c2c742a22cc4da10c8c1c01e63ee0cd12ae..75f58a731c079f1bae8f7c19bfc4dd5467caa653 100644 (file)
@@ -98,6 +98,9 @@ func supportsDynlink(arch *sys.Arch) bool {
 var timings Timings
 var benchfile string
 
+// Main parses flags and Go source files specified in the command-line
+// arguments, type-checks the parsed Go package, compiles functions to machine
+// code, and finally writes the compiled package definition to disk.
 func Main() {
        timings.Start("fe", "init")
 
@@ -483,6 +486,7 @@ func Main() {
                errorexit()
        }
 
+       // Write object data to disk.
        timings.Start("be", "dumpobj")
        dumpobj()
        if asmhdr != "" {
index fb5419f5338e5ce6a90f3f03d4766a0ba495a667..a53ba1fffc1bce839f4d1c15f47f01b90bf6c676 100644 (file)
@@ -58,6 +58,8 @@ func (x byLineno) Len() int           { return len(x) }
 func (x byLineno) Less(i, j int) bool { return x[i].lineno < x[j].lineno }
 func (x byLineno) Swap(i, j int)      { x[i], x[j] = x[j], x[i] }
 
+// flusherrors sorts errors seen so far by line number, prints them to stdout,
+// and empties the errors array.
 func flusherrors() {
        Ctxt.Bso.Flush()
        if len(errors) == 0 {