qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment
@ 2017-12-15 18:18 Marc-André Lureau
  2017-12-15 18:39 ` no-reply
  2017-12-18 12:49 ` Paolo Bonzini
  0 siblings, 2 replies; 7+ messages in thread
From: Marc-André Lureau @ 2017-12-15 18:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: famz, pbonzini, lersek, Marc-André Lureau

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 <famz@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-18 13:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-15 18:18 [Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment Marc-André Lureau
2017-12-15 18:39 ` no-reply
2017-12-18 12:49 ` Paolo Bonzini
2017-12-18 12:54   ` Marc-André Lureau
2017-12-18 13:02     ` Paolo Bonzini
2017-12-18 13:36   ` Darren Kenny
2017-12-18 13:38     ` Darren Kenny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).