Skip to content

Fix warnings compiling with Erlang/OTP 29.0-rc1 #4527

@badlop

Description

@badlop

Compiling ejabberd with Erlang/OTP 29.0-rc1 finishes successfully, can start and works correctly.

However, compilation throws a lot of warnings on ejabberd, and many dependencies, and many rebar3 plugins like

     ┌─ src/jd2ejd.erl:
     │
 143 │                  catch mod_private:set_data(
     │                  ╰── Warning: 'catch ...' is deprecated and will be removed in a
future version of Erlang/OTP; please use 'try ... catch ... end' instead.
Compile directive 'nowarn_deprecated_catch' can be used to suppress
warnings in selected modules.

A temporary workaround is to hide those warnings using rebar3 overrides

The definitive solution is to fix this in ejabberd and all libraries that we manage, and look for fixes (or propose PRs) to the other libraries.


When catch warnings are silenced, other warnings are more visible, which are easier to fix:

Details
===> Compiling ejabberd
     ┌─ src/mod_invites_http.erl:
     │
 276 │          [App || A <- apps_json(Host, Lang, Ctx), maps:get(<<"id">>, App = app_id(A)) == AppID],
     │           ╰── Warning: variable 'App' exported from '==' (line 276, column 86).
Exporting bindings from subexpressions other than block expressions is
deprecated and may yield an error in a future version of Erlang/OTP.
Please move the binding of 'App' out of the '=='.
Compile directive 'nowarn_export_var_subexpr' can be used to suppress
warnings in selected modules.


    ┌─ src/mod_invites_mnesia.erl:

 87 │          I#invite_token.token /= Token,
    │          ╰── Warning: variable 'I' exported from 'not' (line 86, column 9).
Exporting bindings from subexpressions other than block expressions is
deprecated and may yield an error in a future version of Erlang/OTP.
Please move the binding of 'I' out of the 'not'.
Compile directive 'nowarn_export_var_subexpr' can be used to suppress
warnings in selected modules.

     ┌─ src/mod_invites_mnesia.erl:

 104 │      [Invite
     │       ╰── Warning: variable 'Invite' exported from '==' (line 107, column 9).
Exporting bindings from subexpressions other than block expressions is
deprecated and may yield an error in a future version of Erlang/OTP.
Please move the binding of 'Invite' out of the '=='.
Compile directive 'nowarn_export_var_subexpr' can be used to suppress
warnings in selected modules.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions