mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch.pl: Add "prefer __packed" check
       [not found]   ` <20101216152121.GB2413@tuxdriver.com>
@ 2010-12-16 17:25     ` Joe Perches
  0 siblings, 0 replies; only message in thread
From: Joe Perches @ 2010-12-16 17:25 UTC (permalink / raw)
  To: John W. Linville, Andy Whitcroft, Andrew Morton
  Cc: Larry Finger, linux-wireless, LKML

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);




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-16 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1292510088-7449-1-git-send-email-linville@tuxdriver.com>
     [not found] ` <4D0A2AA8.5060808@lwfinger.net>
     [not found]   ` <20101216152121.GB2413@tuxdriver.com>
2010-12-16 17:25     ` [PATCH] checkpatch.pl: Add "prefer __packed" check Joe Perches

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®