[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2015-04-20 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
   Target Milestone|--- |6.0

--- Comment #4 from Marek Polacek  ---
I have an untested patch.


[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2015-04-22 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

Marek Polacek  changed:

   What|Removed |Added

 Depends on||61534

--- Comment #5 from Marek Polacek  ---
Patch here
https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01137.html
But it's blocked until we resolve PR61534.


[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2015-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

--- Comment #6 from Marek Polacek  ---
Author: mpolacek
Date: Fri Apr 24 12:10:52 2015
New Revision: 222408

URL: https://gcc.gnu.org/viewcvs?rev=222408&root=gcc&view=rev
Log:
PR c/63357
* c-common.c (warn_logical_operator): Warn if the operands have the
same expressions.

* doc/invoke.texi: Update description of -Wlogical-op.

* c-c++-common/Wlogical-op-1.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/Wlogical-op-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c-common.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/ChangeLog


[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2015-04-24 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Marek Polacek  ---
Fixed.


[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2014-12-10 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

Tobias Burnus  changed:

   What|Removed |Added

Summary|Warn for P && P and P || P  |Warn for P && P and P || P
   ||(same expression used
   ||multiple times in a
   ||condition)

--- Comment #3 from Tobias Burnus  ---
Augmented summary to make it better searchable. See also related PR64249.


[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2023-02-24 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

David Binderman  changed:

   What|Removed |Added

 CC||dcb314 at hotmail dot com

--- Comment #8 from David Binderman  ---
This could probably be extended to other operators.

Static analyser cppcheck can be made to say things like:

linux-6.2/drivers/spi/spi-sn-f-ospi.c:614:31: style: Same expression
'SPI_TX_OCTAL' found multiple times in chain of '|' operators.
[duplicateExpression]

Source code is

ctlr->mode_bits = SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL
| SPI_RX_DUAL | SPI_RX_QUAD | SPI_TX_OCTAL
| SPI_MODE_0 | SPI_MODE_1 | SPI_LSB_FIRST;

If |, then probably also &.

[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2023-02-24 Thread manu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

--- Comment #9 from Manuel López-Ibáñez  ---
(In reply to David Binderman from comment #8)
> This could probably be extended to other operators.

Please open a new PR mentioning this one.

[Bug c/63357] Warn for P && P and P || P (same expression used multiple times in a condition)

2023-02-24 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63357

--- Comment #10 from David Binderman  ---
(In reply to Manuel López-Ibáñez from comment #9)
> Please open a new PR mentioning this one.

Done. See 108926.