corrode
corrode copied to clipboard
C to Rust translator
``` ➜ corrode git:(master) cabal install Resolving dependencies... cabal: Could not resolve dependencies: trying: corrode-0.1.0.0 (user goal) next goal: base (dependency of corrode-0.1.0.0) rejecting: base-4.7.0.2/installed-cb2... (conflict: corrode => base>=4.8) rejecting:...
While compiling lmdb: ``` :0:1: warning: undefining "__LINE__" ("mtest.c": line 24): Corrode doesn't handle this yet: * argv[] ``` The following change to the C source fixes the issue: ```patch...
I just tried transpiling afl-fuzz and saw that: ``` root@3c642805f62f:/corrode# stack exec -- corrode afl-2.35b/afl-fuzz.c -DBIN_PATH=\"/usr/local/bin\" e:0:1: warning: undefining "__LINE__" c("afl-2.35b/afl-fuzz.c": line 134): Corrode doesn't handle this yet: virgin_bits[1
This pattern is used in my `` (OS X 10.11, clang 8.0.0 (clang-800.0.38)) ```c void test() { union { float a; unsigned int b; } c; c.a = 0; }...
Consider this program: ```c static int x; static void f(void) { x = 1; } void g(void) { char *x; f(); } ``` Because `f` is `static`, Corrode defers translating...
In Rust, when a static variable is in scope, its name must not be used in the pattern that binds a function parameter or let-bound variable. So in this example,...
The first issues that I've run into on macOS are from system headers and I've worked around them by doing: ``` corrode ... -D_Nonnull="/**/" -D_Nullable="/**/" ``` This was actually fixed...
Right now, Corrode translates C pointer types to `*const T` or `*mut T` (the raw pointer types) or `unsafe extern fn(...)` (for function pointers). This has some issues around null...
The `CAsm` constructor of [`CStatement`](http://hackage.haskell.org/package/language-c-0.5.0/docs/Language-C-Syntax-AST.html#t:CStatement), and the [`CAssemblyStatement`](http://hackage.haskell.org/package/language-c-0.5.0/docs/Language-C-Syntax-AST.html#t:CAssemblyStatement) it contains, are _almost_ easy to translate to Rust's [`asm!`](https://doc.rust-lang.org/book/inline-assembly.html) macro. At a high level, both syntaxes deliberately have the same semantics:...
Consider C's `assert.h`, which defines a macro named `assert`. Since Corrode runs the C preprocessor before parsing the input, either the assert macro is expanded to some ugly expression, or...