Skip to contentSkip to conversation

kernel-doc: Allow anonymous enum

PATCH Applied Andy Shevchenko 2 participants 4 messages Aug 12, 2019 – Aug 13, 2019 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel-doc: Allow anonymous enum

In C is a valid construction to have an anonymous enumerator.

Though we have now:

drivers/pinctrl/intel/pinctrl-intel.c:240: error: Cannot parse enum!

Support it in the kernel-doc script.

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index 6b03012750da..079502bcc5a3 100755
@@ -1245,7 +1245,7 @@ sub dump_enum($$) {
     # strip #define macros inside enums
     $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
 
-    if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
+    if ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {
 	$declaration_name = $1;
 	my $members = $2;
 	my %_members;
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 7 lines · On Mon, 12 Aug 2019 19:06:31 +0300 Andy Shevchenko…

In C is a valid construction to have an anonymous enumerator.

Though we have now:

drivers/pinctrl/intel/pinctrl-intel.c:240: error: Cannot parse enum!

Support it in the kernel-doc script.

So I don't get this error; I guess the only anonymous enum of interest has yet to find its way into the mainline.

Quoted 10 lines
---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +0 -0
index 6b03012750da..079502bcc5a3 100755

scripts/kernel-doc sub dump_enum($$) { · line 1248

Quoted 5 lines
scripts/kernel-doc +1 -1
@@ -1245,7 +1245,7 @@ sub dump_enum($$) {
     # strip #define macros inside enums
     $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
 
-    if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
+    if ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {

Ah the joy of regexes...

Applied, thanks.

jon

#2 lore raw
Quoted 5 lines · Jonathan Corbet
Quoted 2 lines · On Mon, 12 Aug 2019 19:06:31 +0300 Andy Shevchenko…

In C is a valid construction to have an anonymous enumerator.

Quoted 8 lines
Quoted 5 lines

Though we have now:

drivers/pinctrl/intel/pinctrl-intel.c:240: error: Cannot parse enum!

Support it in the kernel-doc script.

So I don't get this error; I guess the only anonymous enum of interest has yet to find its way into the mainline.

The other one is already in mainline (drivers/remoteproc/omap_remoteproc.h), but suddenly it misses the second * in the header of kernel-doc comment (perhaps to avoid above error, or for another reason).

Quoted 14 lines
Quoted 14 lines
---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +0 -0
index 6b03012750da..079502bcc5a3 100755
@@ -1245,7 +1245,7 @@ sub dump_enum($$) {
     # strip #define macros inside enums
     $x =~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos;
 
Quoted 6 lines

scripts/kernel-doc sub dump_enum($$) { · line 1248

Quoted 2 lines
scripts/kernel-doc +1 -1
-    if ($x =~ /enum\s+(\w+)\s*\{(.*)\}/) {
+    if ($x =~ /enum\s+(\w*)\s*\{(.*)\}/) {

Ah the joy of regexes...

Applied, thanks.

Thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines · Jonathan Corbet
Quoted 6 lines · On Mon, 12 Aug 2019 19:06:31 +0300 Andy Shevchenko…

In C is a valid construction to have an anonymous enumerator.

Though we have now:

drivers/pinctrl/intel/pinctrl-intel.c:240: error: Cannot parse enum!

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Support it in the kernel-doc script.

So I don't get this error; I guess the only anonymous enum of interest has yet to find its way into the mainline.

The other one is already in mainline (drivers/remoteproc/omap_remoteproc.h), but suddenly it misses the second * in the header of kernel-doc comment (perhaps to avoid above error, or for another reason).

Actually more without full description

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h:186:

Or with format which messes name with description

drivers/misc/mic/cosm/cosm_main.h:19:
include/linux/amba/pl022.h:166:

Or above variants together

drivers/pinctrl/pinctrl-rockchip.c:86:
drivers/pinctrl/pinctrl-rockchip.c:98:

Noticed also broken references like

drivers/scsi/isci/port.c:1193:
drivers/usb/host/ehci-timer.c:381:

where enum mentioned without leading &.

Signature · 2 lines
With Best Regards,
Andy Shevchenko