This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/67479] Support for -Wformat-pedantic
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Sep 2015 17:21:48 +0000
- Subject: [Bug c/67479] Support for -Wformat-pedantic
- Auto-submitted: auto-generated
- References: <bug-67479-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67479
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Mon, 7 Sep 2015, manu at gcc dot gnu.org wrote:
>
> Index: c-format.c
> ===================================================================
> --- c-format.c (revision 227095)
> +++ c-format.c (working copy)
> @@ -1244,11 +1244,12 @@
> return 0;
> }
> *format = fcp + 1;
> - if (pedantic && !dollar_format_warned)
> + if (warn_format_pedantic && !dollar_format_warned)
> {
> - warning (OPT_Wformat_, "%s does not support %%n$ operand number
> formats",
> - C_STD_NAME (STD_EXT));
> - dollar_format_warned = 1;
> + dollar_format_warned =
> + pedwarn (input_location, OPT_Wformat_pedantic,
> + "%s does not support %%n$ operand number formats",
> + C_STD_NAME (STD_EXT));
This should not be a pedwarn, because it only has undefined behavior in
ISO C at runtime, not compile time.