@@ -80,6 +80,20 @@ defmodule Ejabberd.MixProject do
80
80
end
81
81
end
82
82
83
+ defp if_type_exported ( module , typeDef , okResult ) do
84
+ try do
85
+ { :ok , concrete } = :dialyzer_utils . get_core_from_beam ( :code . which ( module ) )
86
+ { :ok , types } = :dialyzer_utils . get_record_and_type_info ( concrete )
87
+ if Maps . has_key ( types , typeDef ) do
88
+ okResult
89
+ else
90
+ [ ]
91
+ end
92
+ rescue
93
+ _ -> [ ]
94
+ end
95
+ end
96
+
83
97
defp erlc_options do
84
98
# Use our own includes + includes from all dependencies
85
99
includes = [ "include" , deps_include ( ) ]
@@ -97,7 +111,8 @@ defmodule Ejabberd.MixProject do
97
111
if_version_below ( ~c" 24" , [ { :d , :COMPILER_REPORTS_ONLY_LINES } ] ) ++
98
112
if_version_below ( ~c" 24" , [ { :d , :SYSTOOLS_APP_DEF_WITHOUT_OPTIONAL } ] ) ++
99
113
if_version_below ( ~c" 24" , [ { :d , :OTP_BELOW_24 } ] ) ++
100
- if_version_below ( ~c" 25" , [ { :d , :OTP_BELOW_25 } ] )
114
+ if_version_below ( ~c" 25" , [ { :d , :OTP_BELOW_25 } ] ) ++
115
+ if_type_exported ( :odbc , { :opaque , :connection_reference , 0 } , [ { :d , :ODBC_HAS_TYPES } ] )
101
116
defines = for { :d , value } <- result , do: { :d , value }
102
117
result ++ [ { :d , :ALL_DEFS , defines } ]
103
118
end
0 commit comments