Skip to content

Commit adfee44

Browse files
authored
prevent disabler() object from overwriting arrays (mesonbuild#7484)
* prevent disabler object from overwriting arrays fixes mesonbuild#7107 * fix failing test forgot that func() != func(void) in c
1 parent 7092efa commit adfee44

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

mesonbuild/interpreterbase.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -810,9 +810,7 @@ def evaluate_plusassign(self, node: mparser.PlusAssignmentNode) -> None:
810810
assert(isinstance(node, mparser.PlusAssignmentNode))
811811
varname = node.var_name
812812
addition = self.evaluate_statement(node.value)
813-
if is_disabler(addition):
814-
self.set_variable(varname, addition)
815-
return
813+
816814
# Remember that all variables are immutable. We must always create a
817815
# full new variable and then assign it.
818816
old_variable = self.get_variable(varname)
@@ -836,7 +834,7 @@ def evaluate_plusassign(self, node: mparser.PlusAssignmentNode) -> None:
836834
new_value = {**old_variable, **addition}
837835
# Add other data types here.
838836
else:
839-
raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints ')
837+
raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints')
840838
self.set_variable(varname, new_value)
841839

842840
def evaluate_indexing(self, node: mparser.IndexNode) -> TYPE_var:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
project('disabler_inside_array', 'c')
2+
3+
exes = []
4+
5+
exes += library('a', 'test.c')
6+
7+
exes += library('b', 'test.c', dependencies : disabler())
8+
9+
exes += library('c', 'test.c')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int stub(void) { return 0; }

0 commit comments

Comments
 (0)