transpile: Refactor, document and correct uses of used() flag - #1975
Open
Rua wants to merge 7 commits into
Open
Conversation
used() flagused() flag
Rua
force-pushed
the
is_used
branch
6 times, most recently
from
August 16, 2026 16:02
c02d700 to
95b17f7
Compare
fw-immunant
self-requested a review
August 18, 2026 06:47
fw-immunant
reviewed
Aug 18, 2026
fw-immunant
left a comment
Contributor
There was a problem hiding this comment.
Code changes all look good, but before merging I want to go verify that this doesn't interfere with the way Hayroll inserts no-op expressions into c2rust inputs to link C preprocessor macro expansions with their c2rust translations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
convert_side_effects_exprin more places #1976I've documented how
is_usedis supposed to be set, and added/removedused()accordingly.If you're wondering what's up with some of the code in the
exprs.ctest suddenly disappearing: The transpiler normally eliminates unused code, which includes unused results of binary expressions:1 + 1;gets eliminated altogether1 + func();gets reduced tofunc();But for some reason unary expressions were not handled the same way, and were emitted even if they didn't do anything. Now they get removed too.