[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2017-07-20 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

egallager at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||egallager at gcc dot gnu.org
 Resolution|--- |DUPLICATE

--- Comment #7 from egallager at gcc dot gnu.org ---
(In reply to Eric Gallager from comment #6)
> I think this is a duplicate of bug 53598

Closing as a duplicate of it

*** This bug has been marked as a duplicate of bug 53598 ***

[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2016-12-07 Thread egall at gwmail dot gwu.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

Eric Gallager  changed:

   What|Removed |Added

 CC||egall at gwmail dot gwu.edu

--- Comment #6 from Eric Gallager  ---
I think this is a duplicate of bug 53598

[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

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

--- Comment #5 from Marek Polacek  ---
(In reply to Arnaud Bienner from comment #3)
> One thing that doesn't work is turning on this warning using
> -Wunused-comparison parameter. But surprisingly, turning it off with
> -Wno-unused-comparison (when -Wunused or -Wall is used) works. Not sure what
> I'm missing here.

Because the emit_side_effect_warnings calls are guarded by warn_unused_value.


[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2015-04-15 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

--- Comment #4 from Manuel López-Ibáñez  ---
(In reply to Arnaud Bienner from comment #3)
> Created attachment 35324 [details]
> unused-comparison warning

You need testcases, and to run the testsuite. See point 4 at:
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps

> One thing that doesn't work is turning on this warning using
> -Wunused-comparison parameter. But surprisingly, turning it off with
> -Wno-unused-comparison (when -Wunused or -Wall is used) works. Not sure what
> I'm missing here.

That is very weird. I don't see anything wrong in your patch about this.

Nonetheless, please add the warning to c-family/c.opt not to common.opt since
it is a C/C++ warning.

Also watch out for the formatting (too long lines, incorrect indentation, etc.)
See point 6 in the link above.

> The patch would just be a first step: the next step would be to also raise
> this warning in the case of a "==" operator overloading in C++ (which seems
> to be the case that doesn't raise a warning currently). Not sure yet how to
> do this.

It is more than ok to do one patch per step. Try to get the first patch right
and committed, then worry about the next.

[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2015-04-15 Thread arnaud.bienner at ensimag dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

--- Comment #3 from Arnaud Bienner  ---
Created attachment 35324
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35324&action=edit
unused-comparison warning

I also believe it can be useful to have "unused comparison" warning (i.e.
something more specific than current "unused value" warning, because they are
likely to be typo.
Having a dedicated warning will allow people who want to activate this warning
specifically and/or to turn it into an error.

So I started to have a look at this and I would like to have some feedback from
someone more experienced.
It's my first patch to gcc, so it is probably not perfect.

One thing that doesn't work is turning on this warning using
-Wunused-comparison parameter. But surprisingly, turning it off with
-Wno-unused-comparison (when -Wunused or -Wall is used) works. Not sure what
I'm missing here.

The patch would just be a first step: the next step would be to also raise this
warning in the case of a "==" operator overloading in C++ (which seems to be
the case that doesn't raise a warning currently). Not sure yet how to do this.


[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2015-04-13 Thread arnaud.bienner at ensimag dot fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

Arnaud Bienner  changed:

   What|Removed |Added

 CC||arnaud.bienner at ensimag dot 
fr

--- Comment #2 from Arnaud Bienner  ---
Related bug: bug 53598.


[Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value

2015-02-28 Thread manu at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62182

Manuel López-Ibáñez  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-02-28
 CC||manu at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Manuel López-Ibáñez  ---
I'm going to confirm this because we obviously want it.