gingerBill 3 years ago
parent
commit
2908923db9
3 changed files with 6 additions and 5 deletions
  1. 2 2
      core/slice/slice.odin
  2. 2 2
      core/sys/unix/syscalls_linux.odin
  3. 2 1
      src/check_builtin.cpp

+ 2 - 2
core/slice/slice.odin

@@ -14,14 +14,14 @@ _ :: mem
 	Turn a pointer and a length into a slice.
 	Turn a pointer and a length into a slice.
 */
 */
 from_ptr :: proc "contextless" (ptr: ^$T, count: int) -> []T {
 from_ptr :: proc "contextless" (ptr: ^$T, count: int) -> []T {
-    return ([^]T)(ptr)[:count]
+	return ([^]T)(ptr)[:count]
 }
 }
 
 
 /*
 /*
 	Turn a pointer and a length into a byte slice.
 	Turn a pointer and a length into a byte slice.
 */
 */
 bytes_from_ptr :: proc "contextless" (ptr: rawptr, byte_count: int) -> []byte {
 bytes_from_ptr :: proc "contextless" (ptr: rawptr, byte_count: int) -> []byte {
-    return ([^]byte)(ptr)[:byte_count]
+	return ([^]byte)(ptr)[:byte_count]
 }
 }
 
 
 /*
 /*

+ 2 - 2
core/sys/unix/syscalls_linux.odin

@@ -1568,7 +1568,7 @@ sys_gettid :: proc "contextless" () -> int {
 }
 }
 
 
 sys_getrandom :: proc "contextless" (buf: [^]byte, buflen: int, flags: uint) -> int {
 sys_getrandom :: proc "contextless" (buf: [^]byte, buflen: int, flags: uint) -> int {
-	return cast(int)intrinsics.syscall(SYS_getrandom, buf, cast(uintptr)(buflen), cast(uintptr)(flags))
+	return cast(int)intrinsics.syscall(SYS_getrandom, uintptr(buf), uintptr(buflen), uintptr(flags))
 }
 }
 
 
 sys_open :: proc "contextless" (path: cstring, flags: int, mode: int = 0o000) -> int {
 sys_open :: proc "contextless" (path: cstring, flags: int, mode: int = 0o000) -> int {
@@ -1748,7 +1748,7 @@ sys_unlink :: proc "contextless" (path: cstring) -> int {
 }
 }
 
 
 sys_unlinkat :: proc "contextless" (dfd: int, path: cstring, flag: int = 0) -> int {
 sys_unlinkat :: proc "contextless" (dfd: int, path: cstring, flag: int = 0) -> int {
-	return int(intrinsics.syscall(SYS_unlinkat, uintptr(dfd), uintptr(rawptr(path)), flag))
+	return int(intrinsics.syscall(SYS_unlinkat, uintptr(dfd), uintptr(rawptr(path)), uintptr(flag)))
 }
 }
 
 
 sys_rmdir :: proc "contextless" (path: cstring) -> int {
 sys_rmdir :: proc "contextless" (path: cstring) -> int {

+ 2 - 1
src/check_builtin.cpp

@@ -4523,7 +4523,8 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32
 				if (x.mode != Addressing_Invalid) {
 				if (x.mode != Addressing_Invalid) {
 					convert_to_typed(c, &x, t_uintptr);	
 					convert_to_typed(c, &x, t_uintptr);	
 				}
 				}
-				if (!is_type_uintptr(operand->type)) {
+				convert_to_typed(c, &x, t_uintptr);
+				if (!is_type_uintptr(x.type)) {
 					gbString t = type_to_string(x.type);
 					gbString t = type_to_string(x.type);
 					error(x.expr, "Argument %td must be of type 'uintptr', got %s", i, t);
 					error(x.expr, "Argument %td must be of type 'uintptr', got %s", i, t);
 					gb_string_free(t);
 					gb_string_free(t);