Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I tell Dialyzer to ignore some modules?

I'm building a PLT using

dialyzer  --output_plt lib.plt --build_plt --apps stdlib kernel mnesia ssl public_key crypto erts asn1 inets sasl odbc

It spits out some errors about unknown functions in modules I don't care about. For example:

  Compiling some key modules to native code... done in 1m10.81s
  Creating PLT lib.plt ...
Unknown functions:
  compile:file/2
  compile:forms/2
  compile:noenv_forms/2

Can I tell dialyzer to ignore these? Should I actually care about them?

like image 876
Nathaniel Waisbrot Avatar asked Dec 19 '22 19:12

Nathaniel Waisbrot


2 Answers

To ignore warnings for specific functions that you don't want to analyze you can add this in your module:

-dialyzer({nowarn_function, f/0}).

or this to avoid a particular warning in your module:

-dialyzer(no_improper_lists).

Full info: http://erlang.org/doc/man/dialyzer.html#suppression

like image 73
Euen Avatar answered Dec 29 '22 17:12

Euen


You don't need to care about those warnings. It just means that dialyzer won't be able to check the types of arguments in calls to those functions, so it might not find some discrepancies that it would be able to find if those functions were included in the PLT.

For a more complete analysis, add compiler to the list of apps you're building into your PLT.

like image 30
legoscia Avatar answered Dec 29 '22 16:12

legoscia