mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Replace gb_exit(1) with exit_with_errors() where appropriate
This commit is contained in:
+2
-2
@@ -1204,7 +1204,7 @@ gb_internal void init_universal(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (defined_values_double_declaration) {
|
if (defined_values_double_declaration) {
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4504,7 +4504,7 @@ gb_internal void add_import_dependency_node(Checker *c, Ast *decl, PtrMap<AstPac
|
|||||||
if (found == nullptr) {
|
if (found == nullptr) {
|
||||||
Token token = ast_token(decl);
|
Token token = ast_token(decl);
|
||||||
error(token, "Unable to find package: %.*s", LIT(path));
|
error(token, "Unable to find package: %.*s", LIT(path));
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
AstPackage *pkg = *found;
|
AstPackage *pkg = *found;
|
||||||
GB_ASSERT(pkg->scope != nullptr);
|
GB_ASSERT(pkg->scope != nullptr);
|
||||||
|
|||||||
+1
-1
@@ -1170,7 +1170,7 @@ gb_internal void odin_doc_write_to_file(OdinDocWriter *w, char const *filename)
|
|||||||
gbFileError err = gb_file_open_mode(&f, gbFileMode_Write, filename);
|
gbFileError err = gb_file_open_mode(&f, gbFileMode_Write, filename);
|
||||||
if (err != gbFileError_None) {
|
if (err != gbFileError_None) {
|
||||||
gb_printf_err("Failed to write .odin-doc to: %s\n", filename);
|
gb_printf_err("Failed to write .odin-doc to: %s\n", filename);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
defer (gb_file_close(&f));
|
defer (gb_file_close(&f));
|
||||||
|
|||||||
@@ -613,6 +613,10 @@ gb_internal void compiler_error(char const *fmt, ...) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gb_internal void exit_with_errors(void) {
|
||||||
|
print_all_errors();
|
||||||
|
gb_exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1350,7 +1350,7 @@ gb_internal WORKER_TASK_PROC(lb_llvm_emit_worker_proc) {
|
|||||||
|
|
||||||
if (LLVMTargetMachineEmitToFile(wd->target_machine, wd->m->mod, cast(char *)wd->filepath_obj.text, wd->code_gen_file_type, &llvm_error)) {
|
if (LLVMTargetMachineEmitToFile(wd->target_machine, wd->m->mod, cast(char *)wd->filepath_obj.text, wd->code_gen_file_type, &llvm_error)) {
|
||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
debugf("Generated File: %.*s\n", LIT(wd->filepath_obj));
|
debugf("Generated File: %.*s\n", LIT(wd->filepath_obj));
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1919,7 +1919,7 @@ verify
|
|||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2104,11 +2104,11 @@ gb_internal WORKER_TASK_PROC(lb_llvm_module_verification_worker_proc) {
|
|||||||
String filepath_ll = lb_filepath_ll_for_module(m);
|
String filepath_ll = lb_filepath_ll_for_module(m);
|
||||||
if (LLVMPrintModuleToFile(m->mod, cast(char const *)filepath_ll.text, &llvm_error)) {
|
if (LLVMPrintModuleToFile(m->mod, cast(char const *)filepath_ll.text, &llvm_error)) {
|
||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2193,7 +2193,7 @@ gb_internal bool lb_llvm_object_generation(lbGenerator *gen, bool do_threading)
|
|||||||
|
|
||||||
if (LLVMTargetMachineEmitToFile(m->target_machine, m->mod, cast(char *)filepath_obj.text, code_gen_file_type, &llvm_error)) {
|
if (LLVMTargetMachineEmitToFile(m->target_machine, m->mod, cast(char *)filepath_obj.text, code_gen_file_type, &llvm_error)) {
|
||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
debugf("Generated File: %.*s\n", LIT(filepath_obj));
|
debugf("Generated File: %.*s\n", LIT(filepath_obj));
|
||||||
@@ -2393,7 +2393,7 @@ gb_internal void lb_generate_procedure(lbModule *m, lbProcedure *p) {
|
|||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
}
|
}
|
||||||
LLVMVerifyFunction(p->value, LLVMPrintMessageAction);
|
LLVMVerifyFunction(p->value, LLVMPrintMessageAction);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2962,7 +2962,7 @@ gb_internal bool lb_generate_code(lbGenerator *gen) {
|
|||||||
String filepath_ll = lb_filepath_ll_for_module(m);
|
String filepath_ll = lb_filepath_ll_for_module(m);
|
||||||
if (LLVMPrintModuleToFile(m->mod, cast(char const *)filepath_ll.text, &llvm_error)) {
|
if (LLVMPrintModuleToFile(m->mod, cast(char const *)filepath_ll.text, &llvm_error)) {
|
||||||
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
gb_printf_err("LLVM Error: %s\n", llvm_error);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
array_add(&gen->output_temp_paths, filepath_ll);
|
array_add(&gen->output_temp_paths, filepath_ll);
|
||||||
|
|||||||
+1
-1
@@ -1404,7 +1404,7 @@ gb_internal void timings_export_all(Timings *t, Checker *c, bool timings_are_fin
|
|||||||
gbFileError err = gb_file_open_mode(&f, gbFileMode_Write, fileName);
|
gbFileError err = gb_file_open_mode(&f, gbFileMode_Write, fileName);
|
||||||
if (err != gbFileError_None) {
|
if (err != gbFileError_None) {
|
||||||
gb_printf_err("Failed to export timings to: %s\n", fileName);
|
gb_printf_err("Failed to export timings to: %s\n", fileName);
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
gb_printf("\nExporting timings to '%s'... ", fileName);
|
gb_printf("\nExporting timings to '%s'... ", fileName);
|
||||||
|
|||||||
+2
-2
@@ -1484,7 +1484,7 @@ gb_internal Token expect_token(AstFile *f, TokenKind kind) {
|
|||||||
String p = token_to_string(prev);
|
String p = token_to_string(prev);
|
||||||
syntax_error(f->curr_token, "Expected '%.*s', got '%.*s'", LIT(c), LIT(p));
|
syntax_error(f->curr_token, "Expected '%.*s', got '%.*s'", LIT(c), LIT(p));
|
||||||
if (prev.kind == Token_EOF) {
|
if (prev.kind == Token_EOF) {
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6177,7 +6177,7 @@ gb_internal ParseFileError process_imported_file(Parser *p, ImportedFile importe
|
|||||||
if (err == ParseFile_EmptyFile) {
|
if (err == ParseFile_EmptyFile) {
|
||||||
if (fi.fullpath == p->init_fullpath) {
|
if (fi.fullpath == p->init_fullpath) {
|
||||||
syntax_error(pos, "Initial file is empty - %.*s\n", LIT(p->init_fullpath));
|
syntax_error(pos, "Initial file is empty - %.*s\n", LIT(p->init_fullpath));
|
||||||
gb_exit(1);
|
exit_with_errors();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user