提交 0b54c2e3 编写于 作者: M Mauro Carvalho Chehab 提交者: Jonathan Corbet

scripts/kernel-doc: ignore identifier on anonymous enums

When anonymous enums are used, the identifier is empty.

While, IMO, it should be avoided the usage of such enums,
adding support for it is not hard.

So, postpone the check for empty identifiers to happen
only at the dump phase.
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/055ad57879f1b9381b90879e00f72fde1c3a5647.1614760910.git.mchehab+huawei@kernel.orgSigned-off-by: NJonathan Corbet <corbet@lwn.net>
上级 e85d92b3
...@@ -1412,9 +1412,14 @@ sub dump_enum($$) { ...@@ -1412,9 +1412,14 @@ sub dump_enum($$) {
if ($members) { if ($members) {
if ($identifier ne $declaration_name) { if ($identifier ne $declaration_name) {
print STDERR "${file}:$.: warning: expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n"; if ($identifier eq "") {
print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";
} else {
print STDERR "${file}:$.: warning: expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n";
}
return; return;
} }
$declaration_name = "(anonymous)" if ($declaration_name eq "");
my %_members; my %_members;
...@@ -2134,7 +2139,7 @@ sub process_name($$) { ...@@ -2134,7 +2139,7 @@ sub process_name($$) {
++$warnings; ++$warnings;
} }
if ($identifier eq "") { if ($identifier eq "" && $decl_type ne "enum") {
print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n"; print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";
print STDERR $_; print STDERR $_;
++$warnings; ++$warnings;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册