8777b71639d02cf069f3fc2583251f85f761c1d6
[buildroot.git] /
1 From f210735fe2f17a6225432ee3d1239bcf23a8659c Mon Sep 17 00:00:00 2001
2 From: Markus Trippelsdorf <markus@trippelsdorf.de>
3 Date: Fri, 24 Jun 2011 15:51:00 +0200
4 Subject: [PATCH] headers_install: fix __packed in exported kernel headers
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 checkpatch.pl warns about using __attribute__((packed)) in kernel
10 headers: "__packed is preferred over __attribute__((packed))". If one
11 follows that advice it could cause problems in the exported header
12 files, because the outside world doesn't know about this shortcut.
13
14 For example busybox will fail to compile:
15 CC miscutils/ubi_attach_detach.o
16 In file included from miscutils/ubi_attach_detach.c:27:0:
17 /usr/include/mtd/ubi-user.h:330:3: error: conflicting types for ‘__packed’
18 /usr/include/mtd/ubi-user.h:314:3: note: previous declaration of ‘__packed’ was here
19 ...
20
21 Fix the problem by substituting __packed with __attribute__((packed)) in
22 the header_install.pl script.
23
24 Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
25 CC: Joe Perches <joe@perches.com>
26 Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
27 Signed-off-by: Michal Marek <mmarek@suse.cz>
28 ---
29 scripts/headers_install.pl | 1 +
30 1 files changed, 1 insertions(+), 0 deletions(-)
31
32 diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
33 index efb3be1..48462be 100644
34 --- a/scripts/headers_install.pl
35 +++ b/scripts/headers_install.pl
36 @@ -35,6 +35,7 @@ foreach my $file (@files) {
37 $line =~ s/([\s(])__iomem\s/$1/g;
38 $line =~ s/\s__attribute_const__\s/ /g;
39 $line =~ s/\s__attribute_const__$//g;
40 + $line =~ s/\b__packed\b/__attribute__((packed))/g;
41 $line =~ s/^#include <linux\/compiler.h>//;
42 $line =~ s/(^|\s)(inline)\b/$1__$2__/g;
43 $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g;
44 --
45 1.7.5.4
46