mirror of
https://github.com/golang/go
synced 2024-11-25 05:57:57 -07:00
runtime: write only to standard error
Will mail a warning to golang-nuts once this is submitted. R=r, niemeyer CC=golang-dev https://golang.org/cl/3573043
This commit is contained in:
parent
43f459ce51
commit
d110ae8dd0
@ -29,7 +29,7 @@ runtime·dump(byte *p, int32 n)
|
|||||||
void
|
void
|
||||||
runtime·prints(int8 *s)
|
runtime·prints(int8 *s)
|
||||||
{
|
{
|
||||||
runtime·write(runtime·fd, s, runtime·findnull((byte*)s));
|
runtime·write(2, s, runtime·findnull((byte*)s));
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma textflag 7
|
#pragma textflag 7
|
||||||
@ -65,7 +65,7 @@ vprintf(int8 *s, byte *arg)
|
|||||||
if(*p != '%')
|
if(*p != '%')
|
||||||
continue;
|
continue;
|
||||||
if(p > lp)
|
if(p > lp)
|
||||||
runtime·write(runtime·fd, lp, p-lp);
|
runtime·write(2, lp, p-lp);
|
||||||
p++;
|
p++;
|
||||||
narg = nil;
|
narg = nil;
|
||||||
switch(*p) {
|
switch(*p) {
|
||||||
@ -155,7 +155,7 @@ vprintf(int8 *s, byte *arg)
|
|||||||
lp = p+1;
|
lp = p+1;
|
||||||
}
|
}
|
||||||
if(p > lp)
|
if(p > lp)
|
||||||
runtime·write(runtime·fd, lp, p-lp);
|
runtime·write(2, lp, p-lp);
|
||||||
|
|
||||||
// unlock(&debuglock);
|
// unlock(&debuglock);
|
||||||
}
|
}
|
||||||
@ -181,10 +181,10 @@ void
|
|||||||
runtime·printbool(bool v)
|
runtime·printbool(bool v)
|
||||||
{
|
{
|
||||||
if(v) {
|
if(v) {
|
||||||
runtime·write(runtime·fd, (byte*)"true", 4);
|
runtime·write(2, (byte*)"true", 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runtime·write(runtime·fd, (byte*)"false", 5);
|
runtime·write(2, (byte*)"false", 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -195,15 +195,15 @@ runtime·printfloat(float64 v)
|
|||||||
float64 h;
|
float64 h;
|
||||||
|
|
||||||
if(runtime·isNaN(v)) {
|
if(runtime·isNaN(v)) {
|
||||||
runtime·write(runtime·fd, "NaN", 3);
|
runtime·write(2, "NaN", 3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(runtime·isInf(v, 1)) {
|
if(runtime·isInf(v, 1)) {
|
||||||
runtime·write(runtime·fd, "+Inf", 4);
|
runtime·write(2, "+Inf", 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(runtime·isInf(v, -1)) {
|
if(runtime·isInf(v, -1)) {
|
||||||
runtime·write(runtime·fd, "-Inf", 4);
|
runtime·write(2, "-Inf", 4);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,16 +262,16 @@ runtime·printfloat(float64 v)
|
|||||||
buf[n+4] = (e/100) + '0';
|
buf[n+4] = (e/100) + '0';
|
||||||
buf[n+5] = (e/10)%10 + '0';
|
buf[n+5] = (e/10)%10 + '0';
|
||||||
buf[n+6] = (e%10) + '0';
|
buf[n+6] = (e%10) + '0';
|
||||||
runtime·write(runtime·fd, buf, n+7);
|
runtime·write(2, buf, n+7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime·printcomplex(Complex128 v)
|
runtime·printcomplex(Complex128 v)
|
||||||
{
|
{
|
||||||
runtime·write(runtime·fd, "(", 1);
|
runtime·write(2, "(", 1);
|
||||||
runtime·printfloat(v.real);
|
runtime·printfloat(v.real);
|
||||||
runtime·printfloat(v.imag);
|
runtime·printfloat(v.imag);
|
||||||
runtime·write(runtime·fd, "i)", 2);
|
runtime·write(2, "i)", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -286,14 +286,14 @@ runtime·printuint(uint64 v)
|
|||||||
break;
|
break;
|
||||||
v = v/10;
|
v = v/10;
|
||||||
}
|
}
|
||||||
runtime·write(runtime·fd, buf+i, nelem(buf)-i);
|
runtime·write(2, buf+i, nelem(buf)-i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime·printint(int64 v)
|
runtime·printint(int64 v)
|
||||||
{
|
{
|
||||||
if(v < 0) {
|
if(v < 0) {
|
||||||
runtime·write(runtime·fd, "-", 1);
|
runtime·write(2, "-", 1);
|
||||||
v = -v;
|
v = -v;
|
||||||
}
|
}
|
||||||
runtime·printuint(v);
|
runtime·printuint(v);
|
||||||
@ -313,7 +313,7 @@ runtime·printhex(uint64 v)
|
|||||||
buf[--i] = '0';
|
buf[--i] = '0';
|
||||||
buf[--i] = 'x';
|
buf[--i] = 'x';
|
||||||
buf[--i] = '0';
|
buf[--i] = '0';
|
||||||
runtime·write(runtime·fd, buf+i, nelem(buf)-i);
|
runtime·write(2, buf+i, nelem(buf)-i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -328,23 +328,23 @@ runtime·printstring(String v)
|
|||||||
extern int32 runtime·maxstring;
|
extern int32 runtime·maxstring;
|
||||||
|
|
||||||
if(v.len > runtime·maxstring) {
|
if(v.len > runtime·maxstring) {
|
||||||
runtime·write(runtime·fd, "[invalid string]", 16);
|
runtime·write(2, "[invalid string]", 16);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(v.len > 0)
|
if(v.len > 0)
|
||||||
runtime·write(runtime·fd, v.str, v.len);
|
runtime·write(2, v.str, v.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime·printsp(void)
|
runtime·printsp(void)
|
||||||
{
|
{
|
||||||
runtime·write(runtime·fd, " ", 1);
|
runtime·write(2, " ", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
runtime·printnl(void)
|
runtime·printnl(void)
|
||||||
{
|
{
|
||||||
runtime·write(runtime·fd, "\n", 1);
|
runtime·write(2, "\n", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1028,7 +1028,6 @@ runtime·panic(Eface e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ran out of deferred calls - old-school panic now
|
// ran out of deferred calls - old-school panic now
|
||||||
runtime·fd = 2;
|
|
||||||
printpanics(g->panic);
|
printpanics(g->panic);
|
||||||
runtime·dopanic(0);
|
runtime·dopanic(0);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int32 runtime·panicking = 0;
|
int32 runtime·panicking = 0;
|
||||||
int32 runtime·fd = 1;
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
runtime·gotraceback(void)
|
runtime·gotraceback(void)
|
||||||
@ -25,7 +24,6 @@ runtime·gotraceback(void)
|
|||||||
void
|
void
|
||||||
runtime·dopanic(int32 unused)
|
runtime·dopanic(int32 unused)
|
||||||
{
|
{
|
||||||
runtime·fd = 2;
|
|
||||||
if(runtime·panicking) {
|
if(runtime·panicking) {
|
||||||
runtime·printf("double panic\n");
|
runtime·printf("double panic\n");
|
||||||
runtime·exit(3);
|
runtime·exit(3);
|
||||||
@ -70,7 +68,6 @@ runtime·throwinit(void)
|
|||||||
void
|
void
|
||||||
runtime·throw(int8 *s)
|
runtime·throw(int8 *s)
|
||||||
{
|
{
|
||||||
runtime·fd = 2;
|
|
||||||
runtime·printf("throw: %s\n", s);
|
runtime·printf("throw: %s\n", s);
|
||||||
runtime·dopanic(0);
|
runtime·dopanic(0);
|
||||||
*(int32*)0 = 0; // not reached
|
*(int32*)0 = 0; // not reached
|
||||||
|
@ -361,7 +361,6 @@ M* runtime·allm;
|
|||||||
int32 runtime·goidgen;
|
int32 runtime·goidgen;
|
||||||
extern int32 runtime·gomaxprocs;
|
extern int32 runtime·gomaxprocs;
|
||||||
extern int32 runtime·panicking;
|
extern int32 runtime·panicking;
|
||||||
extern int32 runtime·fd; // usually 1; set to 2 when panicking
|
|
||||||
extern int32 runtime·gcwaiting; // gc is waiting to run
|
extern int32 runtime·gcwaiting; // gc is waiting to run
|
||||||
int8* runtime·goos;
|
int8* runtime·goos;
|
||||||
extern bool runtime·iscgo;
|
extern bool runtime·iscgo;
|
||||||
|
Loading…
Reference in New Issue
Block a user