From 04c38fe9e384e26d03d59e90d1e8820232c97f8e Mon Sep 17 00:00:00 2001 From: ghazi Date: Mon, 27 Dec 1999 16:52:03 +0000 Subject: [PATCH] * diagnostic.c (v_message_with_decl): Use .* format specifier instead of building the format specifier width manually. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31101 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 3 +++ gcc/diagnostic.c | 9 +-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35ee30d..676a525 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,8 @@ 1999-12-27 Kaveh R. Ghazi + * diagnostic.c (v_message_with_decl): Use .* format specifier + instead of building the format specifier width manually. + * system.h (strsignal): Don't check HAVE_STRSIGNAL when determining whether to provide a prototype. Remove the sys_siglist clause in the conditional. diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 8572913..1365e71 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -198,14 +198,7 @@ v_message_with_decl (decl, warn, msgid, ap) } if (p > _(msgid)) /* Print the left-hand substring. */ - { - char fmt[sizeof "%.255s"]; - long width = p - _(msgid); - - if (width > 255L) width = 255L; /* arbitrary */ - sprintf (fmt, "%%.%lds", width); - fprintf (stderr, fmt, _(msgid)); - } + fprintf (stderr, "%.*s", (int)(p - _(msgid)), _(msgid)); if (*p == '%') /* Print the name. */ { -- 2.7.4