Comments (2)
Yes, I want this. 😄
I've been wondering: can the intermediate form you mention just be Rust source code? It's hardly efficient to have to re-parse the text, but I hope nobody will replace their regular compiler with Corrode, so I don't think we should worry much about runtime efficiency.
And to what extent do we need any cross-module analysis to get the translation to work? We'll definitely need cross-module analysis to make the generated code properly follow Rust idioms, but I'm deferring that problem to a later tool. I'm guessing that with everything marked #[no_mangle]
, cross-module references to functions and global variables should work fine; and although type definitions will be duplicated in every module that uses them, that should still lead to correct code being generated.
Regarding inline
in particular: it's just a performance hint, not a requirement for correctness. We can do some conservative translation that ensures the function is callable everywhere it's supposed to be, without guaranteeing that it will be inlined everywhere GCC would have inlined it, if that makes the translation feasible.
from corrode.
The difficulty with inline
isn't making sure it's callable; it's making sure that the symbols don't collide when you have multiple definitions, not merely multiple declarations.
Similarly, that implies that Rust would be a poor intermediate form, because it would lose some of those distinctions.
Or in other words, the difference between Rust's #[inline]
and C's inline
is that C's inline
is a requirement for correctness at link time.
from corrode.
Related Issues (20)
- exit() not declared as noreturn
- Fails on global uninitialised structs HOT 2
- box, true and false are not renamed HOT 2
- Wrong code generation when using the zero variant of an enum in `if` clauses
- Use of possibly uninitialized reference(s)
- C volatile pointers do not translate to rust volatile accesses
- enums should derive Debug, PartialOrd & PartialEq?
- Arrays without explicit size
- Math on enums generates invalid Rust
- Using corrode with cmake HOT 2
- Support for C bitfields HOT 1
- Corrode has trouble with "implicit ints" in K&R style HOT 2
- Use the libc crate to provide external functions and c-like types
- Attempt to initialize static enums
- Loop transformations can bring variable references out of scope
- Ignore/support __builtin_ functions
- Add the ability to pass multiple files to corrode
- It is only a suggestion or lets say Idea
- FTBFS: fails to build on OpenSUSE/Tumbleweed
- Build failed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from corrode.