This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Tidy up pedwarn_c90 (take 2)
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Aug 2014 19:16:55 +0200
- Subject: Re: [C PATCH] Tidy up pedwarn_c90 (take 2)
- Authentication-results: sourceware.org; auth=none
- References: <20140809183927 dot GX24292 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1408112013130 dot 16061 at digraph dot polyomino dot org dot uk> <20140811203400 dot GE2436 at redhat dot com> <20140812094804 dot GJ2436 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1408182206460 dot 8539 at digraph dot polyomino dot org dot uk>
On 19 August 2014 00:06, Joseph S. Myers <joseph@codesourcery.com> wrote:
> On Tue, 12 Aug 2014, Marek Polacek wrote:
>
>> This then is the version with both issues fixed (and new test).
>>
>> Bootstrapped/regtested on x86_64-linux, ok for trunk?
>>
>> 2014-08-12 Marek Polacek <polacek@redhat.com>
>>
>> gcc/c-family/
>> * c-opts.c (sanitize_cpp_opts): Make warn_long_long be set according
>> to warn_c90_c99_compat.
>> * c.opt (Wc90-c99-compat, Wdeclaration-after-statement): Initialize
>> to -1.
To be honest, I consider this a small step back towards encoding all
the options dependencies in the *.opt files.
If I understand correctly, the reason for initializing
Wdeclaration-after-statement to -1 is to detect whether the option has
been enabled/disabled explicitly and, if not, then only emit the
warning if Wpedantic or Wc90-c99-compat has been given, This is
precisely what LangEnabledBy was designed for. The problem in this
case is that we only want to enable Wdeclaration-after-statement when
given Wpedantic if !flag_isoc99 and currently there is not way to
encode this with LangEnabledBy.
Perhaps we need a LangEnabledByIf(C ObjC,Wpedantic,!flag_isoc99). I
see two difficulties for implementing this:
* We would need to handle warning options after -std=.
* We would need to have access to flag_isoc99 in the generated file
options.c. I think this flag is not encoded in global_opts, thus we
could pass it as an argument to C_handle_option_auto.
Is this the direction we want to move towards? Perhaps it is not worth
the trouble just for the handful of options that would require such
LangEnabledByIf().
Cheers,
Manuel.