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

Add flag to control outputting of system code #485

Merged
merged 3 commits into from Apr 18, 2024

Conversation

Octogonapus
Copy link
Contributor

@Octogonapus Octogonapus commented Apr 16, 2024

This PR adds a flag output_system (true by default for backwards compatibility) which controls whether code in system headers will be output.
Setting this flag to false allows the user to effectively avoid emitting code for dependencies by including those dependencies as system headers.

I have tested this with my MWE in #484 and it solves that issue.

Fixes #484.


show_info && @info "[GeneralPrinter]: print to $(x.file)"
open(x.file, "a") do io
for node in dag.nodes
!output_system && string(node.id) in map(it -> string(it.id), dag.sys) && continue
Copy link
Member

Choose a reason for hiding this comment

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

We should add the same change to StdPrinter etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@Gnimuc
Copy link
Member

Gnimuc commented Apr 17, 2024

I changed the option name to generate_isystem_symbols and tweaked the code a little.

@@ -943,6 +943,7 @@ function (x::FunctionPrinter)(dag::ExprDAG, options::Dict)
show_info = get(log_options, "FunctionPrinter_log", x.show_info)
ignorelist = get(general_options, "output_ignorelist", get(general_options, "printer_blacklist", []))
exclusivelist = get(general_options, "output_exclusivelist", nothing)
get(general_options, "generate_isystem_symbols", true) && append!(ignorelist, string(x.id) for x in dag.sys)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this logic is inverted

@Octogonapus
Copy link
Contributor Author

After fixing the logic and trying it out, this new implementation is very slow because the ignorelist is quite large and running all of those regular expressions is slow. I would recommend to use the prior implementation because it is much faster.

@Gnimuc
Copy link
Member

Gnimuc commented Apr 18, 2024

@Octogonapus fixed again.

@Octogonapus
Copy link
Contributor Author

LGTM!

@Gnimuc Gnimuc merged commit 64f640b into JuliaInterop:master Apr 18, 2024
11 checks passed
@Octogonapus Octogonapus deleted the fix_deps branch April 18, 2024 13:29
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.

Unsure how to handle JLL dependencies
2 participants