aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-08-06 15:15:57 -0700
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-08-20 18:57:19 +0200
commit0bc77c604ff45a3b1a010aca6e99c9b8770f772f (patch)
tree96bcbbb713c5bb52c9314ce6c590707f8b6690d0
parenta3c94956c880fc3fe983251597a3582d394c63be (diff)
downloadmeson-0bc77c604ff45a3b1a010aca6e99c9b8770f772f.zip
meson-0bc77c604ff45a3b1a010aca6e99c9b8770f772f.tar.gz
meson-0bc77c604ff45a3b1a010aca6e99c9b8770f772f.tar.bz2
backends: move method from ninjabackend to base class
The baseclass has code that assumes said method exists, and it really doesn't seem to do anything ninja specific, so move it to the generic backend.
-rw-r--r--mesonbuild/backend/backends.py11
-rw-r--r--mesonbuild/backend/ninjabackend.py5
2 files changed, 8 insertions, 8 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 6c877ea..93dfd12 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -789,16 +789,21 @@ class Backend:
return pch_rel_to_build
@staticmethod
- def escape_extra_args(compiler, args):
+ def escape_extra_args(args: T.List[str]) -> T.List[str]:
# all backslashes in defines are doubly-escaped
- extra_args = []
+ extra_args: T.List[str] = []
for arg in args:
- if arg.startswith('-D') or arg.startswith('/D'):
+ if arg.startswith(('-D', '/D')):
arg = arg.replace('\\', '\\\\')
extra_args.append(arg)
return extra_args
+ def get_no_stdlib_args(self, target: 'build.BuildTarget', compiler: 'Compiler') -> T.List[str]:
+ if compiler.language in self.build.stdlibs[target.for_machine]:
+ return compiler.get_no_stdinc_args()
+ return []
+
def generate_basic_compiler_args(self, target: build.BuildTarget, compiler: 'Compiler', no_warn_args: bool = False) -> 'CompilerArgs':
# Create an empty commands list, and start adding arguments from
# various sources in the order in which they must override each other
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index fb0e77b..65aeb06 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2313,11 +2313,6 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler)
return mod_files
- def get_no_stdlib_args(self, target, compiler):
- if compiler.language in self.build.stdlibs[target.for_machine]:
- return compiler.get_no_stdinc_args()
- return []
-
def get_no_stdlib_link_args(self, target, linker):
if hasattr(linker, 'language') and linker.language in self.build.stdlibs[target.for_machine]:
return linker.get_no_stdlib_link_args()