From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
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:42:25 -0700 [thread overview]
Message-ID: <20141015124225.01a4cad19c4f3a198efc996e@linux-foundation.org> (raw)
In-Reply-To: <4391d882bb26278110d07b9a5e23ec44f5f8328a.1413400022.git.joe@perches.com>
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.
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -4671,6 +4671,14 @@ sub process {
> }
> }
>
> +# Check for __attribute__ weak, or __weak (may have link issues)
> + if ($realfile !~ m@\binclude/uapi/@ &&
And this bit maybe is checking for use in a header file, which is not
as good as checking for a declaration but is probably good enough.
However the "uapi" bit is confusing.
Can we have a better changelog please?
> + ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
> + $line =~ \b__weak\b/)) {
> + ERROR("AVOID_WEAK",
> + "Using weak can have unintended link defects" . $herecurr);
> + }
> +
> # check for sizeof(&)
> if ($line =~ /\bsizeof\s*\(\s*\&/) {
> WARN("SIZEOF_ADDRESS",
> --
> 2.1.0
next prev parent reply other threads:[~2014-10-15 19:42 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 [this message]
2014-10-15 19:45 ` Joe Perches
2014-10-15 19:50 ` Andrew Morton
2014-10-15 19:52 ` Joe Perches
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=20141015124225.01a4cad19c4f3a198efc996e@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=joe@perches.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®