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: [PATCH 2/3] checkpatch: Add error on use of attribute((weak)) or __weak
Date: Wed, 15 Oct 2014 12:52:44 -0700 [thread overview]
Message-ID: <1413402764.7484.10.camel@perches.com> (raw)
In-Reply-To: <20141015125000.44353284288395e216659953@linux-foundation.org>
On Wed, 2014-10-15 at 12:50 -0700, Andrew Morton wrote:
> On Wed, 15 Oct 2014 12:45:48 -0700 Joe Perches <joe@perches.com> wrote:
>
> > On Wed, 2014-10-15 at 12:42 -0700, Andrew Morton wrote:
> > > On Wed, 15 Oct 2014 12:32:08 -0700 Joe Perches <joe@perches.com> wrote:
> > >
> > > > Using weak can have unintended link defects.
> > > > Emit an error on its use.
> > >
> > > Well, we don't want a warning about use of __weak in function
> > > definitions. Only in declarations.
> >
> > Why is that?
>
> Because the problem we're trying to detect is when __weak is used on a
> declaration.
>
> This is OK:
>
> foo.h:
> extern int foo(void);
> foo.c:
> int __weak foo(void)
> {
> ...
> }
>
> But this is not OK:
>
> foo.h:
> extern __weak int foo(void);
> foo.c:
> int __weak foo(void)
> {
> ...
> }
>
And this?
foo.c:
extern __weak int foo(void);
int __weak foo(void)
{
}
next prev parent reply other threads:[~2014-10-15 19:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 19:32 [PATCH 0/3] checkpatch: Miscellaneous cleanups Joe Perches
2014-10-15 19:32 ` [PATCH 1/3] checkpatch: Add an error test for no space before comma Joe Perches
2014-10-15 19:32 ` [PATCH 2/3] checkpatch: Add error on use of attribute((weak)) or __weak Joe Perches
2014-10-15 19:42 ` Andrew Morton
2014-10-15 19:45 ` Joe Perches
2014-10-15 19:50 ` Andrew Morton
2014-10-15 19:52 ` Joe Perches [this message]
2014-10-15 20:01 ` Andrew Morton
2014-10-15 20:46 ` [PATCH 2/3 V2] [PATCH] checkpatch: Add error on use of attribute((weak)) or __weak declarations Joe Perches
2014-10-15 19:32 ` [PATCH 3/3] checkpatch: Improve test for no space after cast 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=1413402764.7484.10.camel@perches.com \
--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
Powered by JetHome