From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXtTe-000627-6t for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:32:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXtTa-0004T3-59 for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:32:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXtTZ-0004St-Su for qemu-devel@nongnu.org; Tue, 17 Mar 2015 11:32:14 -0400 From: Stefan Hajnoczi Date: Tue, 17 Mar 2015 15:09:47 +0000 Message-Id: <1426604987-11363-10-git-send-email-stefanha@redhat.com> In-Reply-To: <1426604987-11363-1-git-send-email-stefanha@redhat.com> References: <1426604987-11363-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 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: Peter Maydell , Markus Armbruster , Stefan Hajnoczi 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