From patchwork Tue Aug 19 14:12:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 381364 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B6F7A1400B2 for ; Wed, 20 Aug 2014 00:14:17 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=xta8vC24Tpvl37r870xFxfG9WFNm6dU07tYrHYxOLAdYC7Kmjs cWL/steEstQ97qP5JMnPJ9Eo5qlFKM0pOVHRwa4udx94pIQcmFjcrqVg40/CHmLR D6+iObdeZI9+bPy5GCA4S0bSWNehekn1dIet2N7oiZ2RhtSSKYmyDPQok= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=3N4Myb+TvgoJHu85Zz0vsF6aHng=; b=GbZqMPOz8bXt50VxnI0c EjM623COtpCT/p4Hbw0nqzV10P2YrALq5A6QWAXyskTXqigEwsKeNJx/UCPI6tHA 9cnMWhHgRVDfWLUKwESbgoeQBcitMPsarQHIFhdJi8hVq48yj86CtQ5UgjzUVuxs t00ZES7FosSnZM9YzpB6M8c= Received: (qmail 4240 invoked by alias); 19 Aug 2014 14:13:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 4202 invoked by uid 89); 19 Aug 2014 14:12:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS 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, 19 Aug 2014 14:12:58 +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 (8.14.4/8.14.4) with ESMTP id s7JECvQT024524 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 19 Aug 2014 10:12:57 -0400 Received: from redhat.com (ovpn-116-27.ams2.redhat.com [10.36.116.27]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7JECsR9029402 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 19 Aug 2014 10:12:56 -0400 Date: Tue, 19 Aug 2014 16:12:53 +0200 From: Marek Polacek To: GCC Patches Cc: Richard Henderson Subject: [PATCH] Quash Wbool-compare warning in optabs.c Message-ID: <20140819141253.GC14320@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) On some archs, C[TL]Z_DEFINED_VALUE_AT_ZERO macros return only true/false, so -Wbool-compare would warn. But on e.g. mips or aarch64 they might yield 2. This patch casts the value to int to quash that warning. Dropping the "== 2" would be prettier, but I don't want to break other archs. The point is that -Wbool-compare should be enabled by -Wall, and this is the last thing that prevents it. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2014-08-19 Marek Polacek * optabs.c (expand_ffs): Cast C[TL]Z_DEFINED_VALUE_AT_ZERO macros to int. Marek diff --git gcc/optabs.c gcc/optabs.c index 60228d3..26b5603 100644 --- gcc/optabs.c +++ gcc/optabs.c @@ -2827,7 +2827,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target) if (!temp) goto fail; - defined_at_zero = (CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2); + defined_at_zero = ((int) CTZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2); } else if (optab_handler (clz_optab, mode) != CODE_FOR_nothing) { @@ -2836,7 +2836,7 @@ expand_ffs (enum machine_mode mode, rtx op0, rtx target) if (!temp) goto fail; - if (CLZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2) + if ((int) CLZ_DEFINED_VALUE_AT_ZERO (mode, val) == 2) { defined_at_zero = true; val = (GET_MODE_PRECISION (mode) - 1) - val;