Skip to content

Commit 7f418f4

Browse files
bridadanCruz Monrreal II
authored andcommitted
Config parameters override macros
1 parent b4f4ac6 commit 7f418f4

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

tools/config/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,8 +1081,8 @@ def _check_required_parameters(params):
10811081
def _parameters_and_config_macros_to_macros(params, macros):
10821082
""" Return the macro definitions generated for a dictionary of
10831083
ConfigParameters and a dictionary of ConfigMacros (as returned by
1084-
get_config_data). The ConfigMacros override any matching macros set by
1085-
the ConfigParameters.
1084+
get_config_data). The ConfigParameters override any matching macros set
1085+
by the ConfigMacros.
10861086
10871087
Positional arguments:
10881088
params - a dictionary mapping a name to a ConfigParameter
@@ -1091,14 +1091,14 @@ def _parameters_and_config_macros_to_macros(params, macros):
10911091
Return: a list of strings that are the C pre-processor macros
10921092
"""
10931093
all_macros = {
1094-
p.macro_name: p.value for p in params.values() if p.value is not None
1094+
m.macro_name: m.macro_value for m in macros.values()
10951095
}
10961096

1097-
config_macros = {
1098-
m.macro_name: m.macro_value for m in macros.values()
1097+
parameter_macros = {
1098+
p.macro_name: p.value for p in params.values() if p.value is not None
10991099
}
11001100

1101-
all_macros.update(config_macros)
1101+
all_macros.update(parameter_macros)
11021102
macro_list = []
11031103
for name, value in all_macros.items():
11041104
# If the macro does not have a value, just append the name.

tools/test/config/config_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ def test_basic_regions(target, overrides):
199199

200200
def test_parameters_and_config_macros_to_macros():
201201
"""
202-
Test that checks that parameter-generated macros get overriden with
203-
explicitly set macros
202+
Test that checks that parameter-generated macros override set macros
204203
"""
205204

206205
params = {
@@ -224,4 +223,4 @@ def test_parameters_and_config_macros_to_macros():
224223
}
225224

226225
macro_list = Config._parameters_and_config_macros_to_macros(params, macros)
227-
assert macro_list == ["CUSTOM_MACRO_NAME=2"]
226+
assert macro_list == ["CUSTOM_MACRO_NAME=1"]

0 commit comments

Comments
 (0)