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
95159515 case ZigTypeIdVoid:
95169516 case ZigTypeIdUnreachable:
95179517 case ZigTypeIdBool:
9518 g->c_want_stdbool = true;
9519 return;
95189520 case ZigTypeIdInt:
9521 g->c_want_stdint = true;
9522 return;
95199523 case ZigTypeIdFloat:
95209524 return;
95219525 case ZigTypeIdOpaque:
......@@ -9596,7 +9600,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
95969600 break;
95979601 case ZigTypeIdBool:
95989602 buf_init_from_str(out_buf, "bool");
9599 g->c_want_stdbool = true;
96009603 break;
96019604 case ZigTypeIdUnreachable:
96029605 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
96209623 }
96219624 break;
96229625 case ZigTypeIdInt:
9623 g->c_want_stdint = true;
96249626 buf_resize(out_buf, 0);
96259627 buf_appendf(out_buf, "%sint%" PRIu32 "_t",
96269628 type_entry->data.integral.is_signed ? "" : "u",