diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-12-05 12:28:59 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-12-05 12:28:59 -0500 |
| commit | 74cea89fce2af41d2af7379ff526d7046c4d8d77 (patch) | |
| tree | b5b3ad5965f5f9b61d00189dfae6b87f7387b7d6 /src/codegen.cpp | |
| parent | 5ebed1c9eeff6a190ff3d603bc6c680d4b920bd8 (diff) | |
| download | zig-74cea89fce2af41d2af7379ff526d7046c4d8d77.tar.gz zig-74cea89fce2af41d2af7379ff526d7046c4d8d77.zip | |
translate-c: fix not printing clang errors
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index f84636502d..35974a73dd 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -5298,18 +5298,19 @@ void codegen_translate_c(CodeGen *g, Buf *full_path) { ZigList<ErrorMsg *> errors = {0}; int err = parse_h_file(import, &errors, buf_ptr(full_path), g, nullptr); - if (err) { - fprintf(stderr, "unable to parse C file: %s\n", err_str(err)); - exit(1); - } - if (errors.length > 0) { + if (err == ErrorCCompileErrors && errors.length > 0) { for (size_t i = 0; i < errors.length; i += 1) { ErrorMsg *err_msg = errors.at(i); print_err_msg(err_msg, g->err_color); } exit(1); } + + if (err) { + fprintf(stderr, "unable to parse C file: %s\n", err_str(err)); + exit(1); + } } static ImportTableEntry *add_special_code(CodeGen *g, PackageTableEntry *package, const char *basename) { |
