harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8e2320c31788f362a54e357e4c8c6dc179b09e97
parent 578149d3827f8f4077815af832f2ef6f5547ca28
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  2 Jan 2021 15:42:24 -0500

rt/compile: simplify following compiler updates

Diffstat:
Mrt/+linux/syscalls.ha | 2+-
Mrt/compile.ha | 14+++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha @@ -29,7 +29,7 @@ export fn execve( argv: uintptr: u64, envp: uintptr: u64): int; -export fn wait4(pid: int, status: *int, options: int, rusage: *void) void = +export fn wait4(pid: int, status: *int, options: int, rusage: nullable *void) void = syscall4(SYS_wait4, pid: u64, status: uintptr: u64, options: u64, rusage: uintptr: u64); diff --git a/rt/compile.ha b/rt/compile.ha @@ -1,9 +1,9 @@ // Runs the Hare compiler and returns the exit status. export fn compile(src: str) int = { + let status = 0; let pipefd = [-1, -1]; pipe2(&pipefd, 0); - let status: int = 0; const child = fork(); if (child == 0) { close(pipefd[1]); @@ -13,23 +13,23 @@ export fn compile(src: str) int = { // XXX: This could be simplified a lot with some compiler // improvements - let path = "./harec"; - let param = "-"; - let argv = [ + const path = "./harec"; + const param = "-"; + const argv = [ path: nullable *const char, param: nullable *const char, null: nullable *const char, ]; - let envp: [1]nullable *const char = [null: nullable *const char]; + const envp = [null: nullable *const char]; execve(path: *const char, &argv: *[*]nullable *const char, &envp: *[*]nullable *const char); abort(); } else { close(pipefd[0]); - write(pipefd[1], src: *const char: *void, len(src)); + write(pipefd[1], src: *const char, len(src)); close(pipefd[1]); - wait4(child, &status, 0, null: *void); + wait4(child, &status, 0, null); }; return wexitstatus(status);