Skip to contentSkip to conversation

scripts/kernel-doc: handle struct member __aligned without numbers

PATCH New Nishanth Menon 1 participant 1 message Feb 24, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scripts/kernel-doc: handle struct member __aligned without numbers

commit ef5da59f12602815baa8fad98241b77dedea3b31 (scripts/kernel-doc: handle struct member __aligned) 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.

Cc Fengguang Wu <[email protected]>
Cc Johannes Berg <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc [email protected] (open list)

---
Based on
master 9e2d59a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal

Rev1: I have seen Johannes' patch here:
http://permalink.gmane.org/gmane.linux.documentation/9271

Rev 2: instead of using prm_clean, we use members which Randy had tried to cleanup

We already have an holder to cleanup aligned, why add another, so just fix it.

 scripts/kernel-doc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index f565536..4305b2f 100755
@@ -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);
Signature · 1 line
1.7.9.5