Fix return type of debugfile functions

It was returning None in some cases while being marked as returning
string.
pull/11976/head
Tristan Partin 1 year ago
parent ffa5483564
commit 24edddb412
  1. 2
      mesonbuild/backend/ninjabackend.py
  2. 2
      mesonbuild/compilers/compilers.py
  3. 4
      mesonbuild/compilers/mixins/islinker.py
  4. 4
      mesonbuild/linkers/linkers.py

@ -2797,7 +2797,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
else:
return compiler.get_compile_debugfile_args(objfile, pch=False)
def get_link_debugfile_name(self, linker, target, outname):
def get_link_debugfile_name(self, linker, target, outname) -> T.Optional[str]:
return linker.get_link_debugfile_name(outname)
def get_link_debugfile_args(self, linker, target, outname):

@ -921,7 +921,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
def get_compile_debugfile_args(self, rel_obj: str, pch: bool = False) -> T.List[str]:
return []
def get_link_debugfile_name(self, targetfile: str) -> str:
def get_link_debugfile_name(self, targetfile: str) -> T.Optional[str]:
return self.linker.get_debugfile_name(targetfile)
def get_link_debugfile_args(self, targetfile: str) -> T.List[str]:

@ -120,8 +120,8 @@ class BasicLinkerIsCompilerMixin(Compiler):
def get_buildtype_linker_args(self, buildtype: str) -> T.List[str]:
return []
def get_link_debugfile_name(self, targetfile: str) -> str:
return ''
def get_link_debugfile_name(self, targetfile: str) -> T.Optional[str]:
return None
def thread_flags(self, env: 'Environment') -> T.List[str]:
return []

@ -86,7 +86,7 @@ class StaticLinker:
def native_args_to_unix(cls, args: T.List[str]) -> T.List[str]:
return args[:]
def get_link_debugfile_name(self, targetfile: str) -> str:
def get_link_debugfile_name(self, targetfile: str) -> T.Optional[str]:
return None
def get_link_debugfile_args(self, targetfile: str) -> T.List[str]:
@ -428,7 +428,7 @@ class DynamicLinker(metaclass=abc.ABCMeta):
def has_multi_arguments(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]:
raise EnvironmentException(f'Language {self.id} does not support has_multi_link_arguments.')
def get_debugfile_name(self, targetfile: str) -> str:
def get_debugfile_name(self, targetfile: str) -> T.Optional[str]:
'''Name of debug file written out (see below)'''
return None

Loading…
Cancel
Save