Skip to content

Commit

Permalink
Auto-generate the hostcalls module of wasi-common (#846)
Browse files Browse the repository at this point in the history
* Auto-generate shims for old `wasi_unstable` module

This commit is effectively just doing what #707 already did, but
applying it to the `snapshot_0` module as well. The end result is the
same, where we cut down on all the boilerplate in `snapshot_0` and bring
it in line with the main `wasi_snapshot_preview1` implementation. The
goal here is to make it easier to change the two in tandem since they're
both doing the same thing.

* Migrate `wasi_common::hostcalls` to a macro

This commit migrates the `hostcalls` module to being auto-generated by a
macro rather than duplicating a handwritten signature for each wasi
syscall.

* Auto-generate snapshot_0's `hostcalls` module

Similar to the previous commit, but for `snapshot_0`

* Delete the `wasi-common-cbindgen` crate

This is no longer needed with the hostcalls macro now, we can easily
fold the definition of the cbindgen macro into the same crate.

* Rustfmt

* Fix windows build errors

* Rustfmt

* Remove now no-longer-necessary code

* rustfmt
  • Loading branch information
alexcrichton committed Jan 22, 2020
1 parent 5d7635c commit 5953215
Show file tree
Hide file tree
Showing 44 changed files with 391 additions and 2,742 deletions.
31 changes: 4 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/wasi-common/Cargo.toml
Expand Up @@ -11,7 +11,6 @@ readme = "README.md"
edition = "2018"

[dependencies]
wasi-common-cbindgen = { path = "wasi-common-cbindgen", version = "0.9.0" }
anyhow = "1.0"
thiserror = "1.0"
libc = "0.2"
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-common/src/fs/dir.rs
@@ -1,4 +1,4 @@
use crate::fs::{error::wasi_errno_to_io_error, File, OpenOptions, ReadDir};
use crate::fs::{File, OpenOptions, ReadDir};
use crate::{host, hostcalls, wasi, WasiCtx};
#[cfg(unix)]
use std::os::unix::ffi::OsStrExt;
Expand Down
265 changes: 0 additions & 265 deletions crates/wasi-common/src/fs/error.rs

This file was deleted.

0 comments on commit 5953215

Please sign in to comment.