How do I get dialyzer to ignore certain unexported functions?
I'm using lager to do my logging; it has a parser transform which converts lager:warn/1
, etc. functions into lager:trace...
functions.
dialyzer doesn't process the parser transform, so it warns with Call to missing or unexported function lager:warn/1
.
How do I tell it that this function does exist, and not to warn about it?
最好的办法是让dialyzer查看你的编译束文件,只要在编译代码时应用解析变换,并且在你的.plt文件中包含lager就可以了
Stumbled upon a way by checking out what's done in the meck project's Makefile regarding dialyzer. Have a look: Makefile
Key part is this:
|
fgrep -v -f ./dialyzer.ignore-warnings
So within that file: dialyzer.ignore-warnings you'll see what to do. In my version I added:
Call to missing or unexported function lager:warning/1
Call to missing or unexported function lager:warning/2
Call to missing or unexported function lager:info/1
Call to missing or unexported function lager:info/2
Call to missing or unexported function lager:error/1
Call to missing or unexported function lager:error/2
And the warnings I was getting went away. I do of course have this entry in my rebar.config:
{erl_opts, [{parse_transform, lager_transform}]}.
链接地址: http://www.djcxy.com/p/76082.html
上一篇: 在不同的构建类型中自定义AndroidManifest
下一篇: 如何让透析器忽略某些未导出的功能?