andrewjstone / rafter

An Erlang library application which implements the Raft consensus protocol
269 stars 32 forks source link

Fixed warning that prevented build on R17 #29

Closed bryanhunter closed 9 years ago

bryanhunter commented 10 years ago

Fixed 'type dict/0 is deprecated and will be removed in OTP 18.0' warnings that prevented build on R17.

Previously....

$ git clone git@github.com:andrewjstone/rafter.git
$ cd rafter
$ make deps
$ make
...
==> rafter (compile)
Compiled src/rafter_backend.erl
Compiled src/rafter_app.erl
compile: warnings being treated as errors
include/rafter_consensus_fsm.hrl:22: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
include/rafter_consensus_fsm.hrl:27: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
include/rafter_consensus_fsm.hrl:35: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
make: *** [rafter] Error 1

...fixed these by replacing dict() with dict:dict() in specs

$ make
...
==> rafter (compile)
Compiled src/rafter_backend_echo.erl
Compiled src/rafter.erl
Compiled src/rafter_backend_ets.erl
Compiled src/rafter_consensus_sup.erl
compile: warnings being treated as errors
src/rafter_config.erl:13: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_config.erl:37: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_config.erl:115: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_config.erl:128: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
make: *** [rafter] Error 1

...fixed these by replacing dict() with dict:dict() in specs

$ make
...
==> rafter (compile)
Compiled src/rafter_config.erl
Compiled src/rafter_log.erl
compile: warnings being treated as errors
src/rafter_consensus_fsm.erl:475: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_consensus_fsm.erl:475: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_consensus_fsm.erl:487: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_consensus_fsm.erl:487: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_consensus_fsm.erl:493: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
src/rafter_consensus_fsm.erl:493: type dict/0 is deprecated and will be removed in OTP 18.0; use use dict:dict/0 or preferably dict:dict/2
make: *** [rafter] Error 1

...fixed these by replacing dict() with dict:dict() in specs

$ make ... All good. :)

andrewjstone commented 10 years ago

@bryanhunter Unfortunately this causes builds with R16B02 (at least) and lower to fail with warnings like the following:

Compiled src/rafter_backend.erl
Compiled src/rafter_app.erl
include/rafter_consensus_fsm.hrl:22: referring to built-in type dict as a remote type; please take out the module name
include/rafter_consensus_fsm.hrl:27: referring to built-in type dict as a remote type; please take out the module name
include/rafter_consensus_fsm.hrl:35: referring to built-in type dict as a remote type; please take out the module name
make: *** [rafter] Error 1

I'm not sure what the solution is at this point. Maybe using -ifdef(Version)?

bryanhunter commented 10 years ago

Shucks...

I had missed that this thread: http://erlang.org/pipermail/erlang-questions/2014-February/077945.html

What a kick in the shorts, eh? It's going to be ugly.

solvip commented 10 years ago

A short-term workaround could be to add 'nowarn_deprecated_type' to erl_opts in rebar.config to disable the warning. The couchbase team did that: http://review.couchbase.org/#/c/35585/

andrewjstone commented 9 years ago

Fixed by #35