From 1d75a612d54f102ef530c1f58546e3cdb239160c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 4 Aug 2024 11:47:23 +0100 Subject: [PATCH] `os.Errno` -> `os.Error` --- core/flags/errors.odin | 2 +- core/flags/internal_rtti.odin | 2 +- core/path/filepath/path_windows.odin | 2 +- core/path/filepath/walk.odin | 10 +++++----- core/prof/spall/spall.odin | 2 +- core/prof/spall/spall_linux.odin | 4 ++-- core/prof/spall/spall_unix.odin | 4 ++-- core/prof/spall/spall_windows.odin | 2 +- src/check_expr.cpp | 1 + 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/core/flags/errors.odin b/core/flags/errors.odin index 21ea05477..6e48f6ccf 100644 --- a/core/flags/errors.odin +++ b/core/flags/errors.odin @@ -28,7 +28,7 @@ Parse_Error :: struct { // Provides more granular information than what just a string could hold. Open_File_Error :: struct { filename: string, - errno: os.Errno, + errno: os.Error, mode: int, perms: int, } diff --git a/core/flags/internal_rtti.odin b/core/flags/internal_rtti.odin index ac39eaa8b..8838b771d 100644 --- a/core/flags/internal_rtti.odin +++ b/core/flags/internal_rtti.odin @@ -255,7 +255,7 @@ parse_and_set_pointer_by_named_type :: proc(ptr: rawptr, str: string, data_type: handle, errno := os.open(str, mode, perms) if errno != 0 { - // NOTE(Feoramund): os.Errno is system-dependent, and there's + // NOTE(Feoramund): os.Error is system-dependent, and there's // currently no good way to translate them all into strings. // // The upcoming `os2` package will hopefully solve this. diff --git a/core/path/filepath/path_windows.odin b/core/path/filepath/path_windows.odin index ae26e1394..6a9ac9dee 100644 --- a/core/path/filepath/path_windows.odin +++ b/core/path/filepath/path_windows.odin @@ -52,7 +52,7 @@ is_abs :: proc(path: string) -> bool { @(private) -temp_full_path :: proc(name: string) -> (path: string, err: os.Errno) { +temp_full_path :: proc(name: string) -> (path: string, err: os.Error) { ta := context.temp_allocator name := name diff --git a/core/path/filepath/walk.odin b/core/path/filepath/walk.odin index 9ba3165dc..9fd4c455f 100644 --- a/core/path/filepath/walk.odin +++ b/core/path/filepath/walk.odin @@ -14,7 +14,7 @@ import "core:slice" // The sole exception is if 'skip_dir' is returned as true: // when 'skip_dir' is invoked on a directory. 'walk' skips directory contents // when 'skip_dir' is invoked on a non-directory. 'walk' skips the remaining files in the containing directory -Walk_Proc :: #type proc(info: os.File_Info, in_err: os.Errno, user_data: rawptr) -> (err: os.Errno, skip_dir: bool) +Walk_Proc :: #type proc(info: os.File_Info, in_err: os.Error, user_data: rawptr) -> (err: os.Error, skip_dir: bool) // walk walks the file tree rooted at 'root', calling 'walk_proc' for each file or directory in the tree, including 'root' // All errors that happen visiting files and directories are filtered by walk_proc @@ -22,7 +22,7 @@ Walk_Proc :: #type proc(info: os.File_Info, in_err: os.Errno, user_data: rawptr) // NOTE: Walking large directories can be inefficient due to the lexical sort // NOTE: walk does not follow symbolic links // NOTE: os.File_Info uses the 'context.temp_allocator' to allocate, and will delete when it is done -walk :: proc(root: string, walk_proc: Walk_Proc, user_data: rawptr) -> os.Errno { +walk :: proc(root: string, walk_proc: Walk_Proc, user_data: rawptr) -> os.Error { info, err := os.lstat(root, context.temp_allocator) defer os.file_info_delete(info, context.temp_allocator) @@ -37,7 +37,7 @@ walk :: proc(root: string, walk_proc: Walk_Proc, user_data: rawptr) -> os.Errno @(private) -_walk :: proc(info: os.File_Info, walk_proc: Walk_Proc, user_data: rawptr) -> (err: os.Errno, skip_dir: bool) { +_walk :: proc(info: os.File_Info, walk_proc: Walk_Proc, user_data: rawptr) -> (err: os.Error, skip_dir: bool) { if !info.is_dir { if info.fullpath == "" && info.name == "" { // ignore empty things @@ -47,7 +47,7 @@ _walk :: proc(info: os.File_Info, walk_proc: Walk_Proc, user_data: rawptr) -> (e } fis: []os.File_Info - err1: os.Errno + err1: os.Error fis, err = read_dir(info.fullpath, context.temp_allocator) defer os.file_info_slice_delete(fis, context.temp_allocator) @@ -70,7 +70,7 @@ _walk :: proc(info: os.File_Info, walk_proc: Walk_Proc, user_data: rawptr) -> (e } @(private) -read_dir :: proc(dir_name: string, allocator := context.temp_allocator) -> ([]os.File_Info, os.Errno) { +read_dir :: proc(dir_name: string, allocator := context.temp_allocator) -> ([]os.File_Info, os.Error) { f, err := os.open(dir_name, os.O_RDONLY) if err != 0 { return nil, err diff --git a/core/prof/spall/spall.odin b/core/prof/spall/spall.odin index a6fc59e74..38c563248 100644 --- a/core/prof/spall/spall.odin +++ b/core/prof/spall/spall.odin @@ -227,7 +227,7 @@ _buffer_end :: proc "contextless" (ctx: ^Context, buffer: ^Buffer) #no_bounds_ch } @(no_instrumentation) -write :: proc "contextless" (fd: os.Handle, buf: []byte) -> (n: int, err: os.Errno) { +write :: proc "contextless" (fd: os.Handle, buf: []byte) -> (n: int, err: os.Error) { return _write(fd, buf) } diff --git a/core/prof/spall/spall_linux.odin b/core/prof/spall/spall_linux.odin index 3f475c5e0..deee15aa1 100644 --- a/core/prof/spall/spall_linux.odin +++ b/core/prof/spall/spall_linux.odin @@ -10,7 +10,7 @@ import "core:sys/linux" MAX_RW :: 0x7fffffff @(no_instrumentation) -_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.Errno) #no_bounds_check /* bounds check would segfault instrumentation */ { +_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.Error) #no_bounds_check /* bounds check would segfault instrumentation */ { if len(data) == 0 { return 0, os.ERROR_NONE } @@ -19,7 +19,7 @@ _write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.E chunk := data[:min(len(data), MAX_RW)] written, errno := linux.write(linux.Fd(fd), chunk) if errno != .NONE { - return n, os.Errno(errno) + return n, os.Error(errno) } n += written } diff --git a/core/prof/spall/spall_unix.odin b/core/prof/spall/spall_unix.odin index e6ba7ecde..6da57ee95 100644 --- a/core/prof/spall/spall_unix.odin +++ b/core/prof/spall/spall_unix.odin @@ -30,7 +30,7 @@ get_last_error :: proc "contextless" () -> os.Platform_Error { MAX_RW :: 0x7fffffff @(no_instrumentation) -_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.Errno) #no_bounds_check /* bounds check would segfault instrumentation */ { +_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.Error) #no_bounds_check /* bounds check would segfault instrumentation */ { if len(data) == 0 { return 0, os.ERROR_NONE } @@ -39,7 +39,7 @@ _write :: proc "contextless" (fd: os.Handle, data: []byte) -> (n: int, err: os.E chunk := data[:min(len(data), MAX_RW)] written := _unix_write(fd, raw_data(chunk), len(chunk)) if written < 0 { - return n, os.Errno(get_last_error()) + return n, os.Error(get_last_error()) } n += written } diff --git a/core/prof/spall/spall_windows.odin b/core/prof/spall/spall_windows.odin index a55c42852..105a61891 100644 --- a/core/prof/spall/spall_windows.odin +++ b/core/prof/spall/spall_windows.odin @@ -10,7 +10,7 @@ import win32 "core:sys/windows" MAX_RW :: 1<<30 @(no_instrumentation) -_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (int, os.Errno) #no_bounds_check /* bounds check would segfault instrumentation */ { +_write :: proc "contextless" (fd: os.Handle, data: []byte) -> (int, os.Error) #no_bounds_check /* bounds check would segfault instrumentation */ { if len(data) == 0 { return 0, os.ERROR_NONE } diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 9df3c7076..9efd16af4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -4463,6 +4463,7 @@ gb_internal void convert_to_typed(CheckerContext *c, Operand *operand, Type *tar // as a kind of transition period if (operand->mode == Addressing_Constant && target_type->kind == Type_Named && + (c->pkg == nullptr || c->pkg->name != "os") && target_type->Named.name == "Error") { Entity *e = target_type->Named.type_name; if (e->pkg && e->pkg->name == "os") {