Skip to content

Commit

Permalink
compilers: remove hasattr from can_compile_suffixes
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dcbaker committed Oct 1, 2024
1 parent cd75bbe commit 3728b22
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
4 changes: 1 addition & 3 deletions mesonbuild/compilers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,8 @@ def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
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
Expand Down
1 change: 0 additions & 1 deletion mesonbuild/compilers/mixins/ccrx.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class CcrxCompiler(Compiler):

if T.TYPE_CHECKING:
is_cross = True
can_compile_suffixes: T.Set[str] = set()

id = 'ccrx'

Expand Down

0 comments on commit 3728b22

Please sign in to comment.