This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/72858] incorrect fixit hints in -Wformat diagnostics
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Sep 2016 16:07:37 +0000
- Subject: [Bug c/72858] incorrect fixit hints in -Wformat diagnostics
- Auto-submitted: auto-generated
- References: <bug-72858-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72858
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #2)
> Author: dmalcolm
> Date: Mon Sep 12 16:01:02 2016
> New Revision: 240095
The above commit fixes many of these issues; Martin identified some further
improvements here:
https://gcc.gnu.org/ml/gcc-patches/2016-08/msg01587.html
which I'll quote inline here:
On Mon, 2016-08-22 at 15:54 -0600, Martin Sebor wrote:
> A couple of things I noticed when getting the -Wformat-length code
> to use the new infrastructure from c-format.
>
> Hints that suggest alternate directives that don't accept all
> the same flags as those used in the original should filter out
> those flags. For example, when passing a pointer to a "%#lx"
> directive, the hint should suggest "%s" for character pointers
> and "%p" for others rather than "%#s" or "%#p". Similarly,
> when passing a string to a "%+i" or "% i" directive, the '+'
> and space flags should be removed.
>
> Also, with -Wformat-signedness (but I'd say without it as well),
> the hints should respect the signedness of the arguments. For
> example, the hint for "%u" with a long int argument should be
> "%lu" and not "%li".
>
> Martin
Keeping this bug open until these are addressed.