c bool support and c-integer coercion

This commit is contained in:
2026-06-25 17:53:04 +02:00
parent c08bc6d0cc
commit e0b6f6049c
10 changed files with 80 additions and 13 deletions
+8
View File
@@ -77,6 +77,7 @@ render_type :: proc(b: ^strings.Builder, result: ^cimport.Result, id: cimport.Ty
switch item.kind {
case .Invalid: strings.write_string(b, "void")
case .Void: strings.write_string(b, "void")
case .C_Bool: strings.write_string(b, "bool")
case .C_Char: strings.write_string(b, "c_char")
case .C_Schar: strings.write_string(b, "c_schar")
case .C_Uchar: strings.write_string(b, "c_uchar")
@@ -210,6 +211,13 @@ emit_macros :: proc(b: ^strings.Builder, result: ^cimport.Result, record_names:
wrote = true
continue
}
// A macro whose name collides with a brolang keyword (e.g. `true`/`false`
// from <stdbool.h>) can't be a binding name; emitting it is a parse error.
if lexer.keyword_kind(macro.name) != .Identifier {
fmt.sbprintf(b, "# unsupported in bindings: macro '%s' — name is a brolang keyword\n", macro.name)
wrote = true
continue
}
if macro.aggregate {
emit_aggregate_macro(b, result, macro, record_names)
wrote = true