qemu-devel
[Top][All Lists]
Advanced

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

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


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment
Date: Mon, 18 Dec 2017 14:02:35 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

On 18/12/2017 13:54, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Dec 18, 2017 at 1:49 PM, Paolo Bonzini <address@hidden> wrote:
>> On 15/12/2017 19:18, Marc-André Lureau wrote:
>>> 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>
>>
>> We can drop the error at all if there is a comment.  Also, "volatile 
>> sig_atomic_t" is probably self-explanatory and usually correct.  So what 
>> about this:
>>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
>> index f5a523af10..3dc27d9656 100755
>> --- a/scripts/checkpatch.pl
>> +++ b/scripts/checkpatch.pl
>> @@ -2475,13 +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/) {
>> -                       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);
>> -                       }
>> +               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);
>>                 }
>>
> 
> Fine for me, can you send a proper patch?

Yes, will do.

Paolo



reply via email to

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