all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: p.stephani2@gmail.com, 32189@debbugs.gnu.org
Subject: bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2
Date: Fri, 20 Jul 2018 09:56:25 +0300	[thread overview]
Message-ID: <83y3e61jl2.fsf@gnu.org> (raw)
In-Reply-To: <6642c8ac-55ff-ca2b-0141-a26b69d082ad@cs.ucla.edu> (message from Paul Eggert on Thu, 19 Jul 2018 16:19:38 -0700)

> Cc: p.stephani2@gmail.com, 32189@debbugs.gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 19 Jul 2018 16:19:38 -0700
> 
> Let's continue using -Wformat-truncation=2 since I recall it finding real bugs 
> in Emacs in the past, and there's a better fix for this particular problem.
> 
> Some background. Generally I don't worry too much about warnings from older 
> compilers, since one can just compile with --disable-gcc-warnings if the 
> compiler is too old.

Well, GCC 7 is not exactly "old".  GCC 8 was released just a couple of
months ago, and GCC 7.3 is from January this year.  If you are saying
that this switch does a better job in later versions of GCC, maybe we
should disable it for GCC 7 alone?

> 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?  If so, I think we are good
with this change.

And I was wrong: it should go to the master branch, not to emacs-26.





  reply	other threads:[~2018-07-20  6:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17 19:26 bug#32189: 27.0.50; GCC 7 warning due to -Wformat-truncation=2 Ken Brown
2018-07-18 15:09 ` Eli Zaretskii
2018-07-18 19:42   ` Ken Brown
2018-07-19  2:38     ` Eli Zaretskii
2018-07-19  6:10     ` Philipp Stephani
2018-07-19 12:49       ` Ken Brown
2018-07-19 13:25       ` Eli Zaretskii
2018-07-19  6:21   ` Philipp Stephani
2018-07-19 13:29     ` Eli Zaretskii
2018-07-19 13:56       ` Ken Brown
2018-07-19 14:17         ` Eli Zaretskii
2018-07-19 23:19           ` Paul Eggert
2018-07-20  6:56             ` Eli Zaretskii [this message]
2018-07-20 13:49               ` Ken Brown
2018-07-20 14:17                 ` Eli Zaretskii
2018-07-20 14:27                   ` Ken Brown
2018-07-20 14:37                     ` Paul Eggert
2018-07-20 14:51                       ` Eli Zaretskii
2018-07-20 19:34                       ` Ken Brown
2018-07-20 21:03                         ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83y3e61jl2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=32189@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=p.stephani2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.