File 1046-compile-Remove-unreachable-code.patch of Package erlang
From 45fab08fc2705fc24315003734bd3dc8bb7c1db1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 4 Nov 2020 09:30:31 +0100
Subject: [PATCH] compile: Remove unreachable code
Remove code that has been unreachable since `sys_pre_expand` was
removed in OTP 19. When `sys_pre_expand` was removed, the first
clause of `restore_expanded_types/2` no longer matched because
the second argument was no longer a tuple.
Noticed-by: Richard Carlsson
---
lib/compiler/src/compile.erl | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index 5e9edeaa8f..94db7e34bf 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -1805,7 +1805,6 @@ listing(LFun, Ext, Code, St) ->
Lfile = outfile(St#compile.base, Ext, St#compile.options),
case file:open(Lfile, [write,delayed_write]) of
{ok,Lf} ->
- Code = restore_expanded_types(Ext, Code),
output_encoding(Lf, St),
LFun(Lf, Code),
ok = file:close(Lf),
@@ -1836,26 +1835,6 @@ output_encoding(F, #compile{encoding = Encoding}) ->
ok = io:setopts(F, [{encoding, Encoding}]),
ok = io:fwrite(F, <<"%% ~s\n">>, [epp:encoding_to_string(Encoding)]).
-restore_expanded_types("E", {M,I,Fs0}) ->
- Fs = restore_expand_module(Fs0),
- {M,I,Fs};
-restore_expanded_types(_Ext, Code) -> Code.
-
-restore_expand_module([{attribute,Line,type,[Type]}|Fs]) ->
- [{attribute,Line,type,Type}|restore_expand_module(Fs)];
-restore_expand_module([{attribute,Line,opaque,[Type]}|Fs]) ->
- [{attribute,Line,opaque,Type}|restore_expand_module(Fs)];
-restore_expand_module([{attribute,Line,spec,[Arg]}|Fs]) ->
- [{attribute,Line,spec,Arg}|restore_expand_module(Fs)];
-restore_expand_module([{attribute,Line,callback,[Arg]}|Fs]) ->
- [{attribute,Line,callback,Arg}|restore_expand_module(Fs)];
-restore_expand_module([{attribute,Line,record,[R]}|Fs]) ->
- [{attribute,Line,record,R}|restore_expand_module(Fs)];
-restore_expand_module([F|Fs]) ->
- [F|restore_expand_module(Fs)];
-restore_expand_module([]) -> [].
-
-
-spec options() -> 'ok'.
options() ->
--
2.26.2