Skip to content

Convert Doxygen comments that reference parameters - #4

Merged
jserv merged 1 commit into
mainfrom
fix
Aug 25, 2026
Merged

Convert Doxygen comments that reference parameters#4
jserv merged 1 commit into
mainfrom
fix

Conversation

@jserv

@jserv jserv commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Transform 2 aborted a whole comment if any whitespace-delimited "@word" that is not @param/@return appeared anywhere in it. Real Doxygen prose cross-references its arguments ("need not be a multiple of @align", "Pointer to at least @SiZe bytes"), so essentially every such comment bailed and never converted. That is the common case, not a corner.

A "@name"/"\name" is now a cross-reference rather than a foreign tag when the same comment declares that parameter and the name is not a DOXY_TAGS keyword in its own right. Line position looks like the sharper discriminator and is not, because reflow owns line position: a comment this aborts on is still re-wrapped, the line-leading "@file" merges into the line above, and a position test then reads it mid-line and converts what the run before refused. A name-only test cannot move under the packer. Declarations come from the tag region only, read as one word stream so a "@PARAM" ending a line still declares the name that opens the next one. One-character C escapes are excluded after trailing punctuation is trimmed, so "\n" and "\n." agree.

A parameter named after a convertible tag keyword is refused outright: "@PARAM return desc" emitted "@return : desc", which the next run read as a return tag and rewrote again.

Entries then hang their continuations under the description column, the way a @PARAM entry already did, so the two forms match once one comment in a file converts and its neighbor aborts. A nonzero hang made a latent packer bug reachable: classify_lines has always split a paragraph at a "@name :" line, but while entries wrapped flush the regrouping moved no bytes. Three rules close it. The packer will not forge that shape by joining a lone "@name" to a ":"-led word on a continuation line, which has to be caught at the append because is_kernel_doc_tag reads the line start and no later word can clear it. It will not split a paragraph's opening line between "@name" and its colon, overflowing instead. And the end-of-paragraph borrow no longer hands a tag word down to open a continuation line.

That borrow also had a pre-existing data-loss bug the hang exposed: the fold arm sat inside the "there is a word to borrow" case, so a one-word line above fell through and emitted a bare rule alone, which transform 1 deletes on the next run.

Comments across the repo are reflowed by the tool itself.


Summary by cubic

Converts Doxygen comments that reference their own parameters instead of aborting on unknown “@word” tokens. Previously any non-@param/@return@word” aborted the comment; now “@name”/“\name” that matches a declared param is treated as prose, while real foreign tags still abort. Kernel-doc entries now hang their continuations under the description column, which may rewrap many comments. A param named after a convertible keyword (for example “return”) forces pass-through to keep rewrites idempotent.

New Features

  • Treat “@name”/“\name” as a param cross-reference when the name is declared in the same tag block and not a known tag.
  • Accept trailing punctuation and collect param names across line breaks in the tag region.
  • Exclude one-character C escapes (for example “\n”) from cross-reference detection.
  • Hang kernel-doc entry continuations under the description column.

Bug Fixes

  • Do not forge a kernel-doc tag by joining a lone “@name” with a “:”-led word on a continuation line.
  • Do not split an entry between “@name” and its colon; overflow instead.
  • End-of-paragraph borrow no longer moves a tag to the start of a continuation line.
  • Fix a data-loss case where a trailing rule after a one-word line emitted a bare rule that a later pass deleted.

Written for commit e4ccd2b. Summary will update on new commits.

Review in cubic

cubic-dev-ai[bot]

This comment was marked as resolved.

Transform 2 aborted a whole comment if any whitespace-delimited "@word"
that is not @param/@return appeared anywhere in it. Real Doxygen prose
cross-references its arguments ("need not be a multiple of @align",
"Pointer to at least @SiZe bytes"), so essentially every such comment
bailed and never converted. That is the common case, not a corner.

A "@name"/"\name" is now a cross-reference rather than a foreign tag
when the same comment declares that parameter and the name is not a
DOXY_TAGS keyword in its own right. Line position looks like the
sharper discriminator and is not, because reflow owns line position:
a comment this aborts on is still re-wrapped, the line-leading "@file"
merges into the line above, and a position test then reads it mid-line
and converts what the run before refused. A name-only test cannot move
under the packer. Declarations come from the tag region only, read as
one word stream so a "@PARAM" ending a line still declares the name
that opens the next one. One-character C escapes are excluded after
trailing punctuation is trimmed, so "\n" and "\n." agree.

A parameter named after a convertible tag keyword is refused outright:
"@PARAM return desc" emitted "@return : desc", which the next run read
as a return tag and rewrote again.

Entries then hang their continuations under the description column, the
way a @PARAM entry already did, so the two forms match once one comment
in a file converts and its neighbor aborts. A nonzero hang made a latent
packer bug reachable: classify_lines has always split a paragraph at a
"@name :" line, but while entries wrapped flush the regrouping moved no
bytes. Three rules close it. The packer will not forge that shape by
joining a lone "@name" to a ":"-led word on a continuation line, which
has to be caught at the append because is_kernel_doc_tag reads the line
start and no later word can clear it. It will not split a paragraph's
opening line between "@name" and its colon, overflowing instead. And
the end-of-paragraph borrow no longer hands a tag word down to open a
continuation line.

That borrow also had a pre-existing data-loss bug the hang exposed: the
fold arm sat inside the "there is a word to borrow" case, so a one-word
line above fell through and emitted a bare rule alone, which transform 1
deletes on the next run.

Comments across the repo are reflowed by the tool itself.
@jserv
jserv merged commit 8503a6a into main Aug 25, 2026
23 checks passed
@jserv
jserv deleted the fix branch August 25, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant