authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 21:47:25-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 21:47:25-04:00
log75328e32045d1275c03f1f37058ee0a3b775c632
tree786ecef4dad2079fd29a0deb4ba4fc42c216e0d3
parent25dff91fa099489858428a7071b8c76acf1f943d

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


3 files changed, 8 insertions(+), 7 deletions(-)

src/analyze.cpp+4-2
...@@ -4306,7 +4306,8 @@ bool handle_is_ptr(TypeTableEntry *type_entry) {...@@ -4306,7 +4306,8 @@ bool handle_is_ptr(TypeTableEntry *type_entry) {
4306static ZigWindowsSDK *get_windows_sdk(CodeGen *g) {4306static ZigWindowsSDK *get_windows_sdk(CodeGen *g) {
4307 if (g->win_sdk == nullptr) {4307 if (g->win_sdk == nullptr) {
4308 if (os_find_windows_sdk(&g->win_sdk)) {4308 if (os_find_windows_sdk(&g->win_sdk)) {
4309 zig_panic("Unable to determine Windows SDK path.");4309 fprintf(stderr, "unable to determine windows sdk path\n");
4310 exit(1);
4310 }4311 }
4311 }4312 }
4312 assert(g->win_sdk != nullptr);4313 assert(g->win_sdk != nullptr);
...@@ -4408,7 +4409,8 @@ void find_libc_include_path(CodeGen *g) {...@@ -4408,7 +4409,8 @@ void find_libc_include_path(CodeGen *g) {
4408 ZigWindowsSDK *sdk = get_windows_sdk(g);4409 ZigWindowsSDK *sdk = get_windows_sdk(g);
4409 g->libc_include_dir = buf_alloc();4410 g->libc_include_dir = buf_alloc();
4410 if (os_get_win32_ucrt_include_path(sdk, g->libc_include_dir)) {4411 if (os_get_win32_ucrt_include_path(sdk, g->libc_include_dir)) {
4411 zig_panic("Unable to determine libc include path.");4412 fprintf(stderr, "Unable to determine libc include path. --libc-include-dir");
4413 exit(1);
4412 }4414 }
4413 } else if (g->zig_target.os == OsLinux) {4415 } else if (g->zig_target.os == OsLinux) {
4414 g->libc_include_dir = get_linux_libc_include_path();4416 g->libc_include_dir = get_linux_libc_include_path();
src/codegen.cpp+4-2
...@@ -6638,12 +6638,14 @@ static void gen_root_source(CodeGen *g) {...@@ -6638,12 +6638,14 @@ static void gen_root_source(CodeGen *g) {
6638 Buf *abs_full_path = buf_alloc();6638 Buf *abs_full_path = buf_alloc();
6639 int err;6639 int err;
6640 if ((err = os_path_real(rel_full_path, abs_full_path))) {6640 if ((err = os_path_real(rel_full_path, abs_full_path))) {
6641 zig_panic("unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));6641 fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
6642 exit(1);
6642 }6643 }
66436644
6644 Buf *source_code = buf_alloc();6645 Buf *source_code = buf_alloc();
6645 if ((err = os_fetch_file_path(rel_full_path, source_code, true))) {6646 if ((err = os_fetch_file_path(rel_full_path, source_code, true))) {
6646 zig_panic("unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));6647 fprintf(stderr, "unable to open '%s': %s", buf_ptr(rel_full_path), err_str(err));
6648 exit(1);
6647 }6649 }
66486650
6649 g->root_import = add_source_file(g, g->root_package, abs_full_path, source_code);6651 g->root_import = add_source_file(g, g->root_package, abs_full_path, source_code);
src/os.cpp-3
...@@ -1334,9 +1334,6 @@ com_done:;...@@ -1334,9 +1334,6 @@ com_done:;
13341334
1335int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) {1335int os_get_win32_ucrt_lib_path(ZigWindowsSDK *sdk, Buf* output_buf, ZigLLVM_ArchType platform_type) {
1336#if defined(ZIG_OS_WINDOWS)1336#if defined(ZIG_OS_WINDOWS)
1337 if (buf_len(&sdk->path10) == 0 || buf_len(&sdk->version10) == 0) {
1338 return ErrorFileNotFound;
1339 }
1340 buf_resize(output_buf, 0);1337 buf_resize(output_buf, 0);
1341 buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10));1338 buf_appendf(output_buf, "%s\\Lib\\%s\\ucrt\\", buf_ptr(&sdk->path10), buf_ptr(&sdk->version10));
1342 switch (platform_type) {1339 switch (platform_type) {