From: Joe Perches <joe@perches.com>
To: "John W. Linville" <linville@tuxdriver.com>,
Andy Whitcroft <apw@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
linux-wireless@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] checkpatch.pl: Add "prefer __packed" check
Date: Thu, 16 Dec 2010 09:25:58 -0800 [thread overview]
Message-ID: <1292520358.29894.15.camel@Joe-Laptop> (raw)
In-Reply-To: <20101216152121.GB2413@tuxdriver.com>
There's a __packed #define for this __attribute__((packed)).
Might as well get checkpatch to tell people about it.
Signed-off-by: Joe Perches <joe@perches.com>
---
On Thu, 2010-12-16 at 10:21 -0500, John W. Linville wrote:
> On Thu, Dec 16, 2010 at 09:05:12AM -0600, Larry Finger wrote:
> > On 12/16/2010 08:34 AM, John W. Linville wrote:
> > > Use "__packed" instead of "__attribute__ ((packed))"...
> > As a point of interest, is this the "new" recommended way? The reason I ask is
> > that the Linux headers are mostly in the attribute form.
> AIUI, "__packed" is the one true way. I think this facilitates
> compiling the kernel with compilers other than GCC.
>
> At any rate, Dave Miller threatened to injure me if I kept sending him stuff using
> "__attribute__ ((packed))"... :-)
scripts/checkpatch.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e3c7fc0..6fc24af 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2743,6 +2743,11 @@ sub process {
WARN("plain inline is preferred over $1\n" . $herecurr);
}
+# Check for __attribute__ packed, prefer __packed
+ if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) {
+ WARN("__packed is preferred over __attribute__((packed))\n" . $herecurr);
+ }
+
# check for sizeof(&)
if ($line =~ /\bsizeof\s*\(\s*\&/) {
WARN("sizeof(& should be avoided\n" . $herecurr);
prev parent reply other threads:[~2010-12-16 17:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-16 14:34 [PATCH] rtlwifi: convert to __packed notation John W. Linville
2010-12-16 15:05 ` Larry Finger
2010-12-16 15:21 ` John W. Linville
2010-12-16 16:03 ` Larry Finger
2010-12-16 17: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=1292520358.29894.15.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=Larry.Finger@lwfinger.net \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).