From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22884 invoked by alias); 15 Apr 2015 22:40:26 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 22787 invoked by uid 48); 15 Apr 2015 22:40:23 -0000 From: "arnaud.bienner at ensimag dot fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/62182] New warning wished: operator== and "equality comparison result unused [-Wunused-comparison]"/-Wunsed-value Date: Wed, 15 Apr 2015 22:40:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: arnaud.bienner at ensimag dot fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg01260.txt.bz2 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.