authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-11-29 23:09:35-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-11-29 23:09:35-05:00
log210d0017c40ee24215ce705fcee342fe34b9dccb
treea558e09c2da78d3c506266adae7e378c76c0ce0f
parent7729f6cf4edd7c8eda935b1c7c8b4276d73b6e69

fix build broken by previous commit

now we report a compile error for unusual failures from translate-c

4 files changed, 7 insertions(+), 2 deletions(-)

src/error.cpp+1
......@@ -26,6 +26,7 @@ const char *err_str(int err) {
2626 case ErrorExactDivRemainder: return "exact division had a remainder";
2727 case ErrorNegativeDenominator: return "negative denominator";
2828 case ErrorShiftedOutOneBits: return "exact shift shifted out one bits";
29 case ErrorCCompileErrors: return "C compile errors";
2930 }
3031 return "(invalid error)";
3132}
src/error.hpp+1
......@@ -26,6 +26,7 @@ enum Error {
2626 ErrorExactDivRemainder,
2727 ErrorNegativeDenominator,
2828 ErrorShiftedOutOneBits,
29 ErrorCCompileErrors,
2930};
3031
3132const char *err_str(int err);
src/ir.cpp+4-1
......@@ -13870,7 +13870,10 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc
1387013870
1387113871 int err;
1387213872 if ((err = parse_h_buf(child_import, &errors, &cimport_scope->buf, ira->codegen, node))) {
13873 zig_panic("unable to parse C file: %s\n", err_str(err));
13873 if (err != ErrorCCompileErrors) {
13874 ir_add_error_node(ira, node, buf_sprintf("C import failed: %s", err_str(err)));
13875 return ira->codegen->builtin_types.entry_invalid;
13876 }
1387413877 }
1387513878
1387613879 if (errors.length > 0) {
src/translate_c.cpp+1-1
......@@ -4313,7 +4313,7 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch
43134313 }
43144314 }
43154315
4316 return ErrorUnexpected;
4316 return ErrorCCompileErrors;
43174317 }
43184318
43194319 c->ctx = &ast_unit->getASTContext();