[libc-commits] [libc] [libc][stdio] Add support for the %m modifier (PR #218312)

Mike Lothian via libc-commits libc-commits at lists.llvm.org
Wed Oct 28 04:47:14 PDT 2026


FireBurn wrote:

Some behaviours we found worth covering in tests for `%m`, from a downstream implementation:
- `%ms` on a short word, and two `%ms` in one format giving two different allocations;
- input longer than the initial buffer, so the growth path runs;
- a width: `%3ms` on `abcdef` stores `abc`;
- a scan set: `%m[a-z]` on `abc123def` stores `abc`;
- no match: `%m[a-z]` on `123` returns 0, allocates nothing and leaves the caller's pointer untouched, so the pointer is only stored once something has matched;
- `%2mc`, where nothing is terminated and only the width says how much was written.

(Drafted with Claude Code assistance.)

https://github.com/llvm/llvm-project/pull/218312


More information about the libc-commits mailing list