You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you explicit what is missing? I guess you are talking about arguments not being tagged as references but I am not sure.
For the first link it would be char and s.
For the second link it would be n and size.
Thanks!
edit: no, it seems you are talking about doc comments. That is related to find-file-doc-comments.pl, which we don't know much about. We need to look into it.
It doesn't work with debian:testing nor debian:unstable. The debian package index agrees (all have the same version).
So prod server has a recent ctags that works fine, but the initial indexing has been done inside the Docker container. That means blobs that didn't change are wrong in the latest version. To address this, we should:
fix the docker image to have a recent enough universal-ctags version and,
do a full reindex.
For (1) we could either switch distro, sideload universal-ctags or compile it manually.
For the second one, I think it is because of the name mismatch. The code looks for a matching name as a shortcut to avoid needing a full C parser.
For this one, I am wondering if we could ignore finding a declaration/prototype below that matches the name. If we take declarations from linux/mm/util.c, there are quite a few that follow the $a_noprof with $a being declared as a wrapper macro in header files, adding some safety/profiling code surrounding the function call.
I cannot think of places where not checking the declaration below would be an issue.
Re. the second one, I don't recall why I added that check. I think it might have been to avoid indexing doc comments belonging to things other than functions. E.g., a doc comment for a macro, then the macro, then a function --- we don't want the doc comment associated with the function.
I am wondering if we could change the approach completely:
Find lines like /**,
Keep matches where the next line is * $ident - ...,
Keep matches were we have a definition for $ident in the database.
Benefits:
Script doesn't have to call ctags,
We take into account doccomments which aren't located next to the definitions (ie the current issue),
Simpler implementation.
Downfalls:
False positives? Those should be mitigated by the database definition check.
False negatives? Is the above too restrictive for doc comments? It might be specific to C kernel code standards for example, and different in other projects.
I wanted to note that the kernel docs parsing script recognizes mentioned symbols.
./scripts/kernel-doc ./mm/util.c
Details
(...)
.. c:function:: char * kstrdup (const char *s, gfp_t gfp)
allocate space for and copy an existing string
.. container:: kernelindent
**Parameters**
``const char *s``
the string to duplicate
``gfp_t gfp``
the GFP mask used in the kmalloc() call when allocating memory
**Return**
newly allocated copy of **s** or ``NULL`` in case of error
(...)
./scripts/kernel-doc ./kernel.trace/trace.c
Details
.. c:function:: int trace_array_printk (struct trace_array *tr, unsigned long ip, const char *fmt, ...)
Print a message to a specific instance
.. container:: kernelindent
**Parameters**
``struct trace_array *tr``
The instance trace_array descriptor
``unsigned long ip``
The instruction pointer that this is called from.
``const char *fmt``
The format to print (printf format)
``...``
variable arguments
**Description**
If a subsystem sets up its own instance, they have the right to
printk strings into their tracing instance buffer using this
function. Note, this function will not write into the top level
buffer (use trace_printk() for that), as writing into the top level
buffer should only have events that can be individually disabled.
trace_printk() is only used for debugging a kernel, and should not
be ever incorporated in normal use.
trace_array_printk() can be used, as it will not add noise to the
top level tracing buffer.
Note, trace_array_init_printk() must be called on **tr** before this
can be used.
(...)
.. c:function:: void * vcalloc (size_t n, size_t size)
allocate and zero memory for a virtually contiguous array.
.. container:: kernelindent
**Parameters**
``size_t n``
number of elements.
``size_t size``
element size.
(...)
Activity
tleb commentedon Nov 25, 2024
Can you explicit what is missing? I guess you are talking about arguments not being tagged as references but I am not sure.
For the first link it would be
charands.For the second link it would be
nandsize.Thanks!
edit: no, it seems you are talking about doc comments. That is related to find-file-doc-comments.pl, which we don't know much about. We need to look into it.
cxw42 commentedon Nov 25, 2024
For the second one, I think it is because of the name mismatch. The code looks for a matching name as a shortcut to avoid needing a full C parser.
elixir/find-file-doc-comments.pl
Line 90 in 5fe2a8e
cxw42 commentedon Nov 25, 2024
For the first one, it might be that the ctags invocation needs to be updated.
elixir/find-file-doc-comments.pl
Line 43 in 5fe2a8e
tleb commentedon Nov 26, 2024
Indeed the ctags inside the Docker container doesn't give an entry for
strdup. Inside the Docker container:Details
Compared to a recent ctags (the one used by the prod server):
Details
This is an issue with the universal-ctags packaged by Debian Bookworm:
It doesn't work with
debian:testingnordebian:unstable. The debian package index agrees (all have the same version).So prod server has a recent ctags that works fine, but the initial indexing has been done inside the Docker container. That means blobs that didn't change are wrong in the latest version. To address this, we should:
For (1) we could either switch distro, sideload universal-ctags or compile it manually.
tleb commentedon Nov 26, 2024
For this one, I am wondering if we could ignore finding a declaration/prototype below that matches the name. If we take declarations from
linux/mm/util.c, there are quite a few that follow the$a_noprofwith$abeing declared as a wrapper macro in header files, adding some safety/profiling code surrounding the function call.I cannot think of places where not checking the declaration below would be an issue.
cxw42 commentedon Nov 28, 2024
@tleb Thanks for the research on the first one!
Re. the second one, I don't recall why I added that check. I think it might have been to avoid indexing doc comments belonging to things other than functions. E.g., a doc comment for a macro, then the macro, then a function --- we don't want the doc comment associated with the function.
tleb commentedon Nov 28, 2024
I am wondering if we could change the approach completely:
/**,* $ident - ...,$identin the database.Benefits:
Downfalls:
Fomys commentedon Feb 12, 2025
I think your approach may work, especially since some functions are not marked as documented because there are macro in-between, like this: https://elixir.bootlin.com/linux/v6.13.2/source/kernel/trace/trace.c#L3407-L3428 (function found, but not its documentation)
[-]Documentation not indexed[/-][+]Doc-comments edge-cases not indexed [/+]fstachura commentedon Feb 13, 2025
I wanted to note that the kernel docs parsing script recognizes mentioned symbols.
./scripts/kernel-doc ./mm/util.cDetails
./scripts/kernel-doc ./kernel.trace/trace.cDetails
Many functions in mm/util.c file have a
_noprofsuffix, it seems that it's dropped in the doccomments parser https://lore.kernel.org/all/20240326054149.2121-1-rdunlap@infradead.org/./scripts/kernel-doc ./mm/util.cDetails