File 0202-Make-erl_features-pass-on-command-line-enabled-featu.patch of Package erlang

From 5cfb5c86e83a691c3a2b30cac815363a99012e83 Mon Sep 17 00:00:00 2001
From: Richard Carlsson <carlsson.richard@gmail.com>
Date: Thu, 30 Jan 2025 16:58:49 +0100
Subject: [PATCH 2/3] Make erl_features pass on command line enabled features

Even if -enable-feature was specified, the compiler only got the
list of features that were enabled by default.
---
 lib/stdlib/src/erl_features.erl | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/stdlib/src/erl_features.erl b/lib/stdlib/src/erl_features.erl
index 4218e7cc89..3a84c34447 100644
--- a/lib/stdlib/src/erl_features.erl
+++ b/lib/stdlib/src/erl_features.erl
@@ -93,6 +93,10 @@ all() ->
           end,
     lists:sort(maps:keys(Map)).
 
+approved() ->
+    [Ftr || Ftr <- all(),
+            maps:get(status, info(Ftr)) =:= approved].
+
 -doc """
 Return a list of all configurable features, that is, features with status
 `experimental` or `approved`. These are the features that can be enabled or
@@ -228,8 +232,7 @@ keyword_fun(Opts, KeywordFun) ->
                (_) -> false
             end,
     FeatureOps = lists:filter(IsFtr, Opts),
-    {AddFeatures, DelFeatures, RawFtrs} = collect_features(FeatureOps),
-
+    {AddFeatures, DelFeatures, RawFtrs} = collect_features(FeatureOps, enabled()),
     case configurable_features(RawFtrs) of
         ok ->
             {ok, Fun} = add_features_fun(AddFeatures, KeywordFun),
@@ -401,7 +404,7 @@ init_features() ->
                 end
         end,
     FOps = lists:filtermap(F, FeatureOps),
-    {Features, _, _} = collect_features(FOps),
+    {Features, _, _} = collect_features(FOps, approved()),
     {Enabled0, Keywords} =
         lists:foldl(fun(Ftr, {Ftrs, Keys}) ->
                             case lists:member(Ftr, Ftrs) of
@@ -492,13 +495,10 @@ features_in(NameOrBin) ->
     end.
 
 %% Interpret feature ops (enable or disable) to build the full set of
-%% features.  The meta feature 'all' is expanded to all known
-%% features.
-collect_features(FOps) ->
-    %% Features enabled by default
-    Enabled = [Ftr || Ftr <- all(),
-            maps:get(status, info(Ftr)) == approved],
-    collect_features(FOps, Enabled, [], []).
+%% features, starting from the given set. The meta feature 'all' is
+%% expanded to all known features.
+collect_features(FOps, Inital) ->
+    collect_features(FOps, Inital, [], []).
 
 collect_features([], Add, Del, Raw) ->
     {Add, Del, Raw};
-- 
2.51.0

openSUSE Build Service is sponsored by