1def getRoot(config): 2 if not config.parent: 3 return config 4 return getRoot(config.parent) 5 6root = getRoot(config) 7 8if 'libdispatch' in root.available_features: 9 additional_cflags = ' -fblocks ' 10 for index, (template, replacement) in enumerate(config.substitutions): 11 if template in ['%clang_tsan ', '%clangxx_tsan ']: 12 config.substitutions[index] = (template, replacement + additional_cflags) 13else: 14 config.unsupported = True 15 16if config.host_os == 'Darwin': 17 config.environment['TSAN_OPTIONS'] += ':ignore_noninstrumented_modules=1' 18