[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
- [Qemu-devel] [PULL 00/76] Block patches, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 02/76] MAINTAINERS: Add myself as the maintainer of the Quorum driver, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 03/76] bt-sdp: fix broken uuids power-of-2 calculation, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 01/76] savevm: create snapshot failed when id_str already exists, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 04/76] hw/arm/nseries: convert ffs(3) to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 05/76] uninorth: convert ffs(3) to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 08/76] sd: convert sd_normal_command() ffs(3) call to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 06/76] Convert (ffs(val) - 1) to ctz32(val), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 07/76] Convert ffs() != 0 callers to ctz32(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 09/76] omap_intc: convert ffs(3) to ctz32() in omap_inth_sir_update(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 11/76] checkpatch: complain about ffs(3) calls,
Kevin Wolf <=
- [Qemu-devel] [PULL 12/76] block: Switch to host monotonic clock for IO throttling, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 10/76] os-win32: drop ffs(3) prototype, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 13/76] aio-posix: move pollfds to thread-local storage, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 14/76] AioContext: acquire/release AioContext during aio_poll, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 16/76] block-backend: Expose bdrv_write_zeroes(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 15/76] iothread: release iothread around aio_poll, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 18/76] qemu-iotests: Some qemu-img convert tests, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 17/76] qemu-img convert: Rewrite copying logic, Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 19/76] blkdebug: Add bdrv_truncate(), Kevin Wolf, 2015/04/28
- [Qemu-devel] [PULL 22/76] scripts: add 'qemu coroutine' command to qemu-gdb.py, Kevin Wolf, 2015/04/28