diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-09-10 16:56:22 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-09-10 16:56:22 +0300 |
commit | 2336624f4a42d459dda077634140b3c1def255db (patch) | |
tree | d8d962982f29118b1f832d1e5231054e3dd2228e /mesonbuild/compilers.py | |
parent | 19ecad5b24a75c89a4fddf355849b1568766829e (diff) | |
download | meson-2336624f4a42d459dda077634140b3c1def255db.zip meson-2336624f4a42d459dda077634140b3c1def255db.tar.gz meson-2336624f4a42d459dda077634140b3c1def255db.tar.bz2 |
Refactored GNU common functionality into its own class.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 5d3dc99..c51d3ac 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1934,9 +1934,9 @@ def get_gcc_soname_args(gcc_type, shlib_name, path, soversion): raise RuntimeError('Not implemented yet.') -class GnuCCompiler(CCompiler): - def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None): - CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) +class GnuCompiler: + # Functionality that is common to all GNU family compilers. + def __init__(self, gcc_type): self.id = 'gcc' self.gcc_type = gcc_type self.warn_args = {'1': ['-Wall', '-Winvalid-pch'], @@ -1958,15 +1958,15 @@ class GnuCCompiler(CCompiler): return [] # On Window gcc defaults to fpic being always on. return ['-fPIC'] - def get_always_args(self): - return ['-pipe'] - def get_buildtype_args(self, buildtype): return gnulike_buildtype_args[buildtype] def get_buildtype_linker_args(self, buildtype): return gnulike_buildtype_linker_args[buildtype] + def get_always_args(self): + return ['-pipe'] + def get_pch_suffix(self): return 'gch' @@ -1976,6 +1976,11 @@ class GnuCCompiler(CCompiler): def get_soname_args(self, shlib_name, path, soversion): return get_gcc_soname_args(self.gcc_type, shlib_name, path, soversion) +class GnuCCompiler(GnuCompiler, CCompiler): + def __init__(self, exelist, version, gcc_type, is_cross, exe_wrapper=None): + CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) + GnuCompiler.__init__(self, gcc_type) + def can_compile(self, filename): return super().can_compile(filename) or filename.split('.')[-1].lower() == 's' # Gcc can do asm, too. |