Skip to content

Commit d946f02

Browse files
committed
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.
1 parent fbd1c37 commit d946f02

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/stdlib/src/erl_features.erl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ all() ->
9999
end,
100100
lists:sort(maps:keys(Map)).
101101

102+
approved() ->
103+
[Ftr || Ftr <- all(),
104+
maps:get(status, info(Ftr)) =:= approved].
105+
102106
-doc """
103107
Return a list of all configurable features, that is, features with status
104108
`experimental` or `approved`. These are the features that can be enabled or
@@ -234,8 +238,7 @@ keyword_fun(Opts, KeywordFun) ->
234238
(_) -> false
235239
end,
236240
FeatureOps = lists:filter(IsFtr, Opts),
237-
{AddFeatures, DelFeatures, RawFtrs} = collect_features(FeatureOps),
238-
241+
{AddFeatures, DelFeatures, RawFtrs} = collect_features(FeatureOps, enabled()),
239242
case configurable_features(RawFtrs) of
240243
ok ->
241244
{ok, Fun} = add_features_fun(AddFeatures, KeywordFun),
@@ -407,7 +410,7 @@ init_features() ->
407410
end
408411
end,
409412
FOps = lists:filtermap(F, FeatureOps),
410-
{Features, _, _} = collect_features(FOps),
413+
{Features, _, _} = collect_features(FOps, approved()),
411414
{Enabled0, Keywords} =
412415
lists:foldl(fun(Ftr, {Ftrs, Keys}) ->
413416
case lists:member(Ftr, Ftrs) of
@@ -498,13 +501,10 @@ features_in(NameOrBin) ->
498501
end.
499502

500503
%% Interpret feature ops (enable or disable) to build the full set of
501-
%% features. The meta feature 'all' is expanded to all known
502-
%% features.
503-
collect_features(FOps) ->
504-
%% Features enabled by default
505-
Enabled = [Ftr || Ftr <- all(),
506-
maps:get(status, info(Ftr)) == approved],
507-
collect_features(FOps, Enabled, [], []).
504+
%% features, starting from the given set. The meta feature 'all' is
505+
%% expanded to all known features.
506+
collect_features(FOps, Inital) ->
507+
collect_features(FOps, Inital, [], []).
508508

509509
collect_features([], Add, Del, Raw) ->
510510
{Add, Del, Raw};

0 commit comments

Comments
 (0)