--- Begin Message ---
Subject: |
27.0.50; GCC 7 warning due to -Wformat-truncation=2 |
Date: |
Tue, 17 Jul 2018 15:26:34 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
I'm getting the following warning when building the master branch on
Cygwin with GCC 7.3:
In file included from /usr/include/stdio.h:800:0,
from ../lib/stdio.h:43,
from ../../master/src/w32cygwinx.c:22:
../../master/src/w32cygwinx.c: In function ‘Fw32_battery_status’:
../../master/src/w32cygwinx.c:116:26: warning: ‘%3.1f’ directive output
may be truncated writing between 3 and 312 bytes into a region of size
16 [-Wformat-truncation=]
snprintf (buffer, 16, "%3.1f", h);
^
../../master/src/w32cygwinx.c:116:4: note: ‘__builtin_snprintf’ output
between 4 and 313 bytes into a destination of size 16
snprintf (buffer, 16, "%3.1f", h);
^
The attached patch avoids the warning. Is this a reasonable fix, or is
there a better way?
In GNU Emacs 27.0.50 (build 6, x86_64-unknown-cygwin, GTK+ Version 3.22.28)
of 2018-07-17 built on moufang
Repository revision: 04599bb1b219b236356ba3393a23e1c1dd8c541b
Windowing system distributor 'The Cygwin/X Project', version 11.0.12000000
0001-Pacify-GCC-7-with-Wformat-truncation-2.patch
Description: Text document
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2 |
Date: |
Fri, 20 Jul 2018 15:34:51 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 7/20/2018 10:37 AM, Paul Eggert wrote:
Ken Brown wrote:
Amended patch attached.
Thanks for checking it. I installed it in master.
Thanks. I'm closing the bug. One last question: It seems that the new
function 'format_string' could be useful in other places also. (I may
have a candidate very soon.) Would it make sense to move its definition
to eval.c, where vformat_string is defined, and declare it as external
in lisp.h?
Ken
--- End Message ---