Bootstrapped and regression tested on x86_64-linux-gnu. Since Wformat
didn't have Var() associated, its corresponding entry was set to -1,
which is what warning(OPT_Wformat) checks for. Therefore, any such
warnings which were not guarded by if(warn_format), were enabled by
default. I only found one case in the objective-C FE.

The old code accepts -Wformat=X with X any number but -Wno-format=2
does not have any effect. The documentation only mentions -Wformat,
-Wno-format, -Wformat=2 and -Wno-format=2. I followed the
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=.

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

        PR c/53063
c-family/
        * c.opt (Wformat, Wformat-extra-args, Wformat-nonliteral,
        Wformat-contains-nul, Wformat-security, Wformat-y2k,
        Wformat-zero-length, Wformat=2, Wnonnull): Use LangEnabledBy.
        * c-opts.c (c_common_handle_option): Do not handle explicitly
        here.
        * c-common.c (warn_format): Delete.
        * c-format.c (set_Wformat): Delete.
        * c-common.h (warn_format,set_Wformat): Do not declare.
testsuite/
        * gcc.dg/warn-nsstring.c: Add -Wformat.
        * gcc.misc-tests/help.exp (check_for_options): Use
        -Wstrict-aliasing for test.

Attachment: wformat.diff
Description: Binary data

Reply via email to