aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-11 15:33:08 +0200
committerBjörn Gustavsson <[email protected]>2016-05-12 09:50:18 +0200
commitc9d490bcd66141e1664cc3634445b6f4fefd498c (patch)
tree7306ce714426e090adc50d3cb174bc14eb451e51 /lib/asn1/src
parente1ad5319f0b76460d9147ef04640c469f5a180d6 (diff)
downloadotp-c9d490bcd66141e1664cc3634445b6f4fefd498c.tar.gz
otp-c9d490bcd66141e1664cc3634445b6f4fefd498c.tar.bz2
otp-c9d490bcd66141e1664cc3634445b6f4fefd498c.zip
Eliminate dialyzer warnings for unmatched returns
Dialyzer complains that three calls to gen_dec_line/7 ignore the return value. It turns out that when the last argument to gen_dec_line/7 is 'false', the return value will always be {[],[]}. Introduce gen_dec_line/6 as helper to make it clear that we don't ignore a useful return value.
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl
index 8f4cf2b9ec..325bea5879 100644
--- a/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl
+++ b/lib/asn1/src/asn1ct_constructed_ber_bin_v2.erl
@@ -500,9 +500,7 @@ gen_decode_sof(Erules,TypeName,_InnerTypeName,D) when is_record(D,type) ->
Atom when is_atom(Atom) -> Atom;
_ -> TypeNameSuffix
end,
- ObjFun = false,
- gen_dec_line(Erules,TypeName,ContName,[],Cont,mandatory,ObjFun),
- %% gen_dec_line_sof(Erules,Typename,ContName,Cont,ObjFun),
+ gen_dec_line(Erules,TypeName,ContName,[],Cont,mandatory),
emit([" || ",{curr,v}," <- ",{curr,tlv},"].",nl,nl,nl]).
@@ -869,7 +867,7 @@ gen_dec_choice_cases(Erules,TopType, [H|T]) ->
(?ASN1CT_GEN_BER:decode_class(T1class) bsl 10) +
T1number,",_} -> ",nl]),
emit([indent(8),"{",{asis,Cname},", "]),
- gen_dec_line(Erules,TopType,Cname,[],Type,Prop,false),
+ gen_dec_line(Erules,TopType,Cname,[],Type,Prop),
emit(["};",nl,nl]),
Fun(Tail,Fun);
([],_) ->
@@ -896,7 +894,7 @@ gen_dec_choice_cases(Erules,TopType, [H|T]) ->
(?ASN1CT_GEN_BER:decode_class(FirstT#tag.class) bsl 10) +
FirstT#tag.number,", ",{curr,v},"} -> ",nl]),
emit([indent(8),"{",{asis,Cname},", "]),
- gen_dec_line(Erules,TopType,Cname,[],Type#type{tag=RestT},Prop,false),
+ gen_dec_line(Erules,TopType,Cname,[],Type#type{tag=RestT},Prop),
emit(["};",nl,nl])
end,
gen_dec_choice_cases(Erules,TopType, T).
@@ -1060,8 +1058,14 @@ gen_optormand_case({'DEFAULT',DefaultValue}, Erules, _TopType,
end,
emit([indent(9),"_ ->",nl,indent(12)])
end.
-
+%% Use for SEQUENCE OF and CHOICE.
+gen_dec_line(Erules,TopType,Cname,CTags,Type,OptOrMand) ->
+ %% The matching on the next line is an assertion.
+ {[],[]} = gen_dec_line(Erules,TopType,Cname,CTags,Type,OptOrMand,false),
+ ok.
+
+%% Use for SEQUENCE.
gen_dec_line(Erules,TopType,Cname,CTags,Type,OptOrMand,DecObjInf) ->
BytesVar = asn1ct_gen:mk_var(asn1ct_name:curr(v)),
Tag =