A possibly-spurious warning message on 18.0-rc1 when enabling compile inline option
Kenji Rikitake <[email protected]> Sat, 25 Apr 2015 10:13:04 +0900
| Newsgroups | gmane.comp.lang.erlang.bugs |
|---|---|
| Message-ID | <[email protected]> |
A warning message, which does not make sense, is generated when
compiling the following code on 18.0-rc1 (both on FreeBSD and OS X):
erlc -Werror buftest.erl
compile: warnings being treated as errors
buftest.erl:15: a term is constructed, but never used
This doesn't happen on 17.5,
and this message is not generated when
`-compile({inline, [loop/1]})` doesn't exist.
buftest.erl source code:
-module(buftest).
-export([
loop/1
]).
-compile({inline, [loop/1]}).
calc(H, H2) ->
ok = io:format("H = ~p, H2 = ~p~n", [H, H2]),
H2.
loop({[H], RL}) ->
NL = lists:reverse(RL),
loop({[H|NL], []}); % <- this line generates the warning
loop({L, RL}) ->
[H|L2] = L,
[H2|L3] = L2,
NH2 = calc(H, H2),
NL2 = [NH2|L3],
NRL = [H|RL],
{NL2, NRL}.
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs