This will be usable after clang has been extended to accept length modifiers for %b when compiling kernel code. But we need FreeBSD to support it first...
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
| share/man/man9/printf.9 | ||
|---|---|---|
| 182 | Fixed. The previous example has been fixed in a separate commit. | |
| sys/kern/subr_prf.c | ||
| 971 | That is already supported by the code above. But you need to be able to specify bit positions from 1 to 128 now. The positions from 1 to 32 are encoded as characters from \01 to \40. So you need a way to encode the other positions. OpenBSD also uses the characters from \200 to \377 for it. If you have a different idea, I am happy to explore it. Once this is in, I need to change clang such that it knows that you can use a length modifier (like l or j) in combination with %b. Right now it is warning that you can only use a 32-bit entity. But when you just ignore the warning, it works. Fixing clang is the next step when this change is in. | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 975 | At least for me, parentheses would make it easier to read. *(q++) | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 971 | When does that ever happen? uintmax_t is 64 bits wide, so that won't work anyway. | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 975 | *q++ is already is in other places in this file. So I keep it for consistency. | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 971 | I don't know. Would you prefer to limit the bit number range to 1, ..., 64? Using 1,..., 128 also results in having not invalid characters. | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 971 | It's fine as it is, or at least it doesn't really matter. I just found the description confusing. I don't think we will ever use 128-bit flag variables. | |
| sys/kern/subr_prf.c | ||
|---|---|---|
| 971 | I see. | |