qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Darren Kenny <darren.kenny@oracle.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, lersek@redhat.com, famz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] checkpatch: warn when using volatile with a comment
Date: Mon, 18 Dec 2017 13:38:13 +0000	[thread overview]
Message-ID: <20171218133813.ittl5hfvzdx3d3r6@starbug-vm.ie.oracle.com> (raw)
In-Reply-To: <20171218133652.wq74ymqhmrxvfoka@starbug-vm.ie.oracle.com>

Nevermind, saw that updated comment in the later patch...

Thanks,

Darren.

On Mon, Dec 18, 2017 at 01:36:52PM +0000, Darren Kenny wrote:
>Hi Paolo,
>
>Slight nit on the subject line, did you mean to s/with/without/ -
>that seems to reflect the change in the patch more correctly.
>
>Thanks,
>
>Darren.
>
>On Mon, Dec 18, 2017 at 01:49:52PM +0100, Paolo Bonzini 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 <famz@redhat.com>
>>>Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>>
>>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);
>>		}
>>
>># warn about #if 0
>>

      reply	other threads:[~2017-12-18 13:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218133813.ittl5hfvzdx3d3r6@starbug-vm.ie.oracle.com \
    --to=darren.kenny@oracle.com \
    --cc=famz@redhat.com \
    --cc=lersek@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).