[PATCH] Warn for dangerous use of omitted middle operand in ?:
Manuel López-Ibáñez
lopezibanez@gmail.com
Thu Jun 24 13:53:00 GMT 2010
On 24 June 2010 14:26, Andi Kleen <andi@firstfloor.org> wrote:
> On Thu, Jun 24, 2010 at 01:50:59PM +0200, Manuel López-Ibáñez wrote:
>> On 24 June 2010 13:24, Andi Kleen <andi@firstfloor.org> wrote:
>> > On Thu, Jun 03, 2010 at 11:18:18AM +0200, Andi Kleen wrote:
>> >>
>> >> Ping, can someone commit this please?
>> >
>> > *ping^2*
>>
>> If the patch is approved, please rediff against a recent revision,
>> send it with the changelog (or provide me with a link to the
>> changelog) and I will commit it for you.
>
> Here's a rediffed patch.
> -Andi
>
> gcc/
> 2010-05-31 Andi Kleen <ak@linux.intel.com>
> * c-parser.c (c_parser_conditional_expression):
> Call warn_for_omitted_condop.
> * c-common.c (warn_for_omitted_condop): Add.
> * c-common.h (warn_for_omitted_condop): Add prototype.
c-family has its own Changelog.
> * cp/parser.cx: (cp_parser_question_colon_clause):
extra x
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/warn/warn-omitted-condop.C
> @@ -0,0 +1,58 @@
> +/* { dg-options "-Wparentheses" } */
This testcase has two times the same content (patch over existing file?)
> +++ b/gcc/testsuite/gcc.dg/warn-omitted-condop.c
> @@ -0,0 +1,58 @@
> +/* { dg-options "-Wparentheses" } */
> +
... and the C and C++ testcases are the same. So moving them to c-c++-common.
Committed revision 161318 with the above changes and the following
commit message:
2010-06-24 Andi Kleen <ak@linux.intel.com>
* c-parser.c (c_parser_conditional_expression):
Call warn_for_omitted_condop.
* doc/invoke.texi: Document omitted condop warning.
c-family/
* c-common.c (warn_for_omitted_condop): New.
* c-common.h (warn_for_omitted_condop): Add prototype.
testsuite/
* c-c++-common/warn-omitted-condop.c: New.
cp/
* parser.c: (cp_parser_question_colon_clause):
Switch to use cp_lexer_peek_token.
Call warn_for_omitted_condop. Call pedwarn for omitted
middle operand.
More information about the Gcc-patches
mailing list