Skip to content

Language.C.Parser.Lexer: accept C23 bool keyword #104

Open
sternenseemann wants to merge 2 commits intovisq:masterfrom
sternenseemann:c23-bools
Open

Language.C.Parser.Lexer: accept C23 bool keyword #104
sternenseemann wants to merge 2 commits intovisq:masterfrom
sternenseemann:c23-bools

Conversation

@sternenseemann
Copy link

@sternenseemann sternenseemann commented Jan 31, 2026

C23 makes bool a proper keyword and C preprocessors will no longer
expand it to _Bool which remains a valid alias. This is relatively
simple to support and unbreaks a lot of packages that use c2hs
with gcc 15 which defaults to -std=c23.

It fixes the build of all Hackage packages that use c2hs and break with GCC 15 (heystone, nfc, regex-rure, hd5-lite) except for avif which requires [[nodiscard]].

- This requires naming the int128 token correctly in tokenlist.txt.
- The #ifdef needs to be restored manually after generation,
  unfortunately.
- CTokFloatN 16 moves around, but stays within the #ifdef
- CTokBFloat16 moves around, but stays outside the #ifdef
C23 makes bool a proper keyword and C preprocessors will no longer
expand it to `_Bool` which remains a valid alias. This is relatively
simple to support and unbreaks a lot of packages that use c2hs
with gcc 15 which defaults to -std=c23.

Fixes build of Hackage packages hd5-lite, heystone, nfc, regex-rure.
@sternenseemann
Copy link
Author

enum-mode-2.i from the harness tests fails now. I would vote to change that test case, since the code in question is no longer valid C23, but maybe someone else should comment on this.

typedef enum _eq_bool bool;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant