jbrisbin / amqp_client

Rebar-friendly fork of rabbitmq-erlang-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation warnings

pma opened this issue · comments

During compilation the following two types of warning are displayed:

  1. behaviour supervisor2 undefined
  2. variable X exported from 'case'

Is this something that needs to be fixed upstream or something that must be tackled in this rebarized version?

I did try to compile from sources and no warnings are displayed (instructions used: https://www.rabbitmq.com/build-erlang-client.html). Could be that warnings are just being hidden by some extra compiler flag.

src/mirrored_supervisor.erl:137: Warning: behaviour supervisor2 undefined
/tmp/amqp_client/deps/rabbit_common/src/mirrored_supervisor.erl:137: Warning: behaviour supervisor2 undefined
src/credit_flow.erl:86: Warning: variable 'C' exported from 'case' (line 85)
src/credit_flow.erl:88: Warning: variable 'C' exported from 'case' (line 85)
src/credit_flow.erl:95: Warning: variable 'C' exported from 'case' (line 94)
src/credit_flow.erl:97: Warning: variable 'C' exported from 'case' (line 94)
src/credit_flow.erl:102: Warning: variable 'C' exported from 'case' (line 101)
src/credit_flow.erl:102: Warning: variable 'C' exported from 'case' (line 101)
src/credit_flow.erl:104: Warning: variable 'C' exported from 'case' (line 101)
src/credit_flow.erl:140: Warning: variable 'Deferred' exported from 'case' (line 140)
src/credit_flow.erl:148: Warning: variable 'Blocks' exported from 'case' (line 148)
src/credit_flow.erl:151: Warning: variable 'Blocks' exported from 'case' (line 151)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:86: Warning: variable 'C' exported from 'case' (line 85)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:88: Warning: variable 'C' exported from 'case' (line 85)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:95: Warning: variable 'C' exported from 'case' (line 94)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:97: Warning: variable 'C' exported from 'case' (line 94)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:102: Warning: variable 'C' exported from 'case' (line 101)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:102: Warning: variable 'C' exported from 'case' (line 101)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:104: Warning: variable 'C' exported from 'case' (line 101)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:140: Warning: variable 'Deferred' exported from 'case' (line 140)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:148: Warning: variable 'Blocks' exported from 'case' (line 148)
/tmp/amqp_client/deps/rabbit_common/src/credit_flow.erl:151: Warning: variable 'Blocks' exported from 'case' (line 151)
==> amqp_client (compile)
src/amqp_channel_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_channel_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_channel_sup_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_channel_sup_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_connection_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_connection_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_connection_type_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_connection_type_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_sup.erl:22: Warning: behaviour supervisor2 undefined
src/amqp_sup.erl:22: Warning: behaviour supervisor2 undefined

The ideal solution is to fix them in the rebarized version. I didn't take the time to do that. We can also comment out the compiler flags that are creating the warnings in the first place. Would be happy to accept a PR in that regard.

@jbrisbin

The "variable X exported from case" warnings are fixed by this PR to rabbit_common: jbrisbin/rabbit_common#6

I tried but so far couldn't find a solution for the "behaviour supervisor2 undefined" warnings. I suspect it's because ebin (in rabbit_common) and deps/rabbit_common/ebin (in amqp_client) should be given in the -pa switch to the erlang compiler, but I don't know enough about rebar to make it work.

Actually the "behaviour supervisor2 undefined" warning is because supervisor2 doesn't export the necessary behaviour_info/1 function. That will go away if we create one and put in the necessary tuples of info. I just wasn't sure what we needed and didn't have a lot of time to devote to figuring it out.

@jbrisbin Added a possible fix for the remaining warning in the PR jbrisbin/rabbit_common#7

The empty list returned by behaviour_info(callbacks) does make the warning go away. I could not detect any runtime problems with my unit tests when using this branch of rabbit_common.

Note: I did get a different warning about having conflicting behaviours with the gen_server when I tried returning [{init,1}].

Edit: Isn't this something that should also be reported and fixed upstream?

@jbrisbin I'll try reporting the missing behaviour_info/1 in supervisor2 to the rabbitmq mailing lists. Hopefully this is something that can be fixed upstream in 3.3.6.

Will you update release rabbitmq-3.3.5 to include the merged warning fixes? Or add rabbitmq-3.3.5-community instead? Thanks!

@jbrisbin Follow up on the behaviour_info/1 issue: https://groups.google.com/forum/#!topic/rabbitmq-users/ThCiHBOXMlE

In summary Simon MacMullen has already fixed this upstream and it should be included in the next release (3.3.6?).