mirror of
https://github.com/ziglang/zig.git
synced 2025-12-24 23:23:07 +00:00
fix build broken by previous commit
now we report a compile error for unusual failures from translate-c
This commit is contained in:
parent
7729f6cf4e
commit
210d0017c4
@ -26,6 +26,7 @@ const char *err_str(int err) {
|
||||
case ErrorExactDivRemainder: return "exact division had a remainder";
|
||||
case ErrorNegativeDenominator: return "negative denominator";
|
||||
case ErrorShiftedOutOneBits: return "exact shift shifted out one bits";
|
||||
case ErrorCCompileErrors: return "C compile errors";
|
||||
}
|
||||
return "(invalid error)";
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ enum Error {
|
||||
ErrorExactDivRemainder,
|
||||
ErrorNegativeDenominator,
|
||||
ErrorShiftedOutOneBits,
|
||||
ErrorCCompileErrors,
|
||||
};
|
||||
|
||||
const char *err_str(int err);
|
||||
|
||||
@ -13870,7 +13870,10 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc
|
||||
|
||||
int err;
|
||||
if ((err = parse_h_buf(child_import, &errors, &cimport_scope->buf, ira->codegen, node))) {
|
||||
zig_panic("unable to parse C file: %s\n", err_str(err));
|
||||
if (err != ErrorCCompileErrors) {
|
||||
ir_add_error_node(ira, node, buf_sprintf("C import failed: %s", err_str(err)));
|
||||
return ira->codegen->builtin_types.entry_invalid;
|
||||
}
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
|
||||
@ -4313,7 +4313,7 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch
|
||||
}
|
||||
}
|
||||
|
||||
return ErrorUnexpected;
|
||||
return ErrorCCompileErrors;
|
||||
}
|
||||
|
||||
c->ctx = &ast_unit->getASTContext();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user