Comments (7)
I think this is related to (possible among other things) relying on the order of items stored in HashMaps in relooper. Can you be more specific about what changes you're seeing?
from c2rust.
Running c2rust twice on https://github.com/danielrh/zstd/tree/c2rust results in 2 different outputs for the same code
here are two runs. No code was changed between the run-- c2rust was simply executed twice on the same code and the results have significant differences-- some types even get different names (eg postfixed with _0
) and there are even some indentation differences, probably due to unique wrapping from type name differences, which can make it hard to version control or upstream fixes/updates.
from c2rust.
it might be desirable to avoid enforcing any line limitations on transpiled code, to avoid difficult merges.
My understanding is that golang
's autoformatter doesn't ever wrap lines, partially so that line numbers stay the same before and after running their fmt tool. If users want to wrap the lines of their code, they may wish to use a separate commit hook to do so.
from c2rust.
If iteration of hash maps are an issue, we could try swapping in https://github.com/bluss/indexmap which is basically an insertion order preserving hash map.
from c2rust.
Another aspect of the instability is that we're processing struct/union/typedef declarations in a unstable order which is a function of both the exported pointer value from clang as well as the hashing function in the c_decls hashmap. The "top-level" declarations are exported from clang as a list that preserves the original order. This means that function order is stable.
from c2rust.
I think this is fixed for both type declarations and for relooper. We just need to get the commits synced.
from c2rust.
Commits are synced. @danielrh feel free to reopen if this is still an issue.
from c2rust.
Related Issues (20)
- analyze: generate subset relationships for arguments such as `arg: &'a &'b &'c i32`
- (`c2rust-analyze`) Support genericity over `KnownFn` ptr perms
- (`c2rust-analyze`) Support custom deallocators/linear `Box` types
- transpile: Init list not implemented for Uint HOT 1
- Add hypothetical lifetimes to pointer-to-reference label
- analyze: "known permissions changed" on lighttpd libc calls
- analyze: handle casts between pointers to primitive types and/or void*
- analyze: "unlower_map has no origin" on `(*x).f += y`
- analyze: "unlower_map has no origin" on *mut -> *const cast HOT 1
- analyze: assertion failure on enum construction
- analyze: error on void* cast in realloc
- Evaluate Profile-Guided Optimization (PGO) HOT 1
- analyze: bad rewrite of `derive(Clone)` on unions
- analyze: missing hypothetical lifetimes in type alias RHS HOT 1
- analyze: missing hypothetical lifetimes within function pointer types
- bitfields: error when using `derive(BitfieldStruct)` on a struct with lifetime parameters
- analyze: rewriter adds hypothetical lifetime args to mentions of non-rewritten structs HOT 2
- analyze: hypothetical lifetime params aren't added to union defs
- analyze: ICE on pointer transmute
- analyze: when rewriting, omit unused hypothetical regions HOT 3
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 c2rust.