c bool support and c-integer coercion
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user