qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment


From: Marc-André Lureau
Subject: [Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment
Date: Fri, 15 Dec 2017 19:18:10 +0100

Instead of an error, lower to a warning message, assuming the comment
gives some justification.

Discussed in:
'[Qemu-devel] [PATCH] dump-guest-memory.py: fix "You can't do that without a 
process to debug"'

Suggested-by: Fam Zheng <address@hidden>
Signed-off-by: Marc-André Lureau <address@hidden>
---
 scripts/checkpatch.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 34df753571..f5a523af10 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2476,7 +2476,12 @@ sub process {
 # no volatiles please
                my $asm_volatile = 
qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
-                       ERROR("Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt\n" . $herecurr);
+                       my $msg = "Use of volatile is usually wrong: see 
Documentation/volatile-considered-harmful.txt\n" . $herecurr;
+                       if (ctx_has_comment($first_line, $linenr)) {
+                               WARN($msg);
+                       } else {
+                               ERROR($msg);
+                       }
                }
 
 # warn about #if 0
-- 
2.15.1.355.g36791d7216




reply via email to

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