linux/tools/unittests
Tudor Ambarus 8bf5a177c3 docs: kernel-doc: python: strip __counted_by_ptr macro
The `__counted_by_ptr` macro was recently introduced [1] to extend
bounds checking semantics to standard dynamically allocated pointers.

However, the new Python implementation of kernel-doc does not currently
recognize it as a compiler attribute. When kernel-doc encounters a
struct member annotated with this macro, it fails to parse the variable
name correctly, resulting in false-positive warnings like:

  Warning: ... struct member '__counted_by_ptr(cmdcnt' not described

Add `__counted_by_ptr` to the `struct_xforms` regex list so it gets
safely stripped out during the parsing phase, mirroring the existing
behavior for `__counted_by`. Update the corresponding unit tests.

Link: https://git.kernel.org/torvalds/c/150a04d817d8 [1]
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Kees Cook <kees@kernel.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <20260506-kdoc-__counted_by_ptr-v1-1-70763486871f@linaro.org>
2026-05-15 08:11:36 -06:00
..
kdoc-test-schema.yaml docs: add a schema to help creating unittests for kernel-doc 2026-03-22 15:10:40 -06:00
kdoc-test.yaml docs: kdoc-test.yaml: add more tests 2026-03-25 13:36:45 -06:00
run.py unittests: add a runner to execute all unittests 2026-03-22 15:02:29 -06:00
test_cmatch.py docs: kernel-doc: python: strip __counted_by_ptr macro 2026-05-15 08:11:36 -06:00
test_kdoc_parser.py docs: kdoc: better handle source when producing YAML output 2026-03-25 13:36:46 -06:00
test_kdoc_test_schema.py docs: add a simple kdoc-test.yaml together with a validation tool 2026-03-22 15:10:40 -06:00
test_tokenizer.py unittests: test_tokenizer: better handle mismatch error 2026-03-22 15:10:39 -06:00