Skip to content

Commit 0b54c2e

Browse files
mchehabJonathan Corbet
authored andcommitted
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: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/055ad57879f1b9381b90879e00f72fde1c3a5647.1614760910.git.mchehab+huawei@kernel.org Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent e85d92b commit 0b54c2e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎scripts/kernel-doc‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,9 +1412,14 @@ sub dump_enum($$) {
14121412

14131413
if ($members) {
14141414
if ($identifier ne $declaration_name) {
1415-
print STDERR "${file}:$.: warning: expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n";
1415+
if ($identifier eq "") {
1416+
print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";
1417+
} else {
1418+
print STDERR "${file}:$.: warning: expecting prototype for enum $identifier. Prototype was for enum $declaration_name instead\n";
1419+
}
14161420
return;
14171421
}
1422+
$declaration_name = "(anonymous)" if ($declaration_name eq "");
14181423

14191424
my %_members;
14201425

@@ -2134,7 +2139,7 @@ sub process_name($$) {
21342139
++$warnings;
21352140
}
21362141

2137-
if ($identifier eq "") {
2142+
if ($identifier eq "" && $decl_type ne "enum") {
21382143
print STDERR "${file}:$.: warning: wrong kernel-doc identifier on line:\n";
21392144
print STDERR $_;
21402145
++$warnings;

0 commit comments

Comments
 (0)