From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn06u-00031z-UA for qemu-devel@nongnu.org; Thu, 22 Sep 2016 05:16:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bn06s-00012q-7B for qemu-devel@nongnu.org; Thu, 22 Sep 2016 05:16:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bn06s-00012f-0M for qemu-devel@nongnu.org; Thu, 22 Sep 2016 05:16:02 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 51CC0338865 for ; Thu, 22 Sep 2016 09:16:01 +0000 (UTC) References: <1474476607-4990-1-git-send-email-pbonzini@redhat.com> <871t0cpfuw.fsf@dusky.pond.sub.org> From: Paolo Bonzini Message-ID: <704d0717-af8b-4ad9-8b3d-326a5721e676@redhat.com> Date: Thu, 22 Sep 2016 11:15:57 +0200 MIME-Version: 1.0 In-Reply-To: <871t0cpfuw.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] checkpatch: downgrade "architecture specific defines should be avoided" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, famz@redhat.com On 22/09/2016 09:12, Markus Armbruster wrote: > Paolo Bonzini writes: >=20 >> --- >> scripts/checkpatch.pl | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl >> index dde3f5f..3afa19a 100755 >> --- a/scripts/checkpatch.pl >> +++ b/scripts/checkpatch.pl >> @@ -2407,7 +2407,7 @@ sub process { >> # we have e.g. CONFIG_LINUX and CONFIG_WIN32 for common cases >> # where they might be necessary. >> if ($line =3D~ m@^.\s*\#\s*if.*\b__@) { >> - ERROR("architecture specific defines should be avoided\n" . $here= curr); >> + WARN("architecture specific defines should be avoided\n" . $herec= urr); >> } >> =20 >> # Check that the storage class is at the beginning of a declaration >=20 > git-grep finds almost 400 of them. We certainly want people to think > twice (or thrice) before they add more. The question to discuss here i= s > whether we want to force that thinking onto the list. If yes, keep > ERROR. If no, downgrade to warn. I actually count 450, but: - about a 100 are in imported code (disas/libvixl, include/standard-headers and linux-headers, disas) - another 40-odd hits are __NR_* syscall numbers - about 80 are in user-exec.c, block/raw-posix.c, util/oslib-posix.c, util/qemu-openpty.c, util/qemu-thread-posix.c which is probably unavoidab= le - another 30 are in tcg So this already covers more than half the hits. The patch is a bit of a heavy hammer, but I don't think it's an endemic problem that warrants a complaint on the list. If we want to keep the error, I think we should have: - a symbol blacklist. For example __linux__ and _WIN32 can be trivially replaced by CONFIG_LINUX and CONFIG_WIN32, and __GNUC__ is probably a bad idea (but __clang__ not so much; clang defines __GNUC__ for an absurdly old version). - a file blacklist, for example I would not expect target-*/ and hw/ should not have __ symbols and in fact they hardly have any and warn for everything else. Something for bite-sized tasks? Paolo