prevent disabler() object from overwriting arrays (#7484)

* prevent disabler object from overwriting arrays

fixes #7107

* fix failing test

forgot that func() != func(void) in c
pull/7517/head
Elliot 4 years ago committed by GitHub
parent 7092efabb5
commit adfee4460a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      mesonbuild/interpreterbase.py
  2. 9
      test cases/common/235 disabler array addition/meson.build
  3. 1
      test cases/common/235 disabler array addition/test.c

@ -810,9 +810,7 @@ The result of this is undefined and will become a hard error in a future Meson r
assert(isinstance(node, mparser.PlusAssignmentNode))
varname = node.var_name
addition = self.evaluate_statement(node.value)
if is_disabler(addition):
self.set_variable(varname, addition)
return
# Remember that all variables are immutable. We must always create a
# full new variable and then assign it.
old_variable = self.get_variable(varname)
@ -836,7 +834,7 @@ The result of this is undefined and will become a hard error in a future Meson r
new_value = {**old_variable, **addition}
# Add other data types here.
else:
raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints ')
raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints')
self.set_variable(varname, new_value)
def evaluate_indexing(self, node: mparser.IndexNode) -> TYPE_var:

@ -0,0 +1,9 @@
project('disabler_inside_array', 'c')
exes = []
exes += library('a', 'test.c')
exes += library('b', 'test.c', dependencies : disabler())
exes += library('c', 'test.c')
Loading…
Cancel
Save