From cfa9f252201a4c30d101b098bd0f3e1d315f5d35 Mon Sep 17 00:00:00 2001 From: "Kaveh R. 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. * diagnostic.c (v_message_with_decl): Use .* format specifier instead of building the format specifier width manually. From-SVN: r31101 --- gcc/ChangeLog | 3 +++ gcc/diagnostic.c | 9 +-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35ee30d603d..676a52558fe 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 85729132896..1365e714d19 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.30.2