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

warning with Erlang/OTP 20 #135

Open
benoitc opened this issue Jul 4, 2017 · 5 comments
Open

warning with Erlang/OTP 20 #135

benoitc opened this issue Jul 4, 2017 · 5 comments

Comments

@benoitc
Copy link

benoitc commented Jul 4, 2017

with latest version of Erlang OTP you get the following warnings:

_build/default/lib/gproc/src/gproc_pool.erl:379: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
_build/default/lib/gproc/src/gproc_pool.erl:605: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
_build/default/lib/gproc/src/gproc_pool.erl:1076: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
_build/default/lib/gproc/src/gproc_pool.erl:1088: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1
_build/default/lib/gproc/src/gproc_pool.erl:1097: Warning: crypto:rand_uniform/2 is deprecated and will be removed in a future release; use rand:uniform/1

_build/default/lib/gproc/src/gproc_dist.erl:23: Warning: behaviour gen_leader undefined

I can fix them but not sure what is the appropriate way:

  • compile macro? but it can be difficult to pass such options using rebar from the top project
  • try/except ?
  • combat module created at compilation?

Let me know.

@uwiger
Copy link
Owner

uwiger commented Jul 5, 2017

Refactoring into a helper function seems like a good first step.
Using function_exported/3 would probably work. The only thing to ensure is that an initial check is done to see if the module is loaded (e.g. calling code:ensure_loaded(rand) in the init function.)

@tsloughter
Copy link

Why not the compile macro that checks the version of OTP?

@uwiger
Copy link
Owner

uwiger commented Jul 10, 2017

Sorry, I now realize I was a little bit hasty before: my suggestion obviously doesn't address the deprecation warnings.

@tsloughter, specifically which compile macro did you have in mind?

A possibility would be to require OTP 18 or newer, and simply use rand:uniform/1. Would this be acceptable?

@tsloughter
Copy link

You can define a macro that does a regex on the otp version:

{platform_define, "^(19|2)", rand_only}

Though just requiring 18+ makes sense too now that 20 is out.

@uwiger
Copy link
Owner

uwiger commented Sep 6, 2017

The .travis.yml /really/ needs to be updated, since it actually only tests versions between R15B01 and 17.1, none of which arguably should be tested at all.

I'm fine with supporting only 18+ and later versions.

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

No branches or pull requests

3 participants