Page MenuHomeFreeBSD

stdbool.h: Update for C23
Needs ReviewPublic

Authored by minsoochoo0122_proton.me on Apr 7 2024, 2:11 AM.
Referenced Files
Unknown Object (File)
Sun, Apr 28, 3:21 PM
Unknown Object (File)
Fri, Apr 26, 4:51 AM
Unknown Object (File)
Apr 16 2024, 4:16 PM
Unknown Object (File)
Apr 8 2024, 6:45 PM
Unknown Object (File)
Apr 7 2024, 12:28 PM

Details

Reviewers
imp
Group Reviewers
Contributor Reviews (src)
Summary

When a compiler with C23 or higher is detected, builtin bool, true,
and false are used to conform the C23 standard.

Diff Detail

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

Event Timeline

Add __STDC_VERSION_STDBOOL_H__ as the header file now conforms C23.

imp requested changes to this revision.Apr 7 2024, 3:38 AM
imp added inline comments.
include/stdbool.h
30

This doesn't match normal header practice.
I'd be tempted to just use #pragma once

48

Why?

This revision now requires changes to proceed.Apr 7 2024, 3:38 AM
include/stdbool.h
30

This doesn't match normal header practice.
I'd be tempted to just use #pragma once

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>.
48

Why?

I wanted to make sure that those are keywords in C23 and c++, but now it seems redundant. I'll remove them.