Skip to contentSkip to conversation

docs: conf.py: Ignore __counted_by attribute

PATCH Applied Kees Cook 3 participants 4 messages Dec 15, 2023 Documentation

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 docs: conf.py: Ignore __counted_by attribute

It seems that Sphinx is confused by the __counted_by attribute on struct members. Add it to the list of known attributes.

---
 Documentation/conf.py | 1 +
 1 file changed, 1 insertion(+)
Documentation/conf.py +1 -0
index d4fdf6a3875a..5898c74b96fb 100644
@@ -106,6 +106,7 @@ if major >= 3:
             "__weak",
             "noinline",
             "__fix_address",
+            "__counted_by",
 
             # include/linux/memblock.h:
             "__init_memblock",
Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 19 lines · Kees Cook

It seems that Sphinx is confused by the __counted_by attribute on struct members. Add it to the list of known attributes.

---
 Documentation/conf.py | 1 +
 1 file changed, 1 insertion(+)
Documentation/conf.py +0 -0
index d4fdf6a3875a..5898c74b96fb 100644

Documentation/conf.py if major >= 3: · line 112

Quoted 7 lines
Documentation/conf.py +1 -0
@@ -106,6 +106,7 @@ if major >= 3:
             "__weak",
             "noinline",
             "__fix_address",
+            "__counted_by",
 
             # include/linux/memblock.h:
             "__init_memblock",

If Sphinx needs to know about that, then fine. OTOH, for scripts/kernel-doc, a similar change could have been made to dump_struct(), along with these others:

	# strip attributes
	$members =~ s/\s*$attribute/ /gi;
	$members =~ s/\s*__aligned\s*\([^;]*\)/ /gos;
	$members =~ s/\s*__packed\s*/ /gos;
	$members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
	$members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
	$members =~ s/\s*____cacheline_aligned/ /gos;
Signature · 3 lines
#Randy
https://people.kernel.org/tglx/notes-about-netiquette
https://subspace.kernel.org/etiquette.html
author
#2 lore raw
Quoted 27 lines · Randy Dunlap
Quoted 24 lines · Kees Cook

It seems that Sphinx is confused by the __counted_by attribute on struct members. Add it to the list of known attributes.

---
 Documentation/conf.py | 1 +
 1 file changed, 1 insertion(+)
Documentation/conf.py +1 -0
index d4fdf6a3875a..5898c74b96fb 100644
@@ -106,6 +106,7 @@ if major >= 3:
             "__weak",
             "noinline",
             "__fix_address",
+            "__counted_by",
 
Quoted 4 lines

Documentation/conf.py if major >= 3: · line 112

Quoted 2 lines
Documentation/conf.py +0 -0
             # include/linux/memblock.h:
             "__init_memblock",

If Sphinx needs to know about that, then fine. OTOH, for scripts/kernel-doc,

I *think* it does -- I can't reproduce the robot warnings myself.

Quoted 10 lines

a similar change could have been made to dump_struct(), along with these others:

	# strip attributes
	$members =~ s/\s*$attribute/ /gi;
	$members =~ s/\s*__aligned\s*\([^;]*\)/ /gos;
	$members =~ s/\s*__packed\s*/ /gos;
	$members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
	$members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
	$members =~ s/\s*____cacheline_aligned/ /gos;

scripts/kernel-doc doesn't actually need this -- it already processes struct members in a way that seems to ignore trailing attributes.

-Kees

Signature · 1 line
Kees Cook
maintainer Applied
#3 lore raw
In reply to Kees Cook
Quoted 19 lines · Kees Cook

It seems that Sphinx is confused by the __counted_by attribute on struct members. Add it to the list of known attributes.

---
 Documentation/conf.py | 1 +
 1 file changed, 1 insertion(+)
Documentation/conf.py +0 -0
index d4fdf6a3875a..5898c74b96fb 100644

Documentation/conf.py if major >= 3: · line 109

Quoted 4 lines
Documentation/conf.py +1 -0
@@ -106,6 +106,7 @@ if major >= 3:
             "__weak",
             "noinline",
             "__fix_address",
+            "__counted_by",

Applied, thanks.

jon