C23 § 7.18.1 states that "This header makes available the size_t type name (7.21) and any uintN_t, intN_t, uint_leastN_t, or int_leastN_t type names defined by the implementation (7.22)." This is not the case on FreeBSD 16.0-CURRENT. Here is an trivial example program that should compile, but does not: $ cat main.c #include <stdbit.h> int main (void) { size_t v1 = 0; uint32_t v2 = 0; return v1 = v2; } $ cc main.c main.c:5:3: error: use of undeclared identifier 'size_t'; did you mean 'sizeof'? 5 | size_t v1 = 0; | ^~~~~~ | sizeof main.c:5:13: error: expression is not assignable 5 | size_t v1 = 0; | ~~~~~~~~~ ^ main.c:5:10: error: use of undeclared identifier 'v1' 5 | size_t v1 = 0; | ^ main.c:6:3: error: use of undeclared identifier 'uint32_t' 6 | uint32_t v2 = 0; | ^ main.c:7:10: error: use of undeclared identifier 'v1' 7 | return v1 = v2; | ^ main.c:7:15: error: use of undeclared identifier 'v2' 7 | return v1 = v2; | ^ 6 errors generated.
Thank you for mentioning this, I totally forgot about this requirement.
Please find a prospective patch on Phabricator: https://reviews.freebsd.org/D56515
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c8c9324c94dfd4eeecbcfe4a1d3daa047420d3e5 commit c8c9324c94dfd4eeecbcfe4a1d3daa047420d3e5 Author: Robert Clausecker <fuz@FreeBSD.org> AuthorDate: 2026-04-19 12:36:34 +0000 Commit: Robert Clausecker <fuz@FreeBSD.org> CommitDate: 2026-04-20 20:59:54 +0000 include/stdbit.h: declare size_t, (u)int*_t, and (u)int_least*_t These are required by ISO/IEC 9899:2024 § 7.18.1 ¶ 1 but were forgotten in my initial work. The current approach leaks intptr_t, uintptr_t, intmax_t, and uintmax_t through <sys/_stdint.h>. This could be avoided using a more complicated approach if desired. PR: 294131 Fixes: 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64 Reported by: Collin Funk <collin.funk1@gmail.com> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56515 include/stdbit.h | 22 +++++++++++++++++++++- sys/sys/stdint.h | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=16ed84d2b9a1c95b6e0aabd5b7976367b2997d00 commit 16ed84d2b9a1c95b6e0aabd5b7976367b2997d00 Author: Robert Clausecker <fuz@FreeBSD.org> AuthorDate: 2026-04-19 12:36:34 +0000 Commit: Robert Clausecker <fuz@FreeBSD.org> CommitDate: 2026-04-27 00:29:49 +0000 include/stdbit.h: declare size_t, (u)int*_t, and (u)int_least*_t These are required by ISO/IEC 9899:2024 § 7.18.1 ¶ 1 but were forgotten in my initial work. The current approach leaks intptr_t, uintptr_t, intmax_t, and uintmax_t through <sys/_stdint.h>. This could be avoided using a more complicated approach if desired. PR: 294131 Fixes: 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64 Reported by: Collin Funk <collin.funk1@gmail.com> Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D56515 (cherry picked from commit c8c9324c94dfd4eeecbcfe4a1d3daa047420d3e5) include/stdbit.h | 22 +++++++++++++++++++++- sys/sys/stdint.h | 3 +++ 2 files changed, 24 insertions(+), 1 deletion(-)
Thank you for your report.
Thanks for the quick fix! I'm not able to test it since I was using a shared machine, but the patch looks correct.