Skip to content

Fix incorrect doc for stdio_put_string#2943

Open
anoshyn wants to merge 1 commit into
raspberrypi:developfrom
anoshyn:fix-stdio-put-string-doc
Open

Fix incorrect doc for stdio_put_string#2943
anoshyn wants to merge 1 commit into
raspberrypi:developfrom
anoshyn:fix-stdio-put-string-doc

Conversation

@anoshyn
Copy link
Copy Markdown

@anoshyn anoshyn commented May 16, 2026

Summary

The doxygen for stdio_put_string in src/rp2_common/pico_stdio/include/pico/stdio.h reads "This method returns as soon as input is available, but more characters may be returned up to the end of the buffer." That text was copy-pasted from an input-reading helper (e.g. stdio_get_until); stdio_put_string is output-only and never returns early on its own. The wording is actively misleading because the function has an int return value, so a reader could plausibly assume some short-write behavior.

Rewrite the description to match the implementation in stdio.c:92-114:

  • writes the buffer to every registered driver in turn (no early return);
  • documents the len == -1strlen convention;
  • documents cr_translation behavior (applies to any appended newline too);
  • documents the 0-return edge case when PICO_STDIO_IGNORE_NESTED_STDOUT is set and a concurrent stdout write is in progress.

No behavior change; doxygen only.

Fixes #2818.

Test plan

  • git diff — only src/rp2_common/pico_stdio/include/pico/stdio.h is touched; only the doxygen block for stdio_put_string.
  • CI builds pass (header still compiles cleanly).
  • Doxygen renders without warnings for stdio_put_string.

@anoshyn
Copy link
Copy Markdown
Author

anoshyn commented May 16, 2026

@kilograham @lurch when you have a moment, would you mind taking a look? This is a doxygen-only change to stdio_put_string that fixes the description copy-paste flagged in #2818. Happy to adjust wording if you'd prefer different phrasing. Thanks!

@anoshyn anoshyn force-pushed the fix-stdio-put-string-doc branch from c257b3b to fba9c4d Compare May 16, 2026 10:11
@lurch
Copy link
Copy Markdown
Contributor

lurch commented May 19, 2026

Hi @anoshyn , as requested in other PRs, if you could update all of your pico-sdk PRs to remove the "Co-Authored-By: Claude" lines, that'd be helpful 👍

Comment thread src/rp2_common/pico_stdio/include/pico/stdio.h Outdated
@anoshyn anoshyn force-pushed the fix-stdio-put-string-doc branch from fba9c4d to c2a8ef1 Compare May 19, 2026 19:18
@anoshyn
Copy link
Copy Markdown
Author

anoshyn commented May 19, 2026

Force-pushed: dropped the Co-Authored-By trailer, and trimmed the prose body so it no longer restates the \param lines - now just a brief plus two short sentences covering what isn't in the params (full-buffer write, may block under back-pressure). New HEAD: c2a8ef1.

kilograham
kilograham previously approved these changes May 19, 2026
@kilograham kilograham added this to the 2.2.1 milestone May 19, 2026
*
* This method returns as soon as input is available, but more characters may
* be returned up to the end of the buffer.
* Writes \p s in full to every registered stdio driver. The call returns once
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd be tempted to do:

Suggested change
* Writes \p s in full to every registered stdio driver. The call returns once
* Writes \p s to every registered stdio driver. The call returns once

as you could give a len shorter than s if you didn't want to write all of it. (But this is optional, given that Graham has already approved this PR.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — applied in 3dc5e04. "in full" did contradict the \param len line right below it.

The doxygen for stdio_put_string read "This method returns as soon as
input is available, but more characters may be returned up to the end
of the buffer." That text was copy-pasted from an input-reading helper
(e.g. stdio_get_until); stdio_put_string is output-only and never
returns early on its own.

Rewrite to match what the implementation actually does and trim the
prose so it no longer restates the \param descriptions: a one-line
brief, plus two short sentences covering only what isn't in the params
(writes the buffer in full, may block under driver back-pressure). The
\param/\return lines pick up the len == -1 strlen convention and the
return-0 path when PICO_STDIO_IGNORE_NESTED_STDOUT is set.

Fixes raspberrypi#2818.
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.

3 participants