mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Whitcroft <apw@canonical.com>, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] checkpatch: Add a --strict test for macro argument reuse
Date: Thu, 08 Nov 2012 05:25:51 -0800	[thread overview]
Message-ID: <1352381151.9901.5.camel@joe-AO722> (raw)
In-Reply-To: <20121106120027.94648924.akpm@linux-foundation.org>

On Tue, 2012-11-06 at 12:00 -0800, Andrew Morton wrote:
> On Tue, 06 Nov 2012 02:35:39 -0800
> Joe Perches <joe@perches.com> wrote:
> 
> > Add a test for reuse of macro arguments to highlight
> > any possible side-effects from this reuse.
> > 
> > Avoid this check on token name pasting and when the
> > argument is used in a typeof or a __builtin.
> 
> Does this mean that if I do
> 
> 	#define foo(a) bar(a, a)
> 
> that checkpatch will not generate a warning unless I give it
> "--strict"?  If so: whaaah!  I want that warning to come out by
> default.

Well, that was the intent, yes.

I wanted to avoid a bunch of people "improving" simple macros
with a normal checkpatch run on files like include/linux/kernel.h

> Not being totally lazy, I tried it myself but my perl v5.10.1 had
> conniptions over this patch:

Because I had originally used ERROR but decided to use the
incorrect form of CHECK instead of CHK when I submitted the
patch.  Sorry.

Anyway, do try it on include/linux files with -f and see if
you think it's really appropriate to have the thing report
this type of error.

Dunno.  Maybe it's appropriate to warn on .diff/.patch files
but only emit the message  on checkpatch -f --strict uses.

I generally don't like different behavior based on runtime
input.  Shrug.  Who knows what's right here.


      reply	other threads:[~2012-11-08 13:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 10:35 Joe Perches
2012-11-06 20:00 ` Andrew Morton
2012-11-08 13:25   ` Joe Perches [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=1352381151.9901.5.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.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

all inboxes | Powered by JetHome®