diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-06-26 05:37:16 -0400 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-06-26 05:37:16 -0400 |
commit | cb039f8aa0fa4838ce8842b02eb2416d505c027e (patch) | |
tree | 706f70ca41503126b64f76acbcd07d8488cddfcb | |
parent | 13018fad5e728dc1464708dc4c49be03b5545793 (diff) | |
download | gcc-cb039f8aa0fa4838ce8842b02eb2416d505c027e.zip gcc-cb039f8aa0fa4838ce8842b02eb2416d505c027e.tar.gz gcc-cb039f8aa0fa4838ce8842b02eb2416d505c027e.tar.bz2 |
(v_message_with_decl): Avoid fwrite for stderr; mixing it with fprintf
and fputs can cause strange results under VMS.
From-SVN: r7570
-rw-r--r-- | gcc/toplev.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c index f73a60a..f3aeb09 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1149,10 +1149,17 @@ v_message_with_decl (decl, prefix, s, ap) } } - if (p > s) - fwrite (s, p - s, 1, stderr); + if (p > s) /* Print the left-hand substring. */ + { + char fmt[sizeof "%.255s"]; + long width = p - s; + + if (width > 255L) width = 255L; /* arbitrary */ + sprintf (fmt, "%%.%lds", width); + fprintf (stderr, fmt, s); + } - if (*p == '%') + if (*p == '%') /* Print the name. */ { char *n = (DECL_NAME (decl) ? (*decl_printable_name) (decl, &junk) @@ -1166,7 +1173,7 @@ v_message_with_decl (decl, prefix, s, ap) } } - if (*p) + if (*p) /* Print the rest of the message. */ vmessage ((char *)NULL, p, ap); fputc ('\n', stderr); |