From patchwork Mon Mar 23 15:29:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 453515 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E0141400F1 for ; Tue, 24 Mar 2015 02:34:24 +1100 (AEDT) Received: from localhost ([::1]:56638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya4Mw-0000oy-8V for incoming@patchwork.ozlabs.org; Mon, 23 Mar 2015 11:34:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya4Id-0001gq-3E for qemu-devel@nongnu.org; Mon, 23 Mar 2015 11:29:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya4Ib-0008Bb-W4 for qemu-devel@nongnu.org; Mon, 23 Mar 2015 11:29:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34661) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya4Ib-0008B2-RI for qemu-devel@nongnu.org; Mon, 23 Mar 2015 11:29:53 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 82E6F8E7A4; Mon, 23 Mar 2015 15:29:53 +0000 (UTC) Received: from localhost (ovpn-112-47.ams2.redhat.com [10.36.112.47]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2NFTqa7004870; Mon, 23 Mar 2015 11:29:52 -0400 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Mon, 23 Mar 2015 15:29:31 +0000 Message-Id: <1427124571-28598-10-git-send-email-stefanha@redhat.com> In-Reply-To: <1427124571-28598-1-git-send-email-stefanha@redhat.com> References: <1427124571-28598-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Paolo Bonzini , Markus Armbruster , Stefan Hajnoczi , Peter Maydell Subject: [Qemu-devel] [PATCH v3 9/9] checkpatch: complain about ffs(3) calls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The ffs(3) family of functions is not portable. MinGW doesn't always provide the function. Use ctz32() or ctz64() instead. Signed-off-by: Stefan Hajnoczi --- scripts/checkpatch.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 5df61f9..7f0aae9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2911,6 +2911,17 @@ sub process { if ($rawline =~ /\b(?:Qemu|QEmu)\b/) { WARN("use QEMU instead of Qemu or QEmu\n" . $herecurr); } + +# check for non-portable ffs() calls that have portable alternatives in QEMU + if ($line =~ /\bffs\(/) { + ERROR("use ctz32() instead of ffs()\n" . $herecurr); + } + if ($line =~ /\bffsl\(/) { + ERROR("use ctz32() or ctz64() instead of ffsl()\n" . $herecurr); + } + if ($line =~ /\bffsll\(/) { + ERROR("use ctz64() instead of ffsll()\n" . $herecurr); + } } # If we have no input at all, then there is nothing to report on