-
Notifications
You must be signed in to change notification settings - Fork 68
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
Conversation
src/generator/passes.jl
Outdated
|
||
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
I changed the option name to |
src/generator/passes.jl
Outdated
@@ -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) |
There was a problem hiding this comment.
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
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. |
@Octogonapus fixed again. |
LGTM! |
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.