From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Stefan Hajnoczi 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> Subject: [Qemu-devel] [PATCH v3 9/9] checkpatch: complain about ffs(3) calls List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Markus Armbruster , Stefan Hajnoczi , Peter Maydell 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 -- 2.1.0