aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorSahnvour <sahnvour@pm.me>2019-09-21 17:41:25 +0200
committerSahnvour <sahnvour@pm.me>2019-11-24 21:33:58 +0100
commit1bde3b68218ecc25bfcc5e2304399294f83a74d8 (patch)
treeab03a09e981ece6f122a695ea8576e9f20ae1790 /src/codegen.cpp
parent49156e398053a47875448d3da123a87645ff26b6 (diff)
downloadzig-1bde3b68218ecc25bfcc5e2304399294f83a74d8.tar.gz
zig-1bde3b68218ecc25bfcc5e2304399294f83a74d8.zip
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
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index d7a0a52360..8049c3e065 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -9515,7 +9515,11 @@ static void prepend_c_type_to_decl_list(CodeGen *g, GenH *gen_h, ZigType *type_e
case ZigTypeIdVoid:
case ZigTypeIdUnreachable:
case ZigTypeIdBool:
+ g->c_want_stdbool = true;
+ return;
case ZigTypeIdInt:
+ g->c_want_stdint = true;
+ return;
case ZigTypeIdFloat:
return;
case ZigTypeIdOpaque:
@@ -9596,7 +9600,6 @@ static void get_c_type(CodeGen *g, GenH *gen_h, ZigType *type_entry, Buf *out_bu
break;
case ZigTypeIdBool:
buf_init_from_str(out_buf, "bool");
- g->c_want_stdbool = true;
break;
case ZigTypeIdUnreachable:
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
}
break;
case ZigTypeIdInt:
- g->c_want_stdint = true;
buf_resize(out_buf, 0);
buf_appendf(out_buf, "%sint%" PRIu32 "_t",
type_entry->data.integral.is_signed ? "" : "u",