Commit ec2c7255 by Ian Lance Taylor

runtime: make print() built-in write to stderr.

Fixes issue 2294.

From-SVN: r182167
parent 7de61209
...@@ -18,43 +18,43 @@ ...@@ -18,43 +18,43 @@
void void
__go_print_space () __go_print_space ()
{ {
putchar (' '); putc (' ', stderr);
} }
void void
__go_print_nl () __go_print_nl ()
{ {
putchar ('\n'); putc ('\n', stderr);
} }
void void
__go_print_string (struct __go_string val) __go_print_string (struct __go_string val)
{ {
printf ("%.*s", (int) val.__length, (const char *) val.__data); fprintf (stderr, "%.*s", (int) val.__length, (const char *) val.__data);
} }
void void
__go_print_uint64 (uint64_t val) __go_print_uint64 (uint64_t val)
{ {
printf ("%llu", (unsigned long long) val); fprintf (stderr, "%llu", (unsigned long long) val);
} }
void void
__go_print_int64 (int64_t val) __go_print_int64 (int64_t val)
{ {
printf ("%lld", (long long) val); fprintf (stderr, "%lld", (long long) val);
} }
void void
__go_print_double (double val) __go_print_double (double val)
{ {
printf ("%.24g", val); fprintf (stderr, "%.24g", val);
} }
void void
__go_print_complex (__complex double val) __go_print_complex (__complex double val)
{ {
printf ("(%.24g%s%.24gi)", fprintf (stderr, "(%.24g%s%.24gi)",
__builtin_creal (val), __builtin_creal (val),
(__builtin_cimag (val) >= 0 || __builtin_isnan (__builtin_cimag(val)) (__builtin_cimag (val) >= 0 || __builtin_isnan (__builtin_cimag(val))
? "+" ? "+"
...@@ -65,29 +65,29 @@ __go_print_complex (__complex double val) ...@@ -65,29 +65,29 @@ __go_print_complex (__complex double val)
void void
__go_print_bool (_Bool val) __go_print_bool (_Bool val)
{ {
fputs (val ? "true" : "false", stdout); fputs (val ? "true" : "false", stderr);
} }
void void
__go_print_pointer (void *val) __go_print_pointer (void *val)
{ {
printf ("%p", val); fprintf (stderr, "%p", val);
} }
void void
__go_print_empty_interface (struct __go_empty_interface e) __go_print_empty_interface (struct __go_empty_interface e)
{ {
printf ("(%p,%p)", e.__type_descriptor, e.__object); fprintf (stderr, "(%p,%p)", e.__type_descriptor, e.__object);
} }
void void
__go_print_interface (struct __go_interface i) __go_print_interface (struct __go_interface i)
{ {
printf ("(%p,%p)", i.__methods, i.__object); fprintf (stderr, "(%p,%p)", i.__methods, i.__object);
} }
void void
__go_print_slice (struct __go_open_array val) __go_print_slice (struct __go_open_array val)
{ {
printf ("[%d/%d]%p", val.__count, val.__capacity, val.__values); fprintf (stderr, "[%d/%d]%p", val.__count, val.__capacity, val.__values);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment