From nobody Tue Oct 28 12:12:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151360234058322.502332090886966; Mon, 18 Dec 2017 05:05:40 -0800 (PST) Received: from localhost ([::1]:32844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQv6m-0005WW-2g for importer@patchew.org; Mon, 18 Dec 2017 08:05:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQv51-0004Tu-Bs for qemu-devel@nongnu.org; Mon, 18 Dec 2017 08:03:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQv4p-0000yR-UU for qemu-devel@nongnu.org; Mon, 18 Dec 2017 08:03:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32842) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eQv4p-0000y5-Nk for qemu-devel@nongnu.org; Mon, 18 Dec 2017 08:03:27 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC617C0AC90E for ; Mon, 18 Dec 2017 13:03:26 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.118.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7A4F7F794; Mon, 18 Dec 2017 13:03:10 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 14:03:09 +0100 Message-Id: <20171218130309.2682-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Dec 2017 13:03:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] checkpatch: volatile with a comment or sig_atomic_t is okay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: famz@redhat.com, lersek@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This assumes that the comment gives some justification; "volatile sig_atomic_t" is also self-explanatory and usually correct. Discussed in: '[Qemu-devel] [PATCH] dump-guest-memory.py: fix "You can't do that without = a process to debug"' Suggested-by: Fam Zheng Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 34df753571..3dc27d9656 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2475,8 +2475,11 @@ sub process { =20 # no volatiles please my $asm_volatile =3D qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b}; - if ($line =3D~ /\bvolatile\b/ && $line !~ /$asm_volatile/) { - ERROR("Use of volatile is usually wrong: see Documentation/volatile-con= sidered-harmful.txt\n" . $herecurr); + if ($line =3D~ /\bvolatile\b/ && $line !~ /$asm_volatile/ && + $line !~ /sig_atomic_t/ && + !ctx_has_comment($first_line, $linenr)) { + my $msg =3D "Use of volatile is usually wrong, please add a comment\n" = . $herecurr; + ERROR($msg); } =20 # warn about #if 0 --=20 2.14.3