File 2309-compile-Add-missing-types-and-specs.patch of Package erlang

From f5c890993a5ee52338d9edd669e380d751c5f8aa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 15 Dec 2016 09:16:09 +0100
Subject: [PATCH 09/21] compile: Add missing types and specs

---
 lib/compiler/src/compile.erl | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl
index a28cd193c..069add789 100644
--- a/lib/compiler/src/compile.erl
+++ b/lib/compiler/src/compile.erl
@@ -228,6 +228,8 @@ expand_opt(O, Os) -> [O|Os].
 
 %% format_error(ErrorDescriptor) -> string()
 
+-spec format_error(term()) -> iolist().
+
 format_error(no_native_support) ->
     "this system is not configured for native-code compilation.";
 format_error(no_crypto) ->
@@ -288,21 +290,23 @@ format_error_reason({Reason, Stack}) when is_list(Stack) ->
 format_error_reason(Reason) ->
     io_lib:format("~tp", [Reason]).
 
+-type err_warn_info() :: tuple().
+
 %% The compile state record.
 -record(compile, {filename="" :: file:filename(),
 		  dir=""      :: file:filename(),
 		  base=""     :: file:filename(),
 		  ifile=""    :: file:filename(),
 		  ofile=""    :: file:filename(),
-		  module=[],
-		  code=[],
-		  core_code=[],
-		  abstract_code=[],		%Abstract code for debugger.
-		  options=[]  :: [option()],	%Options for compilation
+		  module=[]   :: module() | [],
+		  code=[]     :: list(),
+		  core_code=[] :: cerl:c_module() | [],
+		  abstract_code=[] :: binary() | [], %Abstract code for debugger.
+		  options=[]  :: [option()],  %Options for compilation
 		  mod_options=[]  :: [option()], %Options for module_info
                   encoding=none :: none | epp:source_encoding(),
-		  errors=[],
-		  warnings=[]}).
+		  errors=[]     :: [err_warn_info()],
+		  warnings=[]   :: [err_warn_info()]}).
 
 internal({forms,Forms}, Opts0) ->
     {_,Ps} = passes(forms, Opts0),
@@ -1600,6 +1604,9 @@ list_errors(_F, []) -> ok.
 %% tmpfile(ObjFile) -> TmpFile
 %%  Work out the correct input and output file names.
 
+-spec iofile(atom() | file:filename_all()) ->
+                    {file:name_all(),file:name_all()}.
+
 iofile(File) when is_atom(File) ->
     iofile(atom_to_list(File));
 iofile(File) ->
@@ -1734,6 +1741,8 @@ help(_) ->
 %% compile(AbsFileName, Outfilename, Options)
 %%   Compile entry point for erl_compile.
 
+-spec compile(file:filename(), _, #options{}) -> 'ok' | 'error'.
+
 compile(File0, _OutFile, Options) ->
     pre_load(),
     File = shorten_filename(File0),
@@ -1742,6 +1751,8 @@ compile(File0, _OutFile, Options) ->
 	Other -> Other
     end.
 
+-spec compile_beam(file:filename(), _, #options{}) -> 'ok' | 'error'.
+
 compile_beam(File0, _OutFile, Opts) ->
     File = shorten_filename(File0),
     case file(File, [from_beam|make_erl_options(Opts)]) of
@@ -1749,6 +1760,8 @@ compile_beam(File0, _OutFile, Opts) ->
 	Other -> Other
     end.
 
+-spec compile_asm(file:filename(), _, #options{}) -> 'ok' | 'error'.
+
 compile_asm(File0, _OutFile, Opts) ->
     File = shorten_filename(File0),
     case file(File, [from_asm|make_erl_options(Opts)]) of
@@ -1756,6 +1769,8 @@ compile_asm(File0, _OutFile, Opts) ->
 	Other -> Other
     end.
 
+-spec compile_core(file:filename(), _, #options{}) -> 'ok' | 'error'.
+
 compile_core(File0, _OutFile, Opts) ->
     File = shorten_filename(File0),
     case file(File, [from_core|make_erl_options(Opts)]) of
-- 
2.11.0

openSUSE Build Service is sponsored by