diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-11 22:55:00 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-19 15:19:00 -0400 |
commit | 2b90152fe50b22b3d72c1882e3cabf5f3381d92f (patch) | |
tree | b64600c7a704498e4a518a9e78953c37a1a548b1 /mesonbuild/compilers | |
parent | 4487a256e0e37ac4faf949ffd5e3e6f66732fabf (diff) | |
download | meson-2b90152fe50b22b3d72c1882e3cabf5f3381d92f.zip meson-2b90152fe50b22b3d72c1882e3cabf5f3381d92f.tar.gz meson-2b90152fe50b22b3d72c1882e3cabf5f3381d92f.tar.bz2 |
compilers: use consistent function signature for objc
e.g. for detect_c_or_cpp we just take the language itself as an
argument.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/detect.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py index 2c9c6ff..e374e7c 100644 --- a/mesonbuild/compilers/detect.py +++ b/mesonbuild/compilers/detect.py @@ -845,14 +845,14 @@ def detect_fortran_compiler(env: 'Environment', for_machine: MachineChoice) -> C raise EnvironmentException('Unreachable code (exception to make mypy happy)') def detect_objc_compiler(env: 'Environment', for_machine: MachineChoice) -> 'Compiler': - return _detect_objc_or_objcpp_compiler(env, for_machine, True) + return _detect_objc_or_objcpp_compiler(env, 'objc', for_machine) def detect_objcpp_compiler(env: 'Environment', for_machine: MachineChoice) -> 'Compiler': - return _detect_objc_or_objcpp_compiler(env, for_machine, False) + return _detect_objc_or_objcpp_compiler(env, 'objcpp', for_machine) -def _detect_objc_or_objcpp_compiler(env: 'Environment', for_machine: MachineChoice, objc: bool) -> 'Compiler': +def _detect_objc_or_objcpp_compiler(env: 'Environment', lang: str, for_machine: MachineChoice) -> 'Compiler': popen_exceptions: T.Dict[str, T.Union[Exception, str]] = {} - compilers, ccache, exe_wrap = _get_compilers(env, 'objc' if objc else 'objcpp', for_machine) + compilers, ccache, exe_wrap = _get_compilers(env, lang, for_machine) is_cross = env.is_cross_build(for_machine) info = env.machines[for_machine] comp: T.Union[T.Type[ObjCCompiler], T.Type[ObjCPPCompiler]] @@ -871,7 +871,7 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', for_machine: MachineChoi popen_exceptions[join_args(compiler)] = 'no pre-processor defines' continue version = _get_gnu_version_from_defines(defines) - comp = GnuObjCCompiler if objc else GnuObjCPPCompiler + comp = GnuObjCCompiler if lang == 'objc' else GnuObjCPPCompiler linker = guess_nix_linker(env, compiler, comp, version, for_machine) return comp( ccache + compiler, version, for_machine, is_cross, info, @@ -883,9 +883,9 @@ def _detect_objc_or_objcpp_compiler(env: 'Environment', for_machine: MachineChoi popen_exceptions[join_args(compiler)] = 'no pre-processor defines' continue if 'Apple' in out: - comp = AppleClangObjCCompiler if objc else AppleClangObjCPPCompiler + comp = AppleClangObjCCompiler if lang == 'objc' else AppleClangObjCPPCompiler else: - comp = ClangObjCCompiler if objc else ClangObjCPPCompiler + comp = ClangObjCCompiler if lang == 'objc' else ClangObjCPPCompiler if 'windows' in out or env.machines[for_machine].is_windows(): # If we're in a MINGW context this actually will use a gnu style ld try: |