Re: [PATCH] scripts/kernel-doc: ignore identifier on anonymous enums

2021-03-08 Thread Jonathan Corbet
Mauro Carvalho Chehab  writes:

> 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 
> ---
>  scripts/kernel-doc | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Applied, thanks.

jon


[PATCH] scripts/kernel-doc: ignore identifier on anonymous enums

2021-03-03 Thread Mauro Carvalho Chehab
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 
---
 scripts/kernel-doc | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 68df17877384..f8ebbf5e9f12 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1412,9 +1412,14 @@ sub dump_enum($$) {
 
 if ($members) {
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;
}
+   $declaration_name = "(anonymous)" if ($declaration_name eq "");
 
my %_members;
 
@@ -2132,7 +2137,7 @@ sub process_name($$) {
++$warnings;
}
 
-   if ($identifier eq "") {
+   if ($identifier eq "" && $decl_type ne "enum") {
print STDERR "${file}:$.: warning: wrong kernel-doc identifier on 
line:\n";
print STDERR $_;
++$warnings;
-- 
2.29.2