Skip to content

Commit fa4ead0

Browse files
committed
Config parameters override macros
1 parent b8cdfc5 commit fa4ead0

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
@@ -1095,8 +1095,8 @@ def _check_required_parameters(params):
10951095
def _parameters_and_config_macros_to_macros(params, macros):
10961096
""" Return the macro definitions generated for a dictionary of
10971097
ConfigParameters and a dictionary of ConfigMacros (as returned by
1098-
get_config_data). The ConfigMacros override any matching macros set by
1099-
the ConfigParameters.
1098+
get_config_data). The ConfigParameters override any matching macros set
1099+
by the ConfigMacros.
11001100
11011101
Positional arguments:
11021102
params - a dictionary mapping a name to a ConfigParameter
@@ -1105,14 +1105,14 @@ def _parameters_and_config_macros_to_macros(params, macros):
11051105
Return: a list of strings that are the C pre-processor macros
11061106
"""
11071107
all_macros = {
1108-
p.macro_name: p.value for p in params.values() if p.value is not None
1108+
m.macro_name: m.macro_value for m in macros.values()
11091109
}
11101110

1111-
config_macros = {
1112-
m.macro_name: m.macro_value for m in macros.values()
1111+
parameter_macros = {
1112+
p.macro_name: p.value for p in params.values() if p.value is not None
11131113
}
11141114

1115-
all_macros.update(config_macros)
1115+
all_macros.update(parameter_macros)
11161116
macro_list = []
11171117
for name, value in all_macros.items():
11181118
# 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)