| author | |
| committer | |
| log | 210d0017c40ee24215ce705fcee342fe34b9dccb |
| tree | a558e09c2da78d3c506266adae7e378c76c0ce0f |
| parent | 7729f6cf4edd7c8eda935b1c7c8b4276d73b6e69 |
now we report a compile error for unusual failures from translate-c4 files changed, 7 insertions(+), 2 deletions(-)
src/error.cpp+1| ... | @@ -26,6 +26,7 @@ const char *err_str(int err) { | ... | @@ -26,6 +26,7 @@ const char *err_str(int err) { |
| 26 | case ErrorExactDivRemainder: return "exact division had a remainder"; | 26 | case ErrorExactDivRemainder: return "exact division had a remainder"; |
| 27 | case ErrorNegativeDenominator: return "negative denominator"; | 27 | case ErrorNegativeDenominator: return "negative denominator"; |
| 28 | case ErrorShiftedOutOneBits: return "exact shift shifted out one bits"; | 28 | case ErrorShiftedOutOneBits: return "exact shift shifted out one bits"; |
| 29 | case ErrorCCompileErrors: return "C compile errors"; | ||
| 29 | } | 30 | } |
| 30 | return "(invalid error)"; | 31 | return "(invalid error)"; |
| 31 | } | 32 | } |
src/error.hpp+1| ... | @@ -26,6 +26,7 @@ enum Error { | ... | @@ -26,6 +26,7 @@ enum Error { |
| 26 | ErrorExactDivRemainder, | 26 | ErrorExactDivRemainder, |
| 27 | ErrorNegativeDenominator, | 27 | ErrorNegativeDenominator, |
| 28 | ErrorShiftedOutOneBits, | 28 | ErrorShiftedOutOneBits, |
| 29 | ErrorCCompileErrors, | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | const char *err_str(int err); | 32 | const char *err_str(int err); |
src/ir.cpp+4-1| ... | @@ -13870,7 +13870,10 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc | ... | @@ -13870,7 +13870,10 @@ static TypeTableEntry *ir_analyze_instruction_c_import(IrAnalyze *ira, IrInstruc |
| 13870 | 13870 | ||
| 13871 | int err; | 13871 | int err; |
| 13872 | if ((err = parse_h_buf(child_import, &errors, &cimport_scope->buf, ira->codegen, node))) { | 13872 | 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 | } | ||
| 13874 | } | 13877 | } |
| 13875 | 13878 | ||
| 13876 | if (errors.length > 0) { | 13879 | 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 | ... | @@ -4313,7 +4313,7 @@ int parse_h_file(ImportTableEntry *import, ZigList<ErrorMsg *> *errors, const ch |
| 4313 | } | 4313 | } |
| 4314 | } | 4314 | } |
| 4315 | 4315 | ||
| 4316 | return ErrorUnexpected; | 4316 | return ErrorCCompileErrors; |
| 4317 | } | 4317 | } |
| 4318 | 4318 | ||
| 4319 | c->ctx = &ast_unit->getASTContext(); | 4319 | c->ctx = &ast_unit->getASTContext(); |