Skip to content

Commit

Permalink
scripts/kernel-doc: handle struct member __aligned without numbers
Browse files Browse the repository at this point in the history
Commit ef5da59 ("scripts/kernel-doc: handle struct member
__aligned") permits "char something [123] __aligned(8);".

However, by using \d we constraint ourselves with integers.  This is not
always the case.  In fact, it might be better to do char something[123]
__aligned(sizeof(u16));

For example, With wireless_dev defining:

    u8 address[ETH_ALEN] __aligned(sizeof(u16));

With \d, scripts/kernel-doc erroneously says:

    Warning(include/net/cfg80211.h:2618): Excess struct/union/enum/typedef member 'address' description in 'wireless_dev'

This is because the regex __aligned\s*\(\d+\) fails match at \d as
sizeof is used.

So replace \d with .  to indicate "something" in kernel-doc to ignore
__aligned(SOMETHING) in structs.  With this change, we can use integers
OR sizeof() or macros as we please.

Signed-off-by: Nishanth Menon <[email protected]>
Cc: Fengguang Wu <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Michal Marek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
nmenon authored and torvalds committed Feb 28, 2013
1 parent ff6a6da commit 9dc3091
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/kernel-doc
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ sub dump_struct($$) {
# strip kmemcheck_bitfield_{begin,end}.*;
$members =~ s/kmemcheck_bitfield_.*?;//gos;
# strip attributes
$members =~ s/__aligned\s*\(\d+\)//gos;
$members =~ s/__aligned\s*\(.+\)//gos;

create_parameterlist($members, ';', $file);
check_sections($file, $declaration_name, "struct", $sectcheck, $struct_actual, $nested);
Expand Down

0 comments on commit 9dc3091

Please sign in to comment.