authorgravatar for sahnvour@pm.meSahnvour <sahnvour@pm.me> 2019-09-21 17:41:25+02:00
committergravatar for sahnvour@pm.meSahnvour <sahnvour@pm.me> 2019-11-24 21:33:58+01:00
log1bde3b68218ecc25bfcc5e2304399294f83a74d8
treeab03a09e981ece6f122a695ea8576e9f20ae1790
parent49156e398053a47875448d3da123a87645ff26b6

gen-h: register the need for stdbool.h and stdint.h when exploring types recursively

otherwise they wouldn't be included when only a struct contains them

1 files changed, 4 insertions(+), 2 deletions(-)

src/codegen.cpp+4-2
...@@ -9515,7 +9515,11 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_e...@@ -9515,7 +9515,11 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_e
9515 case ZigTypeIdVoid:9515 case ZigTypeIdVoid:
9516 case ZigTypeIdUnreachable:9516 case ZigTypeIdUnreachable:
9517 case ZigTypeIdBool:9517 case ZigTypeIdBool:
9518 g->c_want_stdbool = true;
9519 return;
9518 case ZigTypeIdInt:9520 case ZigTypeIdInt:
9521 g->c_want_stdint = true;
9522 return;
9519 case ZigTypeIdFloat:9523 case ZigTypeIdFloat:
9520 return;9524 return;
9521 case ZigTypeIdOpaque:9525 case ZigTypeIdOpaque:
...@@ -9596,7 +9600,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu...@@ -9596,7 +9600,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
9596 break;9600 break;
9597 case ZigTypeIdBool:9601 case ZigTypeIdBool:
9598 buf_init_from_str(out_buf, "bool");9602 buf_init_from_str(out_buf, "bool");
9599 g->c_want_stdbool = true;
9600 break;9603 break;
9601 case ZigTypeIdUnreachable:9604 case ZigTypeIdUnreachable:
9602 buf_init_from_str(out_buf, "__attribute__((__noreturn__)) void");9605 buf_init_from_str(out_buf, "__attribute__((__noreturn__)) void");
...@@ -9620,7 +9623,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu...@@ -9620,7 +9623,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
9620 }9623 }
9621 break;9624 break;
9622 case ZigTypeIdInt:9625 case ZigTypeIdInt:
9623 g->c_want_stdint = true;
9624 buf_resize(out_buf, 0);9626 buf_resize(out_buf, 0);
9625 buf_appendf(out_buf, "%sint%" PRIu32 "_t",9627 buf_appendf(out_buf, "%sint%" PRIu32 "_t",
9626 type_entry->data.integral.is_signed ? "" : "u",9628 type_entry->data.integral.is_signed ? "" : "u",