File 0475-snmp-Add-missing-specs-to-documented-functions.patch of Package erlang
From 7050ba7e401be0224ba49fa08c879c7ea3923fb7 Mon Sep 17 00:00:00 2001
From: Konrad Pietrzak <konrad@erlang.org>
Date: Mon, 25 Aug 2025 14:14:31 +0200
Subject: [PATCH] [snmp] Add missing specs to documented functions
---
lib/snmp/src/agent/snmp_generic.erl | 19 +++++++++++++++++++
lib/snmp/src/compile/Makefile | 3 +--
lib/snmp/src/compile/snmpc.erl | 4 ++++
lib/snmp/src/manager/Makefile | 3 +--
4 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl
index d041e3055a..f25078e452 100644
--- a/lib/snmp/src/agent/snmp_generic.erl
+++ b/lib/snmp/src/agent/snmp_generic.erl
@@ -342,6 +342,14 @@ values. This means that this function must be called from within a transaction
(`mnesia:transaction/1`).
""".
+-spec table_set_elements(NameDb, RowIndex, Columns) -> Result when
+ NameDb :: snmpa:name_db(),
+ RowIndex :: snmp:row_index(),
+ Columns :: [{Column, Value}],
+ Column :: column(),
+ Value :: term(),
+ Result :: boolean().
+
table_set_elements({Name, mnesia}, RowIndex, Cols) ->
snmp_generic_mnesia:table_set_elements(Name, RowIndex, Cols);
table_set_elements(NameDb, RowIndex, Cols) -> % ret true
@@ -354,6 +362,12 @@ Finds the indices of the next row in the table. `RestOid` does not have to
specify an existing row.
""".
+-spec table_next(NameDb, RestOid) -> Result when
+ NameDb :: snmpa:name_db(),
+ RestOid :: [integer()],
+ Result :: RowIndex | endOfTable,
+ RowIndex :: snmp:row_index().
+
table_next({Name, mnesia}, RestOid) ->
snmp_generic_mnesia:table_next(Name, RestOid);
table_next(NameDb, RestOid) -> % ret RRestOid | endOfTable
@@ -1021,6 +1035,11 @@ collect_length(N, [El | Rest], Rts) ->
-doc """
Checks if a row in a table exists.
""".
+-spec table_row_exists(NameDb, RowIndex) -> Result when
+ NameDb :: snmpa:name_db(),
+ RowIndex :: snmp:row_index(),
+ Result :: boolean().
+
table_row_exists(NameDb, RowIndex) ->
case table_get_element(NameDb, RowIndex, 1) of
undefined -> false;
diff --git a/lib/snmp/src/compile/Makefile b/lib/snmp/src/compile/Makefile
index 17c88baf94..19db7feeb8 100644
--- a/lib/snmp/src/compile/Makefile
+++ b/lib/snmp/src/compile/Makefile
@@ -83,8 +83,7 @@ ERL_COMPILE_FLAGS += -I../../include \
-Dversion=\"$(VSN)$(PRE_VSN)\" \
+'{parse_transform,sys_pre_attributes}' \
+'{attribute,insert,app_vsn,$(APP_VSN)}' \
- -I$(ERL_TOP)/lib/stdlib \
- +nowarn_missing_spec_documented
+ -I$(ERL_TOP)/lib/stdlib
YRL_FLAGS = -o .
diff --git a/lib/snmp/src/compile/snmpc.erl b/lib/snmp/src/compile/snmpc.erl
index 76656a5009..9e892272a3 100644
--- a/lib/snmp/src/compile/snmpc.erl
+++ b/lib/snmp/src/compile/snmpc.erl
@@ -81,6 +81,10 @@ The `mib_to_hrl` generator can be invoked from the OS command line by using the
command `erlc`. `erlc` recognizes the extension `.bin`, and invokes this
function for files with that extension.
""".
+-spec mib_to_hrl(MibName) -> Result when
+ MibName :: string(),
+ Result :: ok | {error, Reason},
+ Reason :: term().
mib_to_hrl(MibName) ->
snmpc_mib_to_hrl:convert(MibName).
diff --git a/lib/snmp/src/manager/Makefile b/lib/snmp/src/manager/Makefile
index 483a9e1889..6afc72fc32 100644
--- a/lib/snmp/src/manager/Makefile
+++ b/lib/snmp/src/manager/Makefile
@@ -95,8 +95,7 @@ ERL_COMPILE_FLAGS += -I../../include \
+'{parse_transform,sys_pre_attributes}' \
+'{attribute,insert,app_vsn,$(APP_VSN)}' \
-I$(ERL_TOP)/lib/stdlib \
- $(SNMP_FLAGS) \
- +nowarn_missing_spec_documented
+ $(SNMP_FLAGS)
# ----------------------------------------------------
--
2.43.0