Page MenuHomeFreeBSD

stddef.h: Update for C23
Needs ReviewPublic

Authored by minsoochoo0122_proton.me on Apr 7 2024, 3:09 AM.
Referenced Files
Unknown Object (File)
Fri, Oct 10, 1:25 PM
Unknown Object (File)
Sep 21 2025, 12:20 AM
Unknown Object (File)
Sep 13 2025, 9:38 AM
Unknown Object (File)
Sep 9 2025, 8:30 AM
Unknown Object (File)
Aug 16 2025, 11:05 AM
Unknown Object (File)
Aug 3 2025, 5:07 PM
Unknown Object (File)
Jul 30 2025, 1:57 AM
Unknown Object (File)
Jul 29 2025, 12:55 AM

Details

Reviewers
imp
Group Reviewers
Contributor Reviews (src)
Summary

unreachable() is now a macro for __unreachable.
nullptr_t is defined according to C23 draft.
NULL is now a macro for nullptr when -std=c23 or -std=gnu23

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 56950
Build 53838: arc lint + arc unit

Event Timeline

imp requested changes to this revision.Apr 7 2024, 3:41 AM
imp added inline comments.
include/stddef.h
37

yea, hate this construct. I don't really understand the point and in this case, it seems totally wrong.

This revision now requires changes to proceed.Apr 7 2024, 3:41 AM
include/stddef.h
37

yea, hate this construct. I don't really understand the point and in this case, it seems totally wrong.

C23 N3220 draft

This is a version test macro that tells the current implmented C standard version of a header file.

  • 7.1.2 (Standard Headers)
    • 6: Some standard headers define or declare identifiers that had not been present in previous versions of this document. To allow implementations and users to adapt to that situation, they also define a version macro for feature test of the form __STDC_VERSION_ XXXX_H__ which expands to 202311L, where XXXX is the all-caps spelling of the corresponding header <xxxx.h>.
include/stddef.h
37

yea, hate this construct. I don't really understand the point and in this case, it seems totally wrong.

C23 N3220 draft

This is a version test macro that tells the current implmented C standard version of a header file.

  • 7.1.2 (Standard Headers)
    • 6: Some standard headers define or declare identifiers that had not been present in previous versions of this document. To allow implementations and users to adapt to that situation, they also define a version macro for feature test of the form __STDC_VERSION_ XXXX_H__ which expands to 202311L, where XXXX is the all-caps spelling of the corresponding header <xxxx.h>.

Oh! That's different.
Maybe we could just use this as the guard #define then and eliminate _STDDEF_H_

Then I think this is ready to go.

sys/sys/_null.h
53

A question for the future: Do we need to provide a fallback for old-versions for nullptr_t in the future? This is needed by the standard, so the change stands on its own... more food for thought