From: Andrew Morton <akpm@linux-foundation.org>
To: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Dave Jones <davej@redhat.com>,
Randy Dunlap <randy.dunlap@oracle.com>,
linux-kernel@vger.kernel.org
Subject: Re: checkpatch, a patch checking script.
Date: Wed, 2 May 2007 13:29:38 -0700 [thread overview]
Message-ID: <20070502132938.4349a4ed.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.62.0705022148170.20159@pademelon.sonytel.be>
On Wed, 2 May 2007 21:55:16 +0200 (CEST)
Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> On Wed, 2 May 2007, Andrew Morton wrote:
> > On Wed, 2 May 2007 17:32:49 +0200 (CEST)
> > Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> wrote:
> >
> > > On Wed, 2 May 2007, Christoph Hellwig wrote:
> > > > On Wed, May 02, 2007 at 04:28:27PM +0200, Geert Uytterhoeven wrote:
> > > > > - Check for GNU extension __FUNCTION__
> > > >
> > > > __FUNCTION__ is prefered over __func__
> > >
> > > Is there a reason for that?
> > > - __FUNCTION__ is a GNU extension
> > > - __func__ is C99
> > > - __func__ is shorter to type ;-)
> > >
> >
> > In that case we should use __func__.
> >
> > But we discussed this at some length 3-4 years ago and decided to use
> > __FUNCTION__. I don't remember why. Perhaps problems with gcc support for
> > __func__?
>
> I tried gcc 2.95/3.2/3.3/3.4/4.0/4.1, they all recognize __func__ and
> __FUNCTION__, like in e.g. printf("%s", __func__);
>
> > (It could have been that compile-time string concatenation was involved:
> >
> >
> > printf("xxx" __FILE__); /* works */
> > printf("xxx" __FUNCTION__); /* doesn't */
> >
> > Or not.)
>
> Yep, when trying concatenation, I got:
> - 2.95: works fine
> - 3.2:
> syntax error before "__func__"
> warning: concatenation of string literals with __FUNCTION__ is deprecated
> - 3.3:
> error: syntax error before "__func__"
> warning: concatenation of string literals with __FUNCTION__ is deprecated
> - 3.4/4.0:
> error: syntax error before "__func__"
> error: syntax error before "__FUNCTION__"
> - 4.1:
> error: expected ')' before '__func__'
> error: expected ')' before '__FUNCTION__'
>
> Hence gcc 3.2 and up treat __func__ like the a variable, as per C99, while
> __FUNCTION__ has been moving from a virtual preprocessor definition in 2.95 to
> a variable, like __func__.
>
> So in the end it doesn't matter, as concatenation has been fixed in the Linux
> source tree anyway.
>
Great, thanks for working all that out.
So __func__ it is. In new code. However "convert __FUNCTION__ to
__func__" patches will be cheerfully ignored - life is too short.
err, kernel.h has
/* Trap pasters of __FUNCTION__ at compile-time */
#define __FUNCTION__ (__func__)
next prev parent reply other threads:[~2007-05-02 20:30 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 14:11 [PATCH 0/9] Kconfig: cleanup s390 v2 Martin Schwidefsky
2007-04-23 16:52 ` Arnd Bergmann
2007-04-23 17:45 ` Andrew Morton
2007-04-24 7:52 ` Martin Schwidefsky
2007-04-25 18:21 ` Randy Dunlap
2007-04-25 21:30 ` Andrew Morton
2007-04-26 0:24 ` Andrew Morton
2007-04-26 0:32 ` Arnd Bergmann
2007-04-26 1:06 ` Andrew Morton
2007-04-27 14:21 ` patch style checks Andy Whitcroft
2007-04-27 15:44 ` jschopp
2007-04-26 1:39 ` [PATCH 0/9] Kconfig: cleanup s390 v2 Anton Vorontsov
2007-04-26 8:30 ` Andrew Morton
2007-04-26 20:36 ` Randy Dunlap
2007-04-26 0:39 ` Dave Jones
2007-04-26 2:38 ` Randy Dunlap
2007-04-26 3:02 ` Andrew Morton
2007-04-26 4:24 ` Dave Jones
2007-04-28 3:08 ` checkpatch, a patch checking script Dave Jones
2007-04-28 3:36 ` Roland Dreier
2007-04-28 3:47 ` Adrian Bunk
2007-04-30 0:43 ` Randy Dunlap
2007-04-28 5:18 ` Andrew Morton
2007-04-28 5:50 ` Roland Dreier
2007-04-28 10:52 ` Andi Kleen
2007-04-28 5:58 ` Roland Dreier
2007-04-28 8:01 ` Jan Engelhardt
2007-04-28 8:16 ` Andrew Morton
2007-04-28 10:53 ` Jan Engelhardt
2007-04-29 23:35 ` Randy Dunlap
2007-04-28 10:48 ` Andi Kleen
2007-04-28 10:02 ` Andrew Morton
2007-04-28 10:15 ` Alan Cox
2007-04-28 11:18 ` Andi Kleen
2007-04-28 11:32 ` Alan Cox
2007-04-28 17:06 ` Dave Jones
2007-04-28 18:11 ` Jeff Garzik
2007-04-30 0:59 ` Randy Dunlap
2007-04-28 16:11 ` Matt Mackall
2007-04-28 17:11 ` Dave Jones
2007-04-28 17:21 ` Matt Mackall
2007-04-29 23:37 ` Randy Dunlap
2007-04-30 0:09 ` Matt Mackall
2007-04-30 0:18 ` Randy Dunlap
2007-04-30 1:59 ` Matt Mackall
2007-04-30 23:59 ` Randy Dunlap
2007-05-02 14:28 ` Geert Uytterhoeven
2007-05-02 15:29 ` Christoph Hellwig
2007-05-02 15:32 ` Geert Uytterhoeven
2007-05-02 19:41 ` Andrew Morton
2007-05-02 19:55 ` Geert Uytterhoeven
2007-05-02 20:29 ` Andrew Morton [this message]
2007-05-02 19:08 ` Jan Engelhardt
2007-05-02 19:05 ` Jan Engelhardt
2007-05-03 7:32 ` Sébastien Dugué
2007-05-03 9:27 ` Geert Uytterhoeven
2007-04-26 13:02 ` [PATCH 0/9] Kconfig: cleanup s390 v2 Andy Whitcroft
2007-05-09 11:21 ` Martin Schwidefsky
2007-05-09 16:35 ` Andrew Morton
2007-05-10 7:25 ` Martin Schwidefsky
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=20070502132938.4349a4ed.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=davej@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome