This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C PATCH] Encode CPP options in c.opt


The following patch adds a new CPP() to *.opt files that tells the
options machinery to keep in sync libcpp options and GCC options.

This will allow us to fix a lot of latent bugs where CPP warnings do
not follow the rules of other warnings options. In this patch, I only
deal with Wvariadic-macros, but I will convert others in follow-up
patches. (Nonetheless, help is very much appreciated. There are a lot
of them.)

For Wvariadic-macros, the c.opt and the documentation says it is
enabled by default, but this was not true. It is only enabled if
-Wpedantic or -Wtraditional are given. Worse, even if you give
-Wvariadic-macros, the warnings were not enabled. Of course, neither
#pragmas nor other nice things worked. All this is simply fixed by
using the common machinery and just taking care of keeping libcpp and
gcc in sync.

Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

2014-08-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/60975
    PR c/53063
    * doc/options.texi (CPP): Document it.
    * doc/invoke.texi (Wvariadic-macros): Fix documentation.
    * optc-gen.awk: Handle CPP.
    * opth-gen.awk: Likewise.

gcc/c-family/ChangeLog:

2014-08-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/60975
    PR c/53063
    * c.opt (Wvariadic-macros): Use CPP and LangEnabledBy.
    * c-opts.c (c_common_handle_option): Call cpp_handle_option_auto.
    (c_common_post_options): Call init_global_opts_from_cpp.
    (sanitize_cpp_opts): Do not handle Wvariadic-macros here.

gcc/testsuite/ChangeLog:

2014-08-19  Manuel López-Ibáñez  <manu@gcc.gnu.org>

    PR c/60975
    PR c/53063
    * gcc.dg/cpp/Wvariadic-1p.c: New test.

Attachment: wvariadic-macros.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]