25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Replace 'if' preprocessor directive with 'ifndef', add OTP_BELOW_24

The 'if' preprocessor directive was added in Erlang/OTP 21.0,
but ejabberd currently supports Erlang 20.0 and higher...
Let's use 'ifndef' instead.

https://www.erlang.org/doc/reference_manual/macros.html#flow-control-in-macros
https://www.erlang.org/doc/apps/compiler/notes#compiler-7.2
https://www.erlang.org/patches/otp-21.0#compiler-7.2
This commit is contained in:
Badlop 2024-02-14 21:51:33 +01:00
parent 816900a6cf
commit b8181974ec
6 changed files with 6 additions and 4 deletions

View File

@ -82,6 +82,7 @@ defmodule Ejabberd.MixProject do
if_version_below(~c"23", [{:d, :USE_OLD_PG2}]) ++ if_version_below(~c"23", [{:d, :USE_OLD_PG2}]) ++
if_version_below(~c"24", [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++ if_version_below(~c"24", [{:d, :COMPILER_REPORTS_ONLY_LINES}]) ++
if_version_below(~c"24", [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++ if_version_below(~c"24", [{:d, :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL}]) ++
if_version_below(~c"24", [{:d, :OTP_BELOW_24}]) ++
if_version_below(~c"25", [{:d, :OTP_BELOW_25}]) if_version_below(~c"25", [{:d, :OTP_BELOW_25}])
defines = for {:d, value} <- result, do: {:d, value} defines = for {:d, value} <- result, do: {:d, value}
result ++ [{:d, :ALL_DEFS, defines}] result ++ [{:d, :ALL_DEFS, defines}]

View File

@ -129,6 +129,7 @@
{if_version_below, "23", {d, 'USE_OLD_PG2'}}, {if_version_below, "23", {d, 'USE_OLD_PG2'}},
{if_version_below, "24", {d, 'COMPILER_REPORTS_ONLY_LINES'}}, {if_version_below, "24", {d, 'COMPILER_REPORTS_ONLY_LINES'}},
{if_version_below, "24", {d, 'SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL'}}, {if_version_below, "24", {d, 'SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL'}},
{if_version_below, "24", {d, 'OTP_BELOW_24'}},
{if_version_below, "25", {d, 'OTP_BELOW_25'}}, {if_version_below, "25", {d, 'OTP_BELOW_25'}},
{if_var_false, debug, no_debug_info}, {if_var_false, debug, no_debug_info},
{if_var_true, debug, debug_info}, {if_var_true, debug, debug_info},

View File

@ -24,7 +24,7 @@
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(mod_matrix_gw). -module(mod_matrix_gw).
-if(?OTP_RELEASE >= 24). -ifndef(OTP_BELOW_24).
-author('alexey@process-one.net'). -author('alexey@process-one.net').

View File

@ -24,7 +24,7 @@
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
-module(mod_matrix_gw_room). -module(mod_matrix_gw_room).
-if(?OTP_RELEASE >= 24). -ifndef(OTP_BELOW_24).
-behaviour(gen_statem). -behaviour(gen_statem).
%% API %% API

View File

@ -23,7 +23,7 @@
%%% %%%
%%%------------------------------------------------------------------- %%%-------------------------------------------------------------------
-module(mod_matrix_gw_s2s). -module(mod_matrix_gw_s2s).
-if(?OTP_RELEASE >= 24). -ifndef(OTP_BELOW_24).
-behaviour(gen_statem). -behaviour(gen_statem).
%% API %% API

View File

@ -20,7 +20,7 @@
%%% %%%
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(mod_matrix_gw_sup). -module(mod_matrix_gw_sup).
-if(?OTP_RELEASE >= 24). -ifndef(OTP_BELOW_24).
-behaviour(supervisor). -behaviour(supervisor).
%% API %% API