From a86d63b3940c19dedb6ebcf0f684fa9641a9833e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 16 Apr 2014 09:36:06 +0200 Subject: BER: Suppress dialyzer warnings for encode_bit_string/4 We don't want to touch the code used for encoding BIT STRINGs when 'legacy_erl_types' is active, since it will be removed within two or three major releases. But we do want to suppress the dialyzer warnings in the meantime. The easiest way is to call encode_bit_string/4 with unknown types from an exported function that is never actually called like this: -export(['dialyzer-suppressions'/0]). 'dialyzer-suppressions'(Arg) -> {A,B,C,D} = Arg, encode_bit_string(A, B, C, D), ok. --- lib/asn1/src/asn1ct_func.erl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/asn1/src/asn1ct_func.erl') diff --git a/lib/asn1/src/asn1ct_func.erl b/lib/asn1/src/asn1ct_func.erl index 33f998722a..fb94f65b32 100644 --- a/lib/asn1/src/asn1ct_func.erl +++ b/lib/asn1/src/asn1ct_func.erl @@ -19,7 +19,8 @@ %% -module(asn1ct_func). --export([start_link/0,need/1,call/3,call_gen/3,call_gen/4,generate/1]). +-export([start_link/0,need/1,call/3,call_gen/3,call_gen/4, + generate/1,is_used/1]). -export([init/1,handle_call/3,handle_cast/2,terminate/2]). start_link() -> @@ -63,6 +64,10 @@ generate(Fd) -> Funcs = sofs:to_external(Funcs0), ok = file:write(Fd, Funcs). +is_used({_,_,_}=MFA) -> + req({is_used,MFA}). + + req(Req) -> gen_server:call(get(?MODULE), Req, infinity). @@ -103,7 +108,10 @@ handle_call({gen_func,Prefix,Key,GenFun}, _From, #st{gen=G0,gc=Gc0}=St) -> {reply,Name,St#st{gen=G,gc=Gc}}; {value,{Name,_}} -> {reply,Name,St} - end. + end; +handle_call({is_used,MFA}, _From, #st{used=Used}=St) -> + {reply,gb_sets:is_member(MFA, Used),St}. + terminate(_, _) -> ok. -- cgit v1.2.3