On 19 October 2012 18:17, Joseph S. Myers <jos...@codesourcery.com> wrote:
> On Wed, 17 Oct 2012, Manuel López-Ibáñez wrote:
>
>> documentation but I can also implement -Wformat=0 being an alias for
>> -Wno-format and -Wformat=1 an alias for -Wformat and simply reject
>> -Wno-format=.
>
> I think that's what's wanted; -Wno-format= should be rejected, -Wformat=
> should take an arbitrary integer level (of which at present all those
> above 2 are equivalent to 2, just as -O<n> for n > 3 is equivalent to
> -O3).

This patch implements exactly that. Bootstrapped and regression tested
on x86_64-linux-gnu. OK?

2012-10-27  Manuel López-Ibáñez  <m...@gcc.gnu.org>

        PR c/53063
gcc/
        * doc/invoke.texi (Wformat): Update.
c-family/
        * c.opt (Wformat): Make it Alias Wformat=1.
        (Wformat-contains-nul,Wformat-extra-args,Wformat-nonliteral,
        Wformat-security,Wformat-y2k,Wformat-zero-length): Use
        LangEnabledBy.
        (Wformat=): RejectNegative. Use LangEnabledBy.
        (Wnonnull): Use LangEnabledBy.
        * c-opts.c (c_common_handle_option): Do not handle Wformat here.
        * c-format.c (decode_format_attr): Replace OPT_Wformat with
        OPT_Wformat_.
        (maybe_read_dollar_number):  Likewise.
        (avoid_dollar_number):  Likewise.
        (finish_dollar_format_checking):  Likewise.
        (check_format_info):  Likewise.
        (check_format_info_main):  Likewise.
        (check_format_types):  Likewise.
        (format_type_warning):  Likewise.
        * c-common.c (int):  Likewise.
        (check_function_sentinel):  Likewise.
        * c-common.h (warn_format): Do not declare here.
testsuite/
        * gcc.dg/warn-nsstring.c: Use -Wformat explicitly.
gcc/
        * optc-gen.awk: Factor code out to...
        * opt-functions.awk (lang_enabled_by): ... this new function.

Attachment: wformat.diff
Description: Binary data

Reply via email to