compilers: put name_string method in base compiler

Every language had the exact same implementation
pull/7786/head
Dylan Baker 4 years ago
parent 02658fdda4
commit 98416e7f75
  1. 3
      mesonbuild/compilers/compilers.py
  2. 3
      mesonbuild/compilers/cs.py
  3. 3
      mesonbuild/compilers/cuda.py
  4. 3
      mesonbuild/compilers/d.py
  5. 3
      mesonbuild/compilers/java.py
  6. 4
      mesonbuild/compilers/mixins/clike.py
  7. 3
      mesonbuild/compilers/rust.py
  8. 3
      mesonbuild/compilers/swift.py
  9. 3
      mesonbuild/compilers/vala.py

@ -1044,6 +1044,9 @@ class Compiler(metaclass=abc.ABCMeta):
def get_has_func_attribute_extra_args(self, name: str) -> T.List[str]: def get_has_func_attribute_extra_args(self, name: str) -> T.List[str]:
raise EnvironmentException('{} does not support function attributes'.format(self.id)) raise EnvironmentException('{} does not support function attributes'.format(self.id))
def name_string(self) -> str:
return ' '.join(self.exelist)
def get_args_from_envvars(lang: str, def get_args_from_envvars(lang: str,
for_machine: MachineChoice, for_machine: MachineChoice,

@ -95,9 +95,6 @@ class CsCompiler(BasicLinkerIsCompilerMixin, Compiler):
return parameter_list return parameter_list
def name_string(self):
return ' '.join(self.exelist)
def get_pch_use_args(self, pch_dir, header): def get_pch_use_args(self, pch_dir, header):
return [] return []

@ -210,9 +210,6 @@ class CudaCompiler(Compiler):
def get_option_link_args(self, options): def get_option_link_args(self, options):
return self._cook_link_args(self.host_compiler.get_option_link_args(self._to_host_compiler_options(options))) return self._cook_link_args(self.host_compiler.get_option_link_args(self._to_host_compiler_options(options)))
def name_string(self):
return ' '.join(self.exelist)
def get_soname_args(self, *args): def get_soname_args(self, *args):
return self._cook_link_args(self.host_compiler.get_soname_args(*args)) return self._cook_link_args(self.host_compiler.get_soname_args(*args))

@ -633,9 +633,6 @@ class DCompiler(Compiler):
def thread_link_flags(self, env): def thread_link_flags(self, env):
return self.linker.thread_flags(env) return self.linker.thread_flags(env)
def name_string(self):
return ' '.join(self.exelist)
class GnuDCompiler(GnuCompiler, DCompiler): class GnuDCompiler(GnuCompiler, DCompiler):

@ -64,9 +64,6 @@ class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler):
def get_pic_args(self): def get_pic_args(self):
return [] return []
def name_string(self):
return ' '.join(self.exelist)
def get_pch_use_args(self, pch_dir, header): def get_pch_use_args(self, pch_dir, header):
return [] return []

@ -138,6 +138,7 @@ class CLikeCompiler:
def get_linker_always_args(self) -> T.List[str]: ... def get_linker_always_args(self) -> T.List[str]: ...
def get_pch_suffix(self) -> str: ... def get_pch_suffix(self) -> str: ...
def get_id(self) -> str: ... def get_id(self) -> str: ...
def name_string(self) -> str: ...
def remove_linkerlike_args(self, args: T.List[str]) -> T.List[str]: ... def remove_linkerlike_args(self, args: T.List[str]) -> T.List[str]: ...
@classmethod @classmethod
def use_linker_args(cls, linker: str) -> T.List[str]: ... def use_linker_args(cls, linker: str) -> T.List[str]: ...
@ -306,9 +307,6 @@ class CLikeCompiler:
def get_pic_args(self) -> T.List[str]: def get_pic_args(self) -> T.List[str]:
return ['-fPIC'] return ['-fPIC']
def name_string(self) -> str:
return ' '.join(self.exelist)
def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]: def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
return ['-include', os.path.basename(header)] return ['-include', os.path.basename(header)]

@ -45,9 +45,6 @@ class RustCompiler(Compiler):
def needs_static_linker(self): def needs_static_linker(self):
return False return False
def name_string(self):
return ' '.join(self.exelist)
def sanity_check(self, work_dir, environment): def sanity_check(self, work_dir, environment):
source_name = os.path.join(work_dir, 'sanity.rs') source_name = os.path.join(work_dir, 'sanity.rs')
output_name = os.path.join(work_dir, 'rusttest') output_name = os.path.join(work_dir, 'rusttest')

@ -42,9 +42,6 @@ class SwiftCompiler(Compiler):
self.id = 'llvm' self.id = 'llvm'
self.is_cross = is_cross self.is_cross = is_cross
def name_string(self):
return ' '.join(self.exelist)
def needs_static_linker(self): def needs_static_linker(self):
return True return True

@ -35,9 +35,6 @@ class ValaCompiler(Compiler):
self.id = 'valac' self.id = 'valac'
self.base_options = ['b_colorout'] self.base_options = ['b_colorout']
def name_string(self):
return ' '.join(self.exelist)
def needs_static_linker(self): def needs_static_linker(self):
return False # Because compiles into C. return False # Because compiles into C.

Loading…
Cancel
Save