Skip to content

fix path lookup, improve 4.05/4.06 support (pass 100% of make check), add Travis CI - #11

Merged
alainfrisch merged 7 commits into
LexiFi:masterfrom
edwintorok:master
Jun 25, 2018
Merged

fix path lookup, improve 4.05/4.06 support (pass 100% of make check), add Travis CI#11
alainfrisch merged 7 commits into
LexiFi:masterfrom
edwintorok:master

Conversation

@edwintorok

@edwintorok edwintorok commented Jun 24, 2018

Copy link
Copy Markdown
Contributor

make check will now succeed on master, see commit messages for individual changes.
Tested on OCaml 4.06.1 locally (Linux), and OCaml 4.05.0/4.06.0 on Travis.

This should fix #10 and be useful for #6

Not sure why we need to look up the source file name based on the binary object file name, surely the .cmi/.cmt files themselves should have enough location information inside them to determine what the real source is without making assumptions about the build system?

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Helps debugging path lookup.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Path lookup was not finding the example sources, because
`normalize_path` returns a path that ends with a `/` always.
normalize_path should only be used on the directory component of a
filename.

Also the leading dots should be removed from filenames.

Make check is now finding all the sources again.

Fixes #10

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
It was not finding the implicit references to `?a` and `?b` from
`anon-call.ml`:
`else if x mod 4 <> 0 then let tmp = (fun l -> List.map (AnonFn.f) l) in ignore (tmp [])`

And concluded that `?a` should be `~a` due to the previous line but that
is wrong:
`if x > 32 then let tmp = (fun l -> List.map (AnonFn.f ~a:12) l) in ignore (tmp [])`

Fix `DeadArg` so it sees the call on the else line.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
`ignore(o)` was treating all methods of `o` as used due to the type of
`o` getting expanded to a `Tobject` with all the methods.
IIUC this is due to same reason as in DeadCode.ml:219, the type is not
present in the source code but gets expanded by the time we reach this
place. If we are dealing with the object itself do not mark its methods
used.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Dune wraps libraries by default with a library_name__ prefix,
when looking for the source file remove this prefix if it exists.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Also add Travis CI integration.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
@alainfrisch
alainfrisch merged commit 23c822a into LexiFi:master Jun 25, 2018
@alainfrisch

Copy link
Copy Markdown
Contributor

Wonderful, thanks!

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.

No dead code reported with OCaml > 4.03

2 participants