Skip to content

Commit 74cea89

Browse files
committedDec 5, 2017
translate-c: fix not printing clang errors
·
0.15.10.2.0
1 parent 5ebed1c commit 74cea89

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed
 

‎src/codegen.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5298,18 +5298,19 @@ void codegen_translate_c(CodeGen *g, Buf *full_path) {
52985298

52995299
ZigList<ErrorMsg *> errors = {0};
53005300
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) {
53075303
for (size_t i = 0; i < errors.length; i += 1) {
53085304
ErrorMsg *err_msg = errors.at(i);
53095305
print_err_msg(err_msg, g->err_color);
53105306
}
53115307
exit(1);
53125308
}
5309+
5310+
if (err) {
5311+
fprintf(stderr, "unable to parse C file: %s\n", err_str(err));
5312+
exit(1);
5313+
}
53135314
}
53145315

53155316
static ImportTableEntry *add_special_code(CodeGen *g, PackageTableEntry *package, const char *basename) {

0 commit comments

Comments
 (0)
Please sign in to comment.