| 1 | checkpatch.pl warns about using __attribute__((packed)) in kernel |
| 2 | headers: "__packed is preferred over __attribute__((packed))". If one |
| 3 | follows that advice it could cause problems in the exported header |
| 4 | files, because the outside world doesn't know about this shortcut. |
| 5 | |
| 6 | For example busybox will fail to compile: |
| 7 | CC miscutils/ubi_attach_detach.o |
| 8 | In file included from miscutils/ubi_attach_detach.c:27:0: |
| 9 | /usr/include/mtd/ubi-user.h:330:3: error: conflicting types for ‘__packed’ |
| 10 | /usr/include/mtd/ubi-user.h:314:3: note: previous declaration of ‘__packed’ was here |
| 11 | ... |
| 12 | |
| 13 | Fix the problem by substituting __packed with __attribute__((packed)) in |
| 14 | the header_install.pl script. |
| 15 | |
| 16 | Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> |
| 17 | CC: Joe Perches <joe@perches.com> |
| 18 | Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de> |
| 19 | --- |
| 20 | scripts/headers_install.pl | 1 + |
| 21 | 1 files changed, 1 insertions(+), 0 deletions(-) |
| 22 | --- a/scripts/headers_install.pl |
| 23 | +++ b/scripts/headers_install.pl |
| 24 | @@ -35,6 +35,7 @@ foreach my $file (@files) { |
| 25 | $line =~ s/([\s(])__iomem\s/$1/g; |
| 26 | $line =~ s/\s__attribute_const__\s/ /g; |
| 27 | $line =~ s/\s__attribute_const__$//g; |
| 28 | + $line =~ s/\b__packed\b/__attribute__((packed))/g; |
| 29 | $line =~ s/^#include <linux\/compiler.h>//; |
| 30 | $line =~ s/(^|\s)(inline)\b/$1__$2__/g; |
| 31 | $line =~ s/(^|\s)(asm)\b(\s|[(]|$)/$1__$2__$3/g; |
| 32 | |