[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: |
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
- bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2,
Ken Brown <=