diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2019-04-30 20:29:43 +0100 |
---|---|---|
committer | Dan Kegel <dank@kegel.com> | 2020-06-05 14:15:32 -0700 |
commit | aca93df184a32ed7faf3636c0fbe90d05cb67857 (patch) | |
tree | 15822376d3f79419578e8d562438daddd37c3f44 /mesonbuild/backend/backends.py | |
parent | eb60c041f9d2ae8554045b50080bbfc7b439af01 (diff) | |
download | meson-aca93df184a32ed7faf3636c0fbe90d05cb67857.zip meson-aca93df184a32ed7faf3636c0fbe90d05cb67857.tar.gz meson-aca93df184a32ed7faf3636c0fbe90d05cb67857.tar.bz2 |
backend: There is no need for 'compiler-specific escaping' anymore
Now that all command-line escaping for ninja is dealt with in the ninja
backend, escape_extra_args() shouldn't need to do anything.
But tests of existing behaviour rely on all backslashes in defines being
C escaped: This means that Windows-style paths including backslashes can
be safely used, but makes it impossible to have a define containing a C
escape.
Diffstat (limited to 'mesonbuild/backend/backends.py')
-rw-r--r-- | mesonbuild/backend/backends.py | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 840c9a3..3573d94 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -28,7 +28,7 @@ from .. import build from .. import dependencies from .. import mesonlib from .. import mlog -from ..compilers import CompilerArgs, VisualStudioLikeCompiler +from ..compilers import CompilerArgs from ..mesonlib import ( File, MachineChoice, MesonException, OrderedSet, OptionOverrideProxy, classify_unity_sources, unholder @@ -607,29 +607,13 @@ class Backend: @staticmethod def escape_extra_args(compiler, args): - # No extra escaping/quoting needed when not running on Windows - if not mesonlib.is_windows(): - return args + # all backslashes in defines are doubly-escaped extra_args = [] - # Compiler-specific escaping is needed for -D args but not for any others - if isinstance(compiler, VisualStudioLikeCompiler): - # MSVC needs escaping when a -D argument ends in \ or \" - for arg in args: - if arg.startswith('-D') or arg.startswith('/D'): - # Without extra escaping for these two, the next character - # gets eaten - if arg.endswith('\\'): - arg += '\\' - elif arg.endswith('\\"'): - arg = arg[:-2] + '\\\\"' - extra_args.append(arg) - else: - # MinGW GCC needs all backslashes in defines to be doubly-escaped - # FIXME: Not sure about Cygwin or Clang - for arg in args: - if arg.startswith('-D') or arg.startswith('/D'): - arg = arg.replace('\\', '\\\\') - extra_args.append(arg) + for arg in args: + if arg.startswith('-D') or arg.startswith('/D'): + arg = arg.replace('\\', '\\\\') + extra_args.append(arg) + return extra_args def generate_basic_compiler_args(self, target, compiler, no_warn_args=False): |