Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analyze: CLI options #1057

Merged
merged 11 commits into from
Mar 16, 2024
Merged

analyze: CLI options #1057

merged 11 commits into from
Mar 16, 2024

Conversation

spernsteiner
Copy link
Collaborator

This exposes some configuration options that were previously controlled by environment variables as command-line options for the cargo wrapper, and also adds a few new options:

  • --rewrite-in-place: Overwrite source files with the results of rewriting
  • --rewrite-paths: Only rewrite defs whose paths start with a string from this list
  • --use-manual-shims: When shims can't be generated, emit a todo!() placeholder for manual editing instead of failing
  • --fixed-defs-list: Read a list of defs from this file and mark each one as FIXED

c2rust-analyze/src/main.rs Outdated Show resolved Hide resolved
c2rust-analyze/src/main.rs Outdated Show resolved Hide resolved
Comment on lines 394 to 409
if let Some(ref fixed_defs_list) = fixed_defs_list {
cmd.env("C2RUST_ANALYZE_FIXED_DEFS_LIST", fixed_defs_list);
}

if let Some(ref rewrite_paths) = rewrite_paths {
cmd.env("C2RUST_ANALYZE_REWRITE_PATHS", rewrite_paths);
}

if rewrite_in_place {
cmd.env("C2RUST_ANALYZE_REWRITE_IN_PLACE", "1");
}

if use_manual_shims {
cmd.env("C2RUST_ANALYZE_USE_MANUAL_SHIMS", "1");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we plan on continually adding more args over time, we could just serialize Args, pass that to the rustc wrapper, and deserialize them all at once there, rather than having new (simple, but slightly different for each) logic for each arg.

@spernsteiner spernsteiner merged commit 4058b11 into master Mar 16, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants