public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Joe Perches <joe@perches.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: remove unneeded or ("|")
Date: Thu, 12 Mar 2015 14:56:31 +0000	[thread overview]
Message-ID: <20150312145631.GT6998@bark> (raw)
In-Reply-To: <1426169615.32696.103.camel@perches.com>

On Thu, Mar 12, 2015 at 07:13:35AM -0700, Joe Perches wrote:
> On Thu, 2015-03-12 at 15:07 +0100, Christian Borntraeger wrote:
> > while porting commit 89a883530fe7 ("checkpatch: ## is not a valid
> > modifier") to QEMU, Peter Maydell noticed that the | at the end of
> > the list is not necessary.
> > 
> > Lets get rid of it in kernel checkpatch.pl
> 
> Andy?  Was that meant to allow nothing?
> 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -1550,7 +1550,7 @@ sub possible {
> >  			asm|__asm__|
> >  			do|
> >  			\#|
> > -			\#\#|
> > +			\#\#
> >  		)(?:\s|$)|
> >  		^(?:typedef|struct|enum)\b
> >  	    )}x;

Blimey you tax my memory indeed.

The two places it is used we are saying that the strings which match are
not modifiers.  So it seems sane that we would want to reject the empty
string in that case.  That said, it does not appear any of the callers
would call with a blank string.  I would suggest we had it like that as
a safety feature, _though_ if we had I would have expected it to have a
nice shiney comment to say just how smart we being using that trailing
or and so likely as not is is unintentional.

tl;dr I think it is safe to elide it with the current callers, it being
there seems safe, but if it stays damn it should have a comment to say
its a safety net and not just hide out.

-apw

  reply	other threads:[~2015-03-12 14:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-12 14:07 [PATCH] checkpatch: remove unneeded or ("|") Christian Borntraeger
2015-03-12 14:13 ` Joe Perches
2015-03-12 14:56   ` Andy Whitcroft [this message]
2015-03-24 11:54     ` Christian Borntraeger
2015-03-24 14:11       ` Joe Perches

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=20150312145631.GT6998@bark \
    --to=apw@canonical.com \
    --cc=borntraeger@de.ibm.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.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