pull/5380/head
Daniel Mensinger 5 years ago committed by Jussi Pakkanen
parent 40ff089e69
commit cacc585b44
  1. 10
      mesonbuild/ast/interpreter.py
  2. 2
      mesonbuild/ast/introspection.py
  3. 3
      mesonbuild/mconf.py
  4. 7
      test cases/unit/55 introspection/meson.build

@ -260,6 +260,12 @@ class AstInterpreter(interpreterbase.InterpreterBase):
id_loop_detect = []
flattend_args = []
if isinstance(args, BaseNode):
assert(hasattr(args, 'ast_id'))
if args.ast_id in id_loop_detect:
return [] # Loop detected
id_loop_detect += [args.ast_id]
if isinstance(args, ArrayNode):
args = [x for x in args.args.arguments]
@ -301,8 +307,8 @@ class AstInterpreter(interpreterbase.InterpreterBase):
# Resolve the contents of args
for i in args:
if isinstance(i, IdNode) and i.value not in id_loop_detect:
flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value])
if isinstance(i, IdNode):
flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect)
elif isinstance(i, (ArrayNode, ArgumentNode, ArithmeticNode, MethodNode)):
flattend_args += self.flatten_args(i, include_unknown_args, id_loop_detect)
elif isinstance(i, mparser.ElementaryNode):

@ -118,7 +118,7 @@ class IntrospectionInterpreter(AstInterpreter):
subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir)
subpr = os.path.join(subproject_dir_abs, dirname)
try:
subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment)
subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment, visitors=self.visitors)
subi.analyze()
subi.project_data['name'] = dirname
self.project_data['subprojects'] += [subi.project_data]

@ -14,6 +14,7 @@
import os
from . import coredata, environment, mesonlib, build, mintro, mlog
from .ast import AstIDGenerator
def add_arguments(parser):
coredata.register_builtin_arguments(parser)
@ -52,7 +53,7 @@ class Conf:
# Make sure that log entries in other parts of meson don't interfere with the JSON output
mlog.disable()
self.source_dir = os.path.abspath(os.path.realpath(self.build_dir))
intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja')
intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja', visitors = [AstIDGenerator()])
intr.analyze()
# Reenable logging just in case
mlog.enable()

@ -34,6 +34,13 @@ systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machin
message(systype)
### END: Test inspired by taisei
# Minimal code version to produce bug #5376
# Code inspired by https://github.com/mesa3d/mesa/blob/974c4d679c23373dbed386c696e3e3bc1bfa23ae/meson.build#L1341-L1347
osmesa_lib_name = 'OSMesa'
osmesa_bits = '8'
osmesa_lib_name = osmesa_lib_name + osmesa_bits
message(osmesa_lib_name) # Infinite recursion gets triggered here when the parameter osmesa_lib_name is resolved
test('test case 1', t1)
test('test case 2', t2)
benchmark('benchmark 1', t3)

Loading…
Cancel
Save