qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 11/76] checkpatch: complain about ffs(3) calls


From: Kevin Wolf
Subject: [Qemu-devel] [PULL 11/76] checkpatch: complain about ffs(3) calls
Date: Tue, 28 Apr 2015 16:59:53 +0200

From: Stefan Hajnoczi <address@hidden>

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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Kevin Wolf <address@hidden>
---
 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
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]