Skip to content

MPR#7710: ocamldep -sort: treat cyclic dependencies as an error#1578

Merged
xavierleroy merged 1 commit intoocaml:trunkfrom
xavierleroy:MPR7710
Feb 11, 2018
Merged

MPR#7710: ocamldep -sort: treat cyclic dependencies as an error#1578
xavierleroy merged 1 commit intoocaml:trunkfrom
xavierleroy:MPR7710

Conversation

@xavierleroy
Copy link
Copy Markdown
Contributor

Before, cyclic dependencies were reported as a warning, and ocamldep -sort would exit with code 0.
Now, the message says "error" and the exit code is nonzero.

The original behavior might have been intended as a "Hail Mary", i.e. "produce some ordering and with much luck it will pass linking", taking advantage of the fact that not all dependencies spotted by ocamldep are linking dependencies. I don't think this should be relied on.

Copy link
Copy Markdown
Member

@Octachron Octachron left a comment

Choose a reason for hiding this comment

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

I have a small question, otherwise it is a clearly correct fix.

if !worklist <> [] then begin
Format.fprintf Format.err_formatter
"@[Warning: cycle in dependencies. End of list is not sorted.@]@.";
"@[Error: cycle in dependencies. End of list is not sorted.@]@.";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A very minor question: should this be @{<error>Error@} (with a Misc.Color.setup !Clflags.color before) to align the printing of this error with the ones printed by Location.report_exception (in case of parsing errors) ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're probably right, but I'm not familiar with the error coloring code. I'll merge as it, but feel free to change the error message later if you wish. ( I'm not even sure a GPR is needed for that, as it would not change functionality.)

Before, cyclic dependencies were reported as a warning, and ocamldep -sort would exit with code 0.
Now, the message says "error" and the exit code is nonzero.
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.

2 participants