File 3343-Eliminate-warnings-for-unused-variable-for-compiler-.patch of Package erlang
From 0331954b74b61c3b1957ace37b062be586597024 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 17 Jun 2021 14:49:15 +0200
Subject: [PATCH 3/4] Eliminate warnings for unused variable for compiler tests
Eliminate the amount of annoying warnings. Prefixing a variable with
'_' will suppress warnings by erl_lint, but will generally not change
the generated code.
---
lib/compiler/test/beam_except_SUITE.erl | 4 ++--
lib/compiler/test/beam_ssa_SUITE.erl | 2 +-
lib/compiler/test/beam_utils_SUITE.erl | 6 +++---
lib/compiler/test/bs_match_SUITE.erl | 6 +++---
lib/compiler/test/core_fold_SUITE.erl | 2 +-
lib/compiler/test/fun_SUITE.erl | 4 ++--
lib/compiler/test/lc_SUITE.erl | 4 ++--
lib/compiler/test/match_SUITE.erl | 6 +++---
lib/compiler/test/trycatch_SUITE.erl | 2 +-
9 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lib/compiler/test/beam_except_SUITE.erl b/lib/compiler/test/beam_except_SUITE.erl
index 8530d4591f..93cb3b0688 100644
--- a/lib/compiler/test/beam_except_SUITE.erl
+++ b/lib/compiler/test/beam_except_SUITE.erl
@@ -57,8 +57,8 @@ multiple_allocs(_Config) ->
ok.
-could(Coupons = pda, Favorite = _pleasure = 0.0, {_, true}, {Presents}) ->
- (0 = true) = #{true => [Presents]}.
+could(_Coupons = pda, _Favorite = _pleasure = 0.0, {_, true}, {Presents}) ->
+ (0 = true) = #{true => [Presents]}.
place(lee) ->
(pregnancy = presentations) = [hours | [purchase || _ <- 0]] + wine.
diff --git a/lib/compiler/test/beam_ssa_SUITE.erl b/lib/compiler/test/beam_ssa_SUITE.erl
index 311ab556fc..590ee231ff 100644
--- a/lib/compiler/test/beam_ssa_SUITE.erl
+++ b/lib/compiler/test/beam_ssa_SUITE.erl
@@ -933,7 +933,7 @@ grab_bag_4() ->
end
end.
-grab_bag_5(A, B) when <<business:(node(power))>> ->
+grab_bag_5(_A, _B) when <<business:(node(power))>> ->
true.
grab_bag_6(face) ->
diff --git a/lib/compiler/test/beam_utils_SUITE.erl b/lib/compiler/test/beam_utils_SUITE.erl
index eb0af59f9d..f25a72e623 100644
--- a/lib/compiler/test/beam_utils_SUITE.erl
+++ b/lib/compiler/test/beam_utils_SUITE.erl
@@ -392,9 +392,9 @@ merchant([Merchant, Laws, Electric]) ->
if true; Electric -> Laws end) + 42.
oklahoma([], Int) -> Int.
-town(overall, {{If}, Healing = alcohol})
- when Healing#{[] => Healing}; include ->
- [If || Healing <- awareness].
+town(overall, {{If}, _Healing = alcohol})
+ when _Healing#{[] => _Healing}; include ->
+ [If || _Healing <- awareness].
%% Cover is_reg_used_at/3.
resulting([Conservation], stone) ->
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 5bb116752a..e9f7b74cf2 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -1623,9 +1623,9 @@ mos_int_receive(Msg) ->
Res.
mos_int_fun(B) ->
- L = ignore_me,
- F = fun ([<<L,I:L,X:32>>]) -> {I,X};
- ([<<L,I:L,X:64>>]) -> {I,X}
+ _L = ignore_me,
+ F = fun ([<<_L,I:_L,X:32>>]) -> {I,X};
+ ([<<_L,I:_L,X:64>>]) -> {I,X}
end,
F(B).
diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl
index c832d68fe4..9504ae7774 100644
--- a/lib/compiler/test/core_fold_SUITE.erl
+++ b/lib/compiler/test/core_fold_SUITE.erl
@@ -566,7 +566,7 @@ configuration(_Config) ->
ok.
configuration() ->
- [forgotten || Components <- enemy, is_tuple(fun art/0)].
+ [forgotten || _Components <- enemy, is_tuple(fun art/0)].
art() ->
creating.
diff --git a/lib/compiler/test/fun_SUITE.erl b/lib/compiler/test/fun_SUITE.erl
index 387ed90ee6..0bf014f8bc 100644
--- a/lib/compiler/test/fun_SUITE.erl
+++ b/lib/compiler/test/fun_SUITE.erl
@@ -60,7 +60,7 @@ end_per_group(_GroupName, Config) ->
l1() ->
[
- ?T((begin A = 3, F = fun(A) -> 1; (_) -> 2 end, F(2) end), 1),
+ ?T((begin _A = 3, F = fun(_A) -> 1; (_) -> 2 end, F(2) end), 1),
?T((begin G = fun(1=0) -> ok end, {'EXIT',_} = (catch G(2)), ok end), ok),
?T((begin F = fun(_, 1) -> 1; (F, N) -> N * F(F, N-1) end, F(F, 5) end), 120),
?T((begin F = fun(_, 1) -> 1; (F, N) -> N * F(F, N-1) end, F(F, 1), ok end), ok)
@@ -224,7 +224,7 @@ bad_external_fun() ->
eep37(Config) when is_list(Config) ->
F = fun Fact(N) when N > 0 -> N * Fact(N - 1); Fact(0) -> 1 end,
Add = fun _(N) -> N + 1 end,
- UnusedName = fun BlackAdder(N) -> N + 42 end,
+ UnusedName = fun _BlackAdder(N) -> N + 42 end,
720 = F(6),
10 = Add(9),
50 = UnusedName(8),
diff --git a/lib/compiler/test/lc_SUITE.erl b/lib/compiler/test/lc_SUITE.erl
index b8921755e0..351a0544b0 100644
--- a/lib/compiler/test/lc_SUITE.erl
+++ b/lib/compiler/test/lc_SUITE.erl
@@ -90,8 +90,8 @@ basic(Config) when is_list(Config) ->
"abc123" = alphanum("?abc123.;"),
%% Aliased patterns.
- [] = [t || {C=D}={_,_} <- []],
- [] = [X || {X,{Y}={X,X}} <- []],
+ [] = [t || {_C=_D}={_,_} <- []],
+ [] = [X || {X,{_Y}={X,X}} <- []],
[t] = [t || "a"++"b" = "ab" <- ["ab"]],
%% Strange filter block.
diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl
index e354c88730..699ddf08ac 100644
--- a/lib/compiler/test/match_SUITE.erl
+++ b/lib/compiler/test/match_SUITE.erl
@@ -351,8 +351,8 @@ entirely() ->
[receive _ -> Voice end || banking <- printer].
printer() ->
- {[Indoor] = [] = associates},
- [ireland || Indoor <- Indoor].
+ {[_Indoor] = [] = associates},
+ [ireland || _Indoor <- _Indoor].
tench() ->
E = begin
@@ -364,7 +364,7 @@ tench() ->
perch(X) ->
begin
put(perch, get(perch)+1),
- [A] = [] = {spine,X}
+ [_A] = [] = {spine,X}
end.
salmon() ->
diff --git a/lib/compiler/test/trycatch_SUITE.erl b/lib/compiler/test/trycatch_SUITE.erl
index 0c82f908b5..fa04571ee6 100644
--- a/lib/compiler/test/trycatch_SUITE.erl
+++ b/lib/compiler/test/trycatch_SUITE.erl
@@ -1257,7 +1257,7 @@ stacktrace(_Config) ->
try
throw(x)
catch
- throw:x:IntentionallyUnused ->
+ throw:x:_IntentionallyUnused ->
ok
end.
--
2.26.2