This is not documented as a valid modifier in printf(9) and GCC at
least warns about the combination being invalid. By my reading, clang
should also be warning (PrintfSpecifier::hasValidAlternativeForm
returns false for FreeBSDbArg) but apparently isn't.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 70237 Build 67120: arc lint + arc unit
Event Timeline
I have no idea why clang fails to warn about this as I noted in the commit log. OTOH, if we want to make '%#b' a real thing, we need to document it in the manpage and fix both compilers to intentionally (vs accidentally) accept it.
I thought someone else was working on more %b for FreeBSD; or at least 64bit %b argument support. Was it @tuexen? I'd be happy to %#b supported :)
\# isn't about what (length) it's about how ("alternate format"). 64-bit %b is called %l[l]b, provided compilers are told length modifiers are valid for %b.
| sys/riscv/riscv/identcpu.c | ||
|---|---|---|
| 593 | May as well retain this as it does actually work. | |
I want to use %lb and %llb in the kernel. clang warns about this but it works when you disable warnings. Teaching clang that FreeBSD supports %b with a length modified in the kernel context is still on my todo list... Once that is in, I plan do document that in printf.9.