File 1196-Document-previously-hidden-though-very-useful-compil.patch of Package erlang
From 5e4e67c1a4cce3f813f7d4d27df8c2028c92c77f Mon Sep 17 00:00:00 2001
From: "Paulo F. Oliveira" <paulo.ferraz.oliveira@gmail.com>
Date: Tue, 8 Dec 2020 17:37:07 +0000
Subject: [PATCH] Document previously hidden (though very useful) compiler
 options
---
 lib/compiler/doc/src/compile.xml   | 14 ++++++++++++++
 lib/stdlib/test/erl_lint_SUITE.erl | 25 +++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/lib/compiler/doc/src/compile.xml b/lib/compiler/doc/src/compile.xml
index 94180b4733..0e2f29aa9d 100644
--- a/lib/compiler/doc/src/compile.xml
+++ b/lib/compiler/doc/src/compile.xml
@@ -637,6 +637,20 @@ module.beam: module.erl \
 	    by default there will be a warning if <c>get_stacktrace/0</c> is
 	    used following a <c>catch</c> expression.</p>
           </item>
+
+          <tag><c>warn_missing_spec</c></tag>
+          <item>
+              <p>By default, warnings are not emitted when a specification
+                (or contract) for an exported function is not given. Use this
+                option to turn on this kind of warning.</p>
+          </item>
+
+          <tag><c>warn_missing_spec_all</c></tag>
+          <item>
+              <p>By default, warnings are not emitted when a specification
+                (or contract) for an exported or unexported function is not
+                given. Use this option to turn on this kind of warning.</p>
+          </item>
         </taglist>
 
 	<p>Another class of warnings is generated by the compiler
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index 20f8407f85..85567c88cb 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -68,7 +68,8 @@
          non_latin1_module/1, otp_14323/1,
          otp_15563/1,
          get_stacktrace/1, otp_14285/1, otp_14378/1,
-         unused_type/1, otp_16516/1]).
+         unused_type/1, otp_16516/1,
+         warn_missing_spec/1]).
 
 suite() ->
     [{ct_hooks,[ts_install_cth]},
@@ -91,7 +92,8 @@ all() ->
      record_errors, otp_11879_cont, non_latin1_module, otp_14323,
      otp_15563,
      get_stacktrace, otp_14285, otp_14378,
-     unused_type, otp_16516].
+     unused_type, otp_16516,
+     warn_missing_spec].
 
 groups() -> 
     [{unused_vars_warn, [],
@@ -4346,6 +4348,26 @@ inline_nifs(Config) ->
              {5,erl_lint,{unused_var,'V2'}}]}}],
     [] = run(Config, Ts).
 
+warn_missing_spec(Config) ->
+    Test = <<"-export([external_with_spec/0, external_no_spec/0]).
+
+              -spec external_with_spec() -> ok.
+              external_with_spec() -> ok.
+
+              external_no_spec() -> ok.
+
+              -spec internal_with_spec() -> ok.
+              internal_with_spec() -> ok.
+
+              internal_no_spec() -> ok.">>,
+    run(Config, [
+        {warn_missing_spec, Test, [warn_missing_spec],
+            {warnings, [{6, erl_lint, {missing_spec, {external_no_spec, 0}}}]}},
+        {warn_missing_spec_all, Test, [warn_missing_spec_all],
+            {warnings, [{6, erl_lint, {missing_spec, {external_no_spec, 0}}},
+                        {11, erl_lint, {missing_spec, {internal_no_spec, 0}}}]}}
+    ]).
+
 format_error(E) ->
     lists:flatten(erl_lint:format_error(E)).
 
-- 
2.26.2