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

ocamldep should warn about non-existent dependencies #3410

Closed
vicuna opened this issue Jun 26, 2002 · 2 comments
Closed

ocamldep should warn about non-existent dependencies #3410

vicuna opened this issue Jun 26, 2002 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jun 26, 2002

Original bug ID: 1217
Reporter: administrator
Status: closed (set by @xavierleroy on 2013-08-31T10:46:07Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

The manual for ocamldep states

-I directory Add the given directory to the list of directories searched for
source files. If a source file foo.ml mentions an external compilation unit
Bar, a dependency on that unit's interface bar.cmi is generated only if the
source for bar is found in the current directory or in one of the
directories specified with -I. Otherwise, Bar is assumed to be a module form
the standard library, and no dependencies are generated. For programs that
span multiple directories, it is recommended to pass ocamldep the same -I
options that are passed to the compiler.

This is unsafe. In other words I had a bug in my Makefile and the -I
flags were not being passed to ocamldep. It took a while to notice
that bug. As a possible solution, I suggest that ocamldep check that
the module really does reside in the stdlib. There are other
solutions that you may prefer but I think we should err on the side of
safety.

Also, the word "form" should be changed to "from". (I often make this
mistake too.)

@vicuna
Copy link
Author

vicuna commented Jan 22, 2008

Comment author: @damiendoligez

Fixed the typo in the doc.
Not sure the feature is worth the trouble.

@vicuna
Copy link
Author

vicuna commented Jan 25, 2012

Comment author: @damiendoligez

I don't think we can implement this feature because ocamldep is not exact: because it works at the syntactic level and doesn't handle all the subtleties of the module system, it sometimes finds dependencies that are nonexistent.

A canonical example would be:

open Random;;
let random_state = State.make [| 1 |];;

On this file, currently ocamldep either ignores the reference to State (because it cannot find the .mli) or outputs a spurious dependency on state.cmi (if there is a file named state.mli).

With your change, in the first case it would output a spurious warning (that state.mli was not found).
This would rather discourage any serious use of the module system.

I'm setting this feature wish to resolved/wontfix, meaning that we won't work on it for the moment. We might come back to it one day if ocamldep gets an exact computation of dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant