mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier.adi@gmail.com>
To: "SL Baur" <steve@xemacs.org>
Cc: "Andy Whitcroft" <apw@shadowen.org>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>,
	"Michael Hennerich" <michael.hennerich@analog.com>
Subject: Re: false positive in checkpatch.pl (complex macro values)
Date: Fri, 24 Aug 2007 09:24:17 -0400	[thread overview]
Message-ID: <8bd0f97a0708240624v64b47b4l726a66f9766bc4a0@mail.gmail.com> (raw)
In-Reply-To: <ed10ee420708240543r27db83e9l25300c2799c7c2cd@mail.gmail.com>

On 8/24/07, SL Baur <steve@xemacs.org> wrote:
> On 8/24/07, Andy Whitcroft <apw@shadowen.org> wrote:
> > Mike Frysinger wrote:
> > > in some code that does like:
> > > #define foo { a, b, c, \
> > >     d, e, f, g }
> > > ...
> > > int boo[] = foo;
> > > ...
> > >
> > > checkpatch.pl throws a fit:
> > > ERROR: Macros with complex values should be enclosed in parenthesis
> > > #10: FILE: ...
> > > +#define foo {a, b, c, d}
> > >
> > > perhaps the check should also allow {...} ?  or ignore lists like this ...
> >
> > Ok, we can add that to the check.  Next update will allow that.
> >
> > Thanks for the report.
>
> I sent a reply accidentally only to Mike and not the list.  I think the
> error message is wrong.  That is really ugly code.  Linux Kernel code
> believes in C not preprocessor tricks, so why would you need this?
>
> Who uses code like this, by the way?

the way we came across it was in code that hasnt been pushed to
mainline yet ... we run the code on our tree

however, there are plenty of cases in the tree right now ... a quick
grep picks out sound/pci/ice1712/aureon.h as the first offender

$ diff -Nu /dev/null ./sound/pci/ice1712/aureon.h | perl
./scripts/checkpatch.pl -
ERROR: Macros with complex values should be enclosed in parenthesis
#31: FILE: sound/pci/ice1712/aureon.h:28:
+#define  AUREON_DEVICE_DESC           "{Terratec,Aureon 5.1 Sky},"\

$ grep AUREON_DEVICE_DESC ./sound/pci/ice1712/aureon.h -A 5
#define  AUREON_DEVICE_DESC            "{Terratec,Aureon 5.1 Sky},"\
                                       "{Terratec,Aureon 7.1 Space},"\
                                       "{Terratec,Aureon 7.1 Universe}," \
                                        "{AudioTrak,Prodigy 7.1}," \
                                        "{AudioTrak,Prodigy 7.1 LT},"\
                                        "{AudioTrak,Prodigy 7.1 XT},"

seems like perfectly valid usage to me
-mike

  parent reply	other threads:[~2007-08-24 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24  7:51 Mike Frysinger
2007-08-24 11:41 ` Andy Whitcroft
2007-08-24 12:43   ` SL Baur
2007-08-24 12:50     ` SL Baur
2007-08-24 13:24     ` Mike Frysinger [this message]
2007-08-24 16:47       ` Josef Sipek
2007-08-24 19:10         ` Mike Frysinger
2007-08-24 17:22     ` Olivier Galibert

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=8bd0f97a0708240624v64b47b4l726a66f9766bc4a0@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=apw@shadowen.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=steve@xemacs.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®