bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2


From: Ken Brown
Subject: bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2
Date: Fri, 20 Jul 2018 09:49:39 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 7/20/2018 2:56 AM, Eli Zaretskii wrote:
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 19 Jul 2018 16:19:38 -0700
Second, the code in question uses snprintf followed by build_string, and can be
simplified by using vformat_string instead. That would avoid the warnings and
should make the code more reliable. Something like the attached patch, say. I
haven't tested it since I don't use MS-Windows. Let's use something like this
rather than shutting off the warnings.

Works for me (although vformat_string does exactly what a call to
snprintf does, just with a larger buffer).  Ken, could you please
check if this works in the Cygwin build?

Yes, although I'm getting the following warning after this change:

../../master/src/w32cygwinx.c: In function ‘format_string’:
../../master/src/w32cygwinx.c:32:3: warning: function ‘format_string’ might be a candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
   Lisp_Object str = vformat_string (format, args);
   ^~~~~~~~~~~

Ken





reply via email to

[Prev in Thread] Current Thread [Next in Thread]