Commit 6b012d23 authored by Marc-André Lureau's avatar Marc-André Lureau Committed by Paolo Bonzini
Browse files

checkpatch: volatile with a comment or sig_atomic_t is okay



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: default avatarFam Zheng <famz@redhat.com>
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b8c77234
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2475,8 +2475,11 @@ 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);
		if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/ &&
                    $line !~ /sig_atomic_t/ &&
                    !ctx_has_comment($first_line, $linenr)) {
			my $msg = "Use of volatile is usually wrong, please add a comment\n" . $herecurr;
                        ERROR($msg);
		}

# warn about #if 0