Coder Social home page Coder Social logo

Comments (7)

glguy avatar glguy commented on June 14, 2024

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.

danielrh avatar danielrh commented on June 14, 2024

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.

firstrun.zip
secondrun.zip

from c2rust.

danielrh avatar danielrh commented on June 14, 2024

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.

TheDan64 avatar TheDan64 commented on June 14, 2024

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.

glguy avatar glguy commented on June 14, 2024

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.

glguy avatar glguy commented on June 14, 2024

I think this is fixed for both type declarations and for relooper. We just need to get the commits synced.

from c2rust.

thedataking avatar thedataking commented on June 14, 2024

Commits are synced. @danielrh feel free to reopen if this is still an issue.

from c2rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.