authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-12-05 12:28:59-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-12-05 12:28:59-05:00
log74cea89fce2af41d2af7379ff526d7046c4d8d77
treeb5b3ad5965f5f9b61d00189dfae6b87f7387b7d6
parent5ebed1c9eeff6a190ff3d603bc6c680d4b920bd8

translate-c: fix not printing clang errors


1 files changed, 6 insertions(+), 5 deletions(-)

src/codegen.cpp+6-5
...@@ -5298,18 +5298,19 @@ void codegen_translate_c(CodeGen *g, Buf *full_path) {...@@ -5298,18 +5298,19 @@ void codegen_translate_c(CodeGen *g, Buf *full_path) {
52985298
5299 ZigList<ErrorMsg *> errors = {0};5299 ZigList<ErrorMsg *> errors = {0};
5300 int err = parse_h_file(import, &errors, buf_ptr(full_path), g, nullptr);5300 int err = parse_h_file(import, &errors, buf_ptr(full_path), g, nullptr);
5301 if (err) {
5302 fprintf(stderr, "unable to parse C file: %s\n", err_str(err));
5303 exit(1);
5304 }
53055301
5306 if (errors.length > 0) {5302 if (err == ErrorCCompileErrors && errors.length > 0) {
5307 for (size_t i = 0; i < errors.length; i += 1) {5303 for (size_t i = 0; i < errors.length; i += 1) {
5308 ErrorMsg *err_msg = errors.at(i);5304 ErrorMsg *err_msg = errors.at(i);
5309 print_err_msg(err_msg, g->err_color);5305 print_err_msg(err_msg, g->err_color);
5310 }5306 }
5311 exit(1);5307 exit(1);
5312 }5308 }
5309
5310 if (err) {
5311 fprintf(stderr, "unable to parse C file: %s\n", err_str(err));
5312 exit(1);
5313 }
5313}5314}
53145315
5315static ImportTableEntry *add_special_code(CodeGen *g, PackageTableEntry *package, const char *basename) {5316static ImportTableEntry *add_special_code(CodeGen *g, PackageTableEntry *package, const char *basename) {