Package not found: openSUSE:Factory/dstat

File 0737-asn1-Avoid-warning-for-exported-variables.patch of Package erlang

From e1bd4562a45017a748ae35a9f7102109629e0c67 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 16 Feb 2026 09:23:38 +0100
Subject: [PATCH] asn1: Avoid warning for exported variables

Compiling a CHOICE with extensions using the `warn_exported_vars`
compiler option would result in a warning that variables were exported
out of begin block. It turns out that there is no need for a begin
block in this particular code.
---
 lib/asn1/src/asn1ct_constructed_per.erl | 4 +---
 lib/asn1/test/asn1_test_lib.erl         | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl
index 6907478bd3..eb5a51cf68 100644
--- a/lib/asn1/src/asn1ct_constructed_per.erl
+++ b/lib/asn1/src/asn1ct_constructed_per.erl
@@ -1865,11 +1865,9 @@ gen_dec_choice1(Erule, TopType, CompList, noext=Ext) ->
 gen_dec_choice1(Erule, TopType, CompList, {ext,_,_}=Ext) ->
     emit_getchoice(Erule, CompList, Ext),
     Imm = asn1ct_imm:per_dec_open_type(is_aligned(Erule)),
-    emit(["begin",nl]),
     BytesVar = asn1ct_gen:mk_var(asn1ct_name:curr(bytes)),
     {Dst,DstBuf} = asn1ct_imm:dec_slim_cg(Imm, BytesVar),
-    emit([nl,
-	  "end,",nl,
+    emit([",",nl,
 	  "case Choice of",nl]),
     Pre = {safe,fun(St) ->
 			emit(["{TmpVal,_} = "]),
diff --git a/lib/asn1/test/asn1_test_lib.erl b/lib/asn1/test/asn1_test_lib.erl
index ef6e5841a4..8196f8b9cf 100644
--- a/lib/asn1/test/asn1_test_lib.erl
+++ b/lib/asn1/test/asn1_test_lib.erl
@@ -91,7 +91,7 @@ module(F0) ->
 %%    filename:join(CaseDir, F ++ ".beam").
 
 compile_file(File, Options0) ->
-    Options = [warnings_as_errors|Options0],
+    Options = [warn_export_vars,warnings_as_errors|Options0],
     try
         ok = asn1ct:compile(File, Options),
         ok = compile_maps(File, Options)
-- 
2.51.0

openSUSE Build Service is sponsored by