diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-10-31 17:27:08 +0800 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2019-11-09 10:20:50 +0000 |
commit | 0755ac2723738640505986ac6fc446b9b40e4d4a (patch) | |
tree | 86620b399b0eba7327a1fd9fa2d45a014cf31052 /giscanner | |
parent | 6b62bf2a9b981d1b80bae4d913d76add69c60018 (diff) | |
download | gobject-introspection-gnome-3-34.tar.gz |
giscanner/ccompiler.py: Fix macro defines with quotes on MSVCgnome-3-34
When we save the macros to pass to distutils to compile the dumper
program, the quotes were not properly preserved for Visual Studio
builds, causing items such as -DG_LOG_DOMAIN to fail as quotes are used
in there.
When we use quotes in macro definitions, we escape the escape
character in ccompiler._set_cpp_options() when we are running
g-ir-scanner with Visual Studio, so that distutils won't be too eager
to drop those prematurely.
Diffstat (limited to 'giscanner')
-rw-r--r-- | giscanner/ccompiler.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/giscanner/ccompiler.py b/giscanner/ccompiler.py index 35549da2..4ad572c3 100644 --- a/giscanner/ccompiler.py +++ b/giscanner/ccompiler.py @@ -444,6 +444,13 @@ class CCompiler(object): else: macro_name = macro[:macro_index] macro_value = macro[macro_index + 1:] + + # Somehow the quotes used in defining + # macros for compiling using distutils + # get dropped for MSVC builds, so + # escape the escape character. + if isinstance(self.compiler, MSVCCompiler): + macro_value = macro_value.replace('\"', '\\\"') macros.append((macro_name, macro_value)) elif option.startswith('-U'): macros.append((option[len('-U'):],)) |