All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andy Whitcroft <apw@canonical.com>
Cc: shailendra.v@samsung.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts:checkpatch - correct the error message during check
Date: Fri, 30 Oct 2015 08:29:46 -0700	[thread overview]
Message-ID: <1446218986.2757.193.camel@perches.com> (raw)
In-Reply-To: <20151030125622.GD13734@bark>

On Fri, 2015-10-30 at 12:56 +0000, Andy Whitcroft wrote:
> On Fri, Oct 30, 2015 at 04:55:04PM +0530, shailendra.v@samsung.com wrote:
> > From: Shailendra Verma <shailendra.v@samsung.com>
[]
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > @@ -3169,21 +3169,21 @@ sub process {
> >  		}
> >  
> >  # check for global initialisers.
> > -		if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(?:0|NULL|false)\s*;/) {
> > +		if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*(0x0|0|NULL|false)\s*;/) {
> >  			if (ERROR("GLOBAL_INITIALISERS",
> > -				  "do not initialise globals to 0 or NULL\n" .
> > +				  "do not initialise globals to $1\n" .
> >  				      $herecurr) &&
> >  			    $fix) {
> > -				$fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0|NULL|false)\s*;/$1;/;
> > +				$fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*(0x0|0|NULL|false)\s*;/$1;/;
> >  			}
> >  		}
> >  # check for static initialisers.
> > -		if ($line =~ /^\+.*\bstatic\s.*=\s*(0|NULL|false)\s*;/) {
> > +		if ($line =~ /^\+.*\bstatic\s.*=\s*(0x0|0|NULL|false)\s*;/) {
> >  			if (ERROR("INITIALISED_STATIC",
> > -				  "do not initialise statics to 0 or NULL\n" .
> > +				  "do not initialise statics to $1\n" .
> >  				      $herecurr) &&
> >  			    $fix) {
> > -				$fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*(0|NULL|false)\s*;/$1;/;
> > +				$fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*(0x0|0|NULL|false)\s*;/$1;/;
> >  			}
> >  		}
> 
> I guess that looks ok.  Joe you don't know of anyone relying on the form
> of the error do you (I do not)?

I do not.

If these are changed, perhaps making the tests
	"((?:0[xX]|)0+$Int_type?|NULL|false)"
might catch a couple more of these;




  reply	other threads:[~2015-10-30 15:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <no@samsung.com>
2015-10-30 11:25 ` [PATCH] scripts:checkpatch - correct the error message during check shailendra.v
2015-10-30 12:56   ` Andy Whitcroft
2015-10-30 15:29     ` Joe Perches [this message]
2015-10-30 19:05     ` [PATCH] checkpatch: Improve the unnecessary initialisers tests Joe Perches
2015-06-05 17:10 [PATCH] scripts:checkpatch - correct the error message during check Shailendra Verma
  -- strict thread matches above, loose matches on Subject: below --
2015-06-05 13:55 Shailendra Verma
2015-06-05 15:15 ` Joe Perches
     [not found]   ` <CA+tKcn9Mc-s=bD3KPQ=E=+yB=Sgx65yi6EUE_Qe7OiC4JCzEJg@mail.gmail.com>
2015-06-05 15:40     ` 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=1446218986.2757.193.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shailendra.v@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.