fix: add C23 compiler type stubs for local code generation
fix: add C23 compiler type stubs for local code generation
When running make generate on modern Linux toolchains (GCC 13/14+ and
glibc 2.35+), system headers introduce C23 keywords and 16-bit floating-point
types that cause modernc.org/cc/v4 (the C parser engine behind ccgo) to
fail during AST translation.
This change adds three preprocessor macro stubs to all ccgo task
invocations in generator.go:
-
-D_GCC_NULLPTR_T: Required by GCC's<stddef.h>. In GCC 13+,<stddef.h>definestypedef decltype(nullptr) nullptr_t;unless_GCC_NULLPTR_Tis defined. Becausecc/v4does not support C23decltype(nullptr), omitting this causes:stddef.h: syntax error: unexpected 'decltype'. -
-D_Float16=short: Required by glibc's<bits/floatn-common.h>(included via<math.h>), which declares IEEE 754 16-bit floating-point types (_Float16). Becausecc/v4lacks a built-in AST type specifier for_Float16, omitting this causes:floatn-common.h: undefined type: _Float16. -
-D__bf16=short: Required by glibc/GCC float headers (<bits/floatn.h>), which declare bfloat16 (__bf16) types. Becausecc/v4does not recognize__bf16as a valid type keyword, omitting this causes:floatn.h: undefined type: __bf16.
Related Merge Requests & Issues:
- Companion
libcfix required to link Windows targets and test fixtures without missing symbol errors: cznic/libc!32 - Main SQLite tracking issue: cznic/sqlite#255