diff options
author | Andres Freund <andres@anarazel.de> | 2023-02-19 12:22:37 -0800 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-02-27 20:09:32 -0500 |
commit | 808d5934dd6c6a6c16f66e9dc51dae6e83e02cef (patch) | |
tree | e70ac01d9ccac49bad5a7d20b8a79730e388a548 /mesonbuild/compilers/d.py | |
parent | 9a41ce58d682faa59fcef5b067adc393a5412d30 (diff) | |
download | meson-808d5934dd6c6a6c16f66e9dc51dae6e83e02cef.zip meson-808d5934dd6c6a6c16f66e9dc51dae6e83e02cef.tar.gz meson-808d5934dd6c6a6c16f66e9dc51dae6e83e02cef.tar.bz2 |
Use caching in Compiler.sizeof() and Compiler.alignment()
Diffstat (limited to 'mesonbuild/compilers/d.py')
-rw-r--r-- | mesonbuild/compilers/d.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 90c0498..15b22d6 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -735,7 +735,7 @@ class DCompiler(Compiler): def sizeof(self, typename: str, prefix: str, env: 'Environment', *, extra_args: T.Union[None, T.List[str], T.Callable[[CompileCheckMode], T.List[str]]] = None, - dependencies: T.Optional[T.List['Dependency']] = None) -> int: + dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[int, bool]: if extra_args is None: extra_args = [] t = f''' @@ -745,17 +745,17 @@ class DCompiler(Compiler): writeln(({typename}).sizeof); }} ''' - res = self.run(t, env, extra_args=extra_args, - dependencies=dependencies) + res = self.cached_run(t, env, extra_args=extra_args, + dependencies=dependencies) if not res.compiled: - return -1 + return -1, False if res.returncode != 0: raise mesonlib.EnvironmentException('Could not run sizeof test binary.') - return int(res.stdout) + return int(res.stdout), res.cached def alignment(self, typename: str, prefix: str, env: 'Environment', *, extra_args: T.Optional[T.List[str]] = None, - dependencies: T.Optional[T.List['Dependency']] = None) -> int: + dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[int, bool]: if extra_args is None: extra_args = [] t = f''' @@ -774,7 +774,7 @@ class DCompiler(Compiler): align = int(res.stdout) if align == 0: raise mesonlib.EnvironmentException(f'Could not determine alignment of {typename}. Sorry. You might want to file a bug.') - return align + return align, res.cached def has_header(self, hname: str, prefix: str, env: 'Environment', *, extra_args: T.Union[None, T.List[str], T.Callable[['CompileCheckMode'], T.List[str]]] = None, |