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. 4
      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)) assert(isinstance(node, mparser.PlusAssignmentNode))
varname = node.var_name varname = node.var_name
addition = self.evaluate_statement(node.value) 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 # Remember that all variables are immutable. We must always create a
# full new variable and then assign it. # full new variable and then assign it.
old_variable = self.get_variable(varname) old_variable = self.get_variable(varname)

@ -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