[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] checkpatch: volatile with a comment or sig_a
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2] checkpatch: volatile with a comment or sig_atomic_t is okay |
Date: |
Mon, 18 Dec 2017 14:08:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 18/12/2017 14:07, Marc-André Lureau wrote:
> Hi
>
> ----- Original Message -----
>> From: Marc-André Lureau <address@hidden>
>>
>> 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 <address@hidden>
>> Signed-off-by: Marc-André Lureau <address@hidden>
>> Message-Id: <address@hidden>
>> Signed-off-by: Paolo Bonzini <address@hidden>
>
> Thanks, I can add it to my 2 patches series for dump (to avoid error on
> Peter's end)
>
> Unless you send a pull request with it sonnish
It is not a big deal if it is included twice. I'm planning my pull
request for tomorrow or Wednesday.
Paolo
>
>
>> ---
>> 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 {
>>
>> # 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
>> --
>> 2.14.3
>>
>>