Skip to content

Commit

Permalink
parsetools: Suppress Dialyzer-warnings
Browse files Browse the repository at this point in the history
When using Yecc's operator precedence declarations (Right, Nonassoc,
Left), it is possible that some clauses of the generated code are
unreachable. Dialyzer complains, at least if SET_LIMIT in erl_types is
set sufficiently high (to avoid sets of integers to collapse to the
integer() type). Rather than trying to figure out exactly which
clauses are unreachable, Yecc generates a Dialyzer suppression.
  • Loading branch information
uabboli committed Sep 12, 2016
1 parent 86d1fb0 commit edaa208
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/parsetools/src/yecc.erl
Expand Up @@ -1978,7 +1978,8 @@ output_goto(St, [{_Nonterminal, []} | Go], StateInfo) ->
output_goto(St, Go, StateInfo);
output_goto(St0, [{Nonterminal, List} | Go], StateInfo) ->
F = function_name(yeccgoto, Nonterminal),
St10 = output_goto1(St0, List, F, StateInfo, true),
St05 = fwrite(St0, <<"-dialyzer({nowarn_function, ~w/7}).\n">>, [F]),
St10 = output_goto1(St05, List, F, StateInfo, true),
St = output_goto_fini(F, Nonterminal, St10),
output_goto(St, Go, StateInfo);
output_goto(St, [], _StateInfo) ->
Expand Down
8 changes: 4 additions & 4 deletions lib/parsetools/test/yecc_SUITE.erl
Expand Up @@ -342,7 +342,7 @@ syntax(Config) when is_list(Config) ->
{L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
[]} = compile:file(Parserfile1, [basic_validation,return]),
?line L1 = 31 + SzYeccPre,
?line L2 = 38 + SzYeccPre
?line L2 = 39 + SzYeccPre
end(),

%% Bad macro in action. OTP-7224.
Expand All @@ -360,7 +360,7 @@ syntax(Config) when is_list(Config) ->
{L2,_,{bad_inline,{yeccpars2_2_,1}}}]}],
[]} = compile:file(Parserfile1, [basic_validation,return]),
?line L1 = 31 + SzYeccPre,
?line L2 = 38 + SzYeccPre
?line L2 = 39 + SzYeccPre
end(),

%% Check line numbers. OTP-7224.
Expand Down Expand Up @@ -1623,7 +1623,7 @@ otp_7292(Config) when is_list(Config) ->
[{_,[{16,_,{unused_function,{foo,0}}}]}]} =
compile:file(Parserfile1, [basic_validation, return]),
L1 = 41 + SzYeccPre,
L2 = 48 + SzYeccPre
L2 = 49 + SzYeccPre
end(),

YeccPre = filename:join(Dir, "yeccpre.hrl"),
Expand All @@ -1641,7 +1641,7 @@ otp_7292(Config) when is_list(Config) ->
[{_,[{16,_,{unused_function,{foo,0}}}]}]} =
compile:file(Parserfile1, [basic_validation, return]),
?line L1 = 40 + SzYeccPre,
?line L2 = 47 + SzYeccPre
?line L2 = 48 + SzYeccPre
end(),

file:delete(YeccPre),
Expand Down

0 comments on commit edaa208

Please sign in to comment.