File 2641-snmp-Dialyzer-fixes.patch of Package erlang
From 2b285f1dddc89ac2b4194c16bdb3cc92a89c9976 Mon Sep 17 00:00:00 2001
From: Micael Karlberg <bmk@erlang.org>
Date: Wed, 12 Jun 2019 09:41:56 +0200
Subject: [PATCH 1/6] [snmp] Dialyzer fixes
Make target (for running dialyzer on snmp), os usage
and a minor snmp_log ("future proofing").
OTP-15932
---
lib/snmp/Makefile | 10 ++++++++--
lib/snmp/src/app/snmp.erl | 9 ++-------
lib/snmp/src/misc/snmp_log.erl | 1 +
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/lib/snmp/Makefile b/lib/snmp/Makefile
index 879f1b05c5..f73335d57e 100644
--- a/lib/snmp/Makefile
+++ b/lib/snmp/Makefile
@@ -136,11 +136,17 @@ dclean:
dialyzer_plt: $(DIA_PLT)
-$(DIA_PLT):
+$(DIA_PLT): Makefile
@echo "Building $(APPLICATION) plt file"
@dialyzer --build_plt \
--output_plt $@ \
-r ../$(APPLICATION)/ebin \
+ ../../lib/kernel/ebin \
+ ../../lib/stdlib/ebin \
+ ../../lib/runtime_tools/ebin \
+ ../../lib/crypto/ebin \
+ ../../lib/mnesia/ebin \
+ ../../erts/preloaded/ebin \
--output $(DIA_ANALYSIS) \
--verbose
diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl
index 216452afdd..490d2b9810 100644
--- a/lib/snmp/src/app/snmp.erl
+++ b/lib/snmp/src/app/snmp.erl
@@ -711,13 +711,8 @@ sys_info() ->
[{arch, SysArch}, {ver, SysVer}].
os_info() ->
- V = os:version(),
- case os:type() of
- {OsFam, OsName} ->
- [{fam, OsFam}, {name, OsName}, {ver, V}];
- OsFam ->
- [{fam, OsFam}, {ver, V}]
- end.
+ {OsFam, OsName} = os:type(),
+ [{fam, OsFam}, {name, OsName}, {ver, os:version()}].
ms1() ->
App = ?APPLICATION,
diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl
index 5713c14912..9ae5c1109b 100644
--- a/lib/snmp/src/misc/snmp_log.erl
+++ b/lib/snmp/src/misc/snmp_log.erl
@@ -343,6 +343,7 @@ validate_loop({Cont, Terms, BadBytes}, Log, Validator, PrevTS, PrevSN) ->
"~n NextTS: ~p"
"~n NextSN: ~p", [NextTS, NextSN]),
validate_loop(disk_log:chunk(Log, Cont), Log, Validator, NextTS, NextSN);
+-dialyzer({nowarn_function, validate_loop/5}). % Future compat
validate_loop(Error, _Log, _Write, _PrevTS, _PrevSN) ->
Error.
--
2.16.4