exit(1) instead of abort() for file not found

This commit is contained in:
Andrew Kelley 2018-04-22 21:47:25 -04:00
parent 25dff91fa0
commit 75328e3204
3 changed files with 8 additions and 7 deletions

View File

@ -4306,7 +4306,8 @@ bool handle_is_ptr(TypeTableEntry *type_entry) {
static ZigWindowsSDK *get_windows_sdk(CodeGen *g) {
if (g->win_sdk == nullptr) {
if (os_find_windows_sdk(&g->win_sdk)) {
zig_panic("Unable to determine Windows SDK path.");
fprintf(stderr, "unable to determine windows sdk path\n");
exit(1);
}
}
assert(g->win_sdk != nullptr);
@ -4408,7 +4409,8 @@ void find_libc_include_path(CodeGen *g) {
ZigWindowsSDK *sdk = get_windows_sdk(g);
g->libc_include_dir = buf_alloc();
if (os_get_win32_ucrt_include_path(sdk, g->libc_include_dir)) {
zig_panic("Unable to determine libc include path.");
fprintf(stderr, "Unable to determine libc include path. --libc-include-dir");
exit(1);
}
} else if (g->zig_target.os == OsLinux) {
g->libc_include_dir = get_linux_libc_include_path();

View File

@ -6638,12 +6638,14 @@ static void gen_root_source(CodeGen *g) {
Buf *abs_full_path = buf_alloc();
int err;
if ((err = os_path_real(rel_full_path, abs_full_path))) {
zig_panic("unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
exit(1);
}
Buf *source_code = buf_alloc();
if ((err = os_fetch_file_path(rel_full_path, source_code, true))) {
zig_panic("unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
exit(1);
}
g->root_import = add_source_file(g, g->root_package, abs_full_path, source_code);

View File

@ -1334,9 +1334,6 @@ com_done:;
int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) {
#if defined(ZIG_OS_WINDOWS)
if (buf_len(&sdk->path10) == 0 || buf_len(&sdk->version10) == 0) {
return ErrorFileNotFound;
}
buf_resize(output_buf, 0);
buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10));
switch (platform_type) {