diff options
author | Anthony Martin <ality@pbrane.org> | 2014-02-12 14:29:11 -0500 |
---|---|---|
committer | Anthony Martin <ality@pbrane.org> | 2014-02-12 14:29:11 -0500 |
commit | 4fd1804be969e00451508f1b97dfb461627b4f7e (patch) | |
tree | 7d3f8b41fa060fcb9cfb363882968a82484294ed /src/cmd/ld/lib.c | |
parent | 334bd5a56c780acc2f0640042637906f698bab71 (diff) | |
download | go-4fd1804be969e00451508f1b97dfb461627b4f7e.tar.gz |
cmd/cc, cmd/gc, cmd/ld: consolidate print format routines
We now use the %A, %D, %P, and %R routines from liblink
across the board.
Fixes issue 7178.
Fixes issue 7055.
LGTM=iant
R=golang-codereviews, gobot, rsc, dave, iant, remyoudompheng
CC=golang-codereviews
https://codereview.appspot.com/49170043
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/ld/lib.c')
-rw-r--r-- | src/cmd/ld/lib.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index eb02ae5e8..f91cb6a6c 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -1443,3 +1443,27 @@ undef(void) if(nerrors > 0) errorexit(); } + +void +diag(char *fmt, ...) +{ + char buf[1024], *tn, *sep; + va_list arg; + + tn = ""; + sep = ""; + if(ctxt->cursym != S) { + tn = ctxt->cursym->name; + sep = ": "; + } + va_start(arg, fmt); + vseprint(buf, buf+sizeof(buf), fmt, arg); + va_end(arg); + print("%s%s%s\n", tn, sep, buf); + + nerrors++; + if(nerrors > 20) { + print("too many errors\n"); + errorexit(); + } +} |