diff mbox series

[for-5.0?,2/3] scripts/kernel-doc: Add missing close-paren in c:function directives

Message ID 20200411182934.28678-3-peter.maydell@linaro.org
State Superseded
Headers show
Series Make docs build work with Sphinx 3 | expand

Commit Message

Peter Maydell April 11, 2020, 6:29 p.m. UTC
When kernel-doc generates a 'c:function' directive for a function
one of whose arguments is a function pointer, it fails to print
the close-paren after the argument list of the function pointer
argument, for instance:
  .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)

which should have a ')' after the 'void *host' which is the
last argument to 'resized'.

Older versions of Sphinx don't try to parse the argumnet
to c:function, but Sphinx 3.0 does do this and will complain:

  /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters
  Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208]
    void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

Add the missing close-paren.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.20.1

Comments

Richard Henderson April 11, 2020, 8:11 p.m. UTC | #1
On 4/11/20 11:29 AM, Peter Maydell wrote:
> When kernel-doc generates a 'c:function' directive for a function

> one of whose arguments is a function pointer, it fails to print

> the close-paren after the argument list of the function pointer

> argument, for instance:

>   .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)

> 

> which should have a ')' after the 'void *host' which is the

> last argument to 'resized'.

> 

> Older versions of Sphinx don't try to parse the argumnet

> to c:function, but Sphinx 3.0 does do this and will complain:

> 

>   /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters

>   Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208]

>     void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)

>     ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

> 

> Add the missing close-paren.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  scripts/kernel-doc | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>



r~
Alex Bennée April 14, 2020, 2:56 p.m. UTC | #2
Peter Maydell <peter.maydell@linaro.org> writes:

> When kernel-doc generates a 'c:function' directive for a function

> one of whose arguments is a function pointer, it fails to print

> the close-paren after the argument list of the function pointer

> argument, for instance:


for instance in the memory API documentation:

?

>   .. c:function:: void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)

>

> which should have a ')' after the 'void *host' which is the

> last argument to 'resized'.

>

> Older versions of Sphinx don't try to parse the argumnet

> to c:function, but Sphinx 3.0 does do this and will complain:

>

>   /home/petmay01/linaro/qemu-from-laptop/qemu/docs/../include/exec/memory.h:834: WARNING: Error in declarator or parameters

>   Invalid C declaration: Expecting "," or ")" in parameters, got "EOF". [error at 208]

>     void memory_region_init_resizeable_ram (MemoryRegion * mr, struct Object * owner, const char * name, uint64_t size, uint64_t max_size, void (*resized) (const char*, uint64_t length, void *host, Error ** errp)

>     ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

>

> Add the missing close-paren.

>

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Anyway:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

Tested-by: Alex Bennée <alex.bennee@linaro.org>


-- 
Alex Bennée
diff mbox series

Patch

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index af470eb3211..8dc30e01e58 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -853,7 +853,7 @@  sub output_function_rst(%) {
 
 	if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
 	    # pointer-to-function
-	    print $1 . $parameter . ") (" . $2;
+	    print $1 . $parameter . ") (" . $2 . ")";
 	} else {
 	    print $type . " " . $parameter;
 	}