From: Marc-André Lureau <marcandre.lureau@redhat.com>
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 <famz@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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
Hi
----- Original Message -----
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>
> 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 <famz@redhat.com>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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
> ---
> 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
>
>
On 18/12/2017 14:07, Marc-André Lureau wrote:
> Hi
>
> ----- Original Message -----
>> From: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>> 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 <famz@redhat.com>
>> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>
> 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
>>
>>
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20171218130309.2682-1-pbonzini@redhat.com
Subject: [Qemu-devel] [PATCH v2] checkpatch: volatile with a comment or sig_atomic_t is okay
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
ac1ea4c622 checkpatch: volatile with a comment or sig_atomic_t is okay
=== OUTPUT BEGIN ===
Checking PATCH 1/1: checkpatch: volatile with a comment or sig_atomic_t is okay...
ERROR: line over 90 characters
#35: FILE: scripts/checkpatch.pl:2481:
+ my $msg = "Use of volatile is usually wrong, please add a comment\n" . $herecurr;
total: 1 errors, 0 warnings, 13 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@freelists.org
© 2016 - 2025 Red Hat, Inc.