Added some cahced values

pull/4952/head
Daniel Mensinger 6 years ago
parent dfe3d56bfd
commit 971dfd664b
No known key found for this signature in database
GPG Key ID: 54DD94C131E277D4
  1. 7
      mesonbuild/compilers/c.py
  2. 5
      mesonbuild/compilers/cuda.py
  3. 2
      mesonbuild/compilers/d.py
  4. 2
      mesonbuild/dependencies/boost.py
  5. 2
      mesonbuild/dependencies/misc.py
  6. 5
      mesonbuild/interpreter.py

@ -653,12 +653,13 @@ class CCompiler(Compiler):
args = self._get_compiler_check_args(env, extra_args, dependencies,
mode='preprocess').to_native()
with self.compile(code.format(**fargs), args, 'preprocess', cdata=env.coredata) as p:
cached = p.cached
if p.returncode != 0:
raise EnvironmentException('Could not get define {!r}'.format(dname))
# Get the preprocessed value after the delimiter,
# minus the extra newline at the end and
# merge string literals.
return CCompiler.concatenate_string_literals(p.stdo.split(delim + '\n')[-1][:-1])
return CCompiler.concatenate_string_literals(p.stdo.split(delim + '\n')[-1][:-1]), cached
def get_return_value(self, fname, rtype, prefix, env, extra_args, dependencies):
if rtype == 'string':
@ -1202,7 +1203,7 @@ class CCompiler(Compiler):
if not (for_windows(env.is_cross_build(), env) or
for_cygwin(env.is_cross_build(), env)):
if name in ['dllimport', 'dllexport']:
return False
return False, False
# Clang and GCC both return warnings if the __attribute__ is undefined,
# so set -Werror
@ -1707,7 +1708,7 @@ class VisualStudioCCompiler(CCompiler):
def has_func_attribute(self, name, env):
# MSVC doesn't have __attribute__ like Clang and GCC do, so just return
# false without compiling anything
return name in ['dllimport', 'dllexport']
return name in ['dllimport', 'dllexport'], False
def get_argument_syntax(self):
return 'msvc'

@ -146,8 +146,9 @@ class CudaCompiler(Compiler):
return super().get_compiler_check_args() + []
def has_header_symbol(self, hname, symbol, prefix, env, extra_args=None, dependencies=None):
if super().has_header_symbol(hname, symbol, prefix, env, extra_args, dependencies):
return True
result, cached = super().has_header_symbol(hname, symbol, prefix, env, extra_args, dependencies)
if result:
return True, cached
if extra_args is None:
extra_args = []
fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}

@ -327,7 +327,7 @@ class DCompiler(Compiler):
args = self._get_compiler_check_args(env, extra_args, dependencies, mode)
with self.compile(code, args, mode, cdata=env.coredata) as p:
return p.returncode == 0
return p.returncode == 0, p.cached
def has_multi_arguments(self, args, env):
return self.compiles('int i;\n', env, extra_args=args)

@ -250,7 +250,7 @@ class BoostDependency(ExternalDependency):
def detect_headers_and_version(self):
try:
version = self.clib_compiler.get_define('BOOST_LIB_VERSION', '#include <boost/version.hpp>', self.env, self.get_compile_args(), [])
version = self.clib_compiler.get_define('BOOST_LIB_VERSION', '#include <boost/version.hpp>', self.env, self.get_compile_args(), [])[0]
except mesonlib.EnvironmentException:
return
except TypeError:

@ -368,7 +368,7 @@ class OpenMPDependency(ExternalDependency):
self.is_found = False
try:
openmp_date = self.clib_compiler.get_define(
'_OPENMP', '', self.env, self.clib_compiler.openmp_flags(), [self])
'_OPENMP', '', self.env, self.clib_compiler.openmp_flags(), [self])[0]
except mesonlib.EnvironmentException as e:
mlog.debug('OpenMP support not available in the compiler')
mlog.debug(e)

@ -1309,10 +1309,11 @@ class CompilerHolder(InterpreterObject):
raise InterpreterException('Prefix argument of get_define() must be a string.')
extra_args = functools.partial(self.determine_args, kwargs)
deps, msg = self.determine_dependencies(kwargs)
value = self.compiler.get_define(element, prefix, self.environment,
value, cached = self.compiler.get_define(element, prefix, self.environment,
extra_args=extra_args,
dependencies=deps)
mlog.log('Fetching value of define', mlog.bold(element, True), msg, value)
cached = '(cached)' if cached else ''
mlog.log('Fetching value of define', mlog.bold(element, True), msg, value, cached)
return value
@permittedKwargs({

Loading…
Cancel
Save