compilers: remove hasattr from `can_compile_suffixes`

This is never set outside the `Compiler.__init__`, only added to. As
such there's no reason to have this `hasattr` check. It's wasting time
*and* confusing our static checkers.
pull/13728/head
Dylan Baker 1 month ago
parent cd75bbee9b
commit 3728b228a6
  1. 4
      mesonbuild/compilers/compilers.py
  2. 1
      mesonbuild/compilers/mixins/ccrx.py

@ -451,10 +451,8 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
full_version: T.Optional[str] = None, is_cross: bool = False):
self.exelist = ccache + exelist
self.exelist_no_ccache = exelist
# In case it's been overridden by a child class already
self.file_suffixes = lang_suffixes[self.language]
if not hasattr(self, 'can_compile_suffixes'):
self.can_compile_suffixes: T.Set[str] = set(self.file_suffixes)
self.can_compile_suffixes = set(self.file_suffixes)
self.default_suffix = self.file_suffixes[0]
self.version = version
self.full_version = full_version

@ -40,7 +40,6 @@ class CcrxCompiler(Compiler):
if T.TYPE_CHECKING:
is_cross = True
can_compile_suffixes: T.Set[str] = set()
id = 'ccrx'

Loading…
Cancel
Save