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]

Make many more options use CPP()


This converts almost all remaining CPP options to use CPP() in the
*.opt files. Following your comment here
(https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02499.html) several
options now use explicit Init().

The only test I needed to tweak was gcc.dg/cpp/endif-pedantic2.c,
which tests that "-Wno-endif-labels -pedantic-errors" gives errors for
-Wendif-labels warnings. This might be the original intention
(https://gcc.gnu.org/ml/gcc-patches/2002-03/msg01732.html) but it is
at odds with how other -Wno-* flags work.

The current behavior enforced by the automatic machinery is that more
specific options have priority over more general options,
independently of the order. Although this is not documented in the
manual, it has been the consensus of several recent discussions (and
not so recent ones https://gcc.gnu.org/ml/gcc/2007-05/msg00720.html).
It would be a burden to special-case -Wno-endif-labels just for
keeping backwards compatibility. The affected users are likely very
few (if any): those that expect "-Wno-endif-labels -pedantic" to give
-Wendif-labels warnings. The effect on those users would be that they
won't get the warnings they expect until they remove -Wno-endif-labels
or append an explicit -Wendif-labels.

The two remaining options are a bit problematic:

1)  -Wall enables warn_sign_change, which does not have a -W* flag. I
could simply add one but perhaps it would be better under an already
existing flag.
2) -Wnormalized requires a bit more of special handling. I will try to
use the Enum() facility in the *.opt file if possible.


Bootstrapped and regression tested on x86_64-linux-gnu.

OK?

gcc/ChangeLog:

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

    * doc/options.texi: Document that Var and Init are required if CPP
    is given.
    * optc-gen.awk: Require Var and Init if CPP is given.
    * common.opt (Wpedantic): Use Init.

libcpp/ChangeLog:

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

    * macro.c (replace_args): Use cpp_pedwarning, cpp_warning and
    CPP_W flags.
    * include/cpplib.h: Add CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.
    * init.c (cpp_create_reader): Do not init to -1 here.
    * expr.c (num_binary_op): Use cpp_pedwarning.


gcc/c-family/ChangeLog:

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

    * c.opt (Wc90-c99-compat,Wc++-compat,Wcomment,Wendif-labels,
    Winvalid-pch,Wlong-long,Wmissing-include-dirs,Wmultichar,Wpedantic,
    (Wdate-time,Wtraditional,Wundef,Wvariadic-macros): Add CPP, Var
    and Init.
    * c-opts.c (c_common_handle_option): Do not handle here.
    (sanitize_cpp_opts): Likewise.
    * c-common.c (struct reason_option_codes_t): Handle
    CPP_W_C90_C99_COMPAT and CPP_W_PEDANTIC.


gcc/testsuite/ChangeLog:

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

    * gcc.dg/cpp/endif-pedantic2.c: More general options do not
    override specific ones, but specific ones do.

Attachment: cpp_more_options.diff
Description: Text document


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