diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-09-19 10:12:52 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-09-19 10:12:52 +0200 |
commit | 9ad2a96babca1e646856b4335875b975f9bb7fa1 (patch) | |
tree | 4ac4867f2cfffd577fe5d9aa5fe4543bd2d96f45 /src/cmd | |
parent | 5ff4c17907d5b19510a62e08fd8d3b11e62b431d (diff) | |
download | golang-upstream/60.1.tar.gz |
Imported Upstream version 60.1upstream/60.1
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/cgo/doc.go | 3 | ||||
-rw-r--r-- | src/cmd/gc/obj.c | 10 | ||||
-rw-r--r-- | src/cmd/godoc/doc.go | 3 | ||||
-rw-r--r-- | src/cmd/ld/dwarf.c | 26 |
4 files changed, 22 insertions, 20 deletions
diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go index 63413825a..a4219867c 100644 --- a/src/cmd/cgo/doc.go +++ b/src/cmd/cgo/doc.go @@ -92,5 +92,8 @@ process of using cgo. See $GOROOT/misc/cgo/stdio and $GOROOT/misc/cgo/gmp for examples. Cgo does not yet work with gccgo. + +See "C? Go? Cgo!" for an introduction to using cgo: +http://blog.golang.org/2011/03/c-go-cgo.html */ package documentation diff --git a/src/cmd/gc/obj.c b/src/cmd/gc/obj.c index 456aabb88..f99f93bda 100644 --- a/src/cmd/gc/obj.c +++ b/src/cmd/gc/obj.c @@ -127,7 +127,6 @@ static void outhist(Biobuf *b) { Hist *h; - int i, depth = 0; char *p, ds[] = {'c', ':', '/', 0}; for(h = hist; h != H; h = h->link) { @@ -164,14 +163,7 @@ outhist(Biobuf *b) outzfile(b, p); } } - if(h->offset > 0) { - //line directive - depth++; - } - } else if(depth > 0) { - for(i = 0; i < depth; i++) - zhist(b, h->line, h->offset); - depth = 0; + } zhist(b, h->line, h->offset); } diff --git a/src/cmd/godoc/doc.go b/src/cmd/godoc/doc.go index dc98b0eca..088889d2a 100644 --- a/src/cmd/godoc/doc.go +++ b/src/cmd/godoc/doc.go @@ -126,5 +126,8 @@ one may run godoc as follows: godoc -http=:6060 -zip=go.zip -goroot=$HOME/go + +See "Godoc: documenting Go code" for how to write good comments for godoc: +http://blog.golang.org/2011/03/godoc-documenting-go-code.html */ package documentation diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c index d8ca27ace..77536018a 100644 --- a/src/cmd/ld/dwarf.c +++ b/src/cmd/ld/dwarf.c @@ -1578,13 +1578,16 @@ addhistfile(char *zentry) histfile[histfilesize++] = "<eof>"; fname = decodez(zentry); +// print("addhistfile %d: %s\n", histfilesize, fname); if (fname == 0) return -1; + // Don't fill with duplicates (check only top one). if (strcmp(fname, histfile[histfilesize-1]) == 0) { free(fname); return histfilesize - 1; } + histfile[histfilesize++] = fname; return histfilesize - 1; } @@ -1608,11 +1611,13 @@ finddebugruntimepath(void) } // Go's runtime C sources are sane, and Go sources nest only 1 level, -// so 16 should be plenty. +// so a handful would be plenty, if it weren't for the fact that line +// directives can push an unlimited number of them. static struct { int file; vlong line; -} includestack[16]; +} *includestack; +static int includestacksize; static int includetop; static vlong absline; @@ -1629,17 +1634,15 @@ static Linehist *linehist; static void checknesting(void) { - int i; - if (includetop < 0) { diag("dwarf: corrupt z stack"); errorexit(); } - if (includetop >= nelem(includestack)) { - diag("dwarf: nesting too deep"); - for (i = 0; i < nelem(includestack); i++) - diag("\t%s", histfile[includestack[i].file]); - errorexit(); + if (includetop >= includestacksize) { + includestacksize += 1; + includestacksize <<= 2; +// print("checknesting: growing to %d\n", includestacksize); + includestack = realloc(includestack, includestacksize * sizeof *includestack); } } @@ -1669,6 +1672,7 @@ inithist(Auto *a) // Clear the history. clearhistfile(); includetop = 0; + checknesting(); includestack[includetop].file = 0; includestack[includetop].line = -1; absline = 0; @@ -1682,10 +1686,10 @@ inithist(Auto *a) for (; a; a = a->link) { if (a->type == D_FILE) { // 'z' int f = addhistfile(a->asym->name); - if (f < 0) { // pop file + if (f < 0) { // pop file includetop--; checknesting(); - } else if(f != includestack[includetop].file) { // pushed a new file + } else { // pushed a file (potentially same) includestack[includetop].line += a->aoffset - absline; includetop++; checknesting(); |