From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58890 invoked by alias); 28 Apr 2015 17:15:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 58878 invoked by uid 89); 28 Apr 2015 17:15:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 28 Apr 2015 17:15:56 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id EF7168E3E4 for ; Tue, 28 Apr 2015 17:15:54 +0000 (UTC) Received: from localhost.localdomain (ovpn-113-143.phx2.redhat.com [10.3.113.143]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3SHFsx2003611; Tue, 28 Apr 2015 13:15:54 -0400 Message-ID: <553FC04A.3070304@redhat.com> Date: Tue, 28 Apr 2015 17:16:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Marek Polacek , GCC Patches Subject: Re: c-family PATCH to improve -Wbool-compare (PR c/64610) References: <20150428104932.GD11448@redhat.com> In-Reply-To: <20150428104932.GD11448@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01774.txt.bz2 On 04/28/2015 04:49 AM, Marek Polacek wrote: > This improves -Wbool-compare a bit: boolean >= 0 is always true, on the other > hand boolean < 0 is always false, and similar. > > One feature/bug is that in C++ we don't warn for e.g. bool >= false, since the > warning cares about CMP or CMP . I can fix > that in a follow-up if anyone wants me to. > > Bootstrapped (-> GCC itself is clean)/regtested on x86_64-linux, ok for trunk? > > 2015-04-28 Marek Polacek > > PR c/64610 > * c-common.c (maybe_warn_bool_compare): Warn when comparing a boolean > with 0/1. > > * c-c++-common/Wbool-compare-1.c (fn1): Remove a few lines. > * c-c++-common/Wbool-compare-2.c: New test. OK. jeff