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:

  1. -D_GCC_NULLPTR_T: Required by GCC's <stddef.h>. In GCC 13+, <stddef.h> defines typedef decltype(nullptr) nullptr_t; unless _GCC_NULLPTR_T is defined. Because cc/v4 does not support C23 decltype(nullptr), omitting this causes: stddef.h: syntax error: unexpected 'decltype'.

  2. -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). Because cc/v4 lacks a built-in AST type specifier for _Float16, omitting this causes: floatn-common.h: undefined type: _Float16.

  3. -D__bf16=short: Required by glibc/GCC float headers (<bits/floatn.h>), which declare bfloat16 (__bf16) types. Because cc/v4 does not recognize __bf16 as a valid type keyword, omitting this causes: floatn.h: undefined type: __bf16.


Related Merge Requests & Issues:

  • Companion libc fix required to link Windows targets and test fixtures without missing symbol errors: cznic/libc!32
  • Main SQLite tracking issue: cznic/sqlite#255

Merge request reports

Loading
Loading