aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2021-05-15 11:47:04 -0400
committerGitHub <noreply@github.com>2021-05-15 18:47:04 +0300
commitbe015a37d708135881743c2108fe4f35fdba7166 (patch)
tree3fb01fc36909556e1ae9517eb468bd4c0dbd456d
parentab0b727427ce8d749ea381a492832435dabc72b0 (diff)
downloadmeson-be015a37d708135881743c2108fe4f35fdba7166.zip
meson-be015a37d708135881743c2108fe4f35fdba7166.tar.gz
meson-be015a37d708135881743c2108fe4f35fdba7166.tar.bz2
Visual Studio Address Sanitizer updates
* Allow address sanitizer for Visual Studio 2019 version 16.9 Address Sanitizer was first supported with the current syntax in Visual Studio 16.9.0 (cl version 19.28.29910). * VS: Convert /fsanitize=address to project file setting
-rw-r--r--mesonbuild/backend/vs2010backend.py10
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py2
2 files changed, 11 insertions, 1 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 6b5fd2d..2d3197a 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -181,6 +181,10 @@ class Vs2010Backend(backends.Backend):
self.buildtype = self.environment.coredata.get_option(OptionKey('buildtype'))
self.optimization = self.environment.coredata.get_option(OptionKey('optimization'))
self.debug = self.environment.coredata.get_option(OptionKey('debug'))
+ try:
+ self.sanitize = self.environment.coredata.get_option(OptionKey('b_sanitize'))
+ except MesonException:
+ self.sanitize = 'none'
sln_filename = os.path.join(self.environment.get_build_dir(), self.build.project_name + '.sln')
projlist = self.generate_projects()
self.gen_testproj('RUN_TESTS', os.path.join(self.environment.get_build_dir(), 'RUN_TESTS.vcxproj'))
@@ -613,6 +617,8 @@ class Vs2010Backend(backends.Backend):
# Remove arguments that have a top level XML entry so
# they are not used twice.
# FIXME add args as needed.
+ if entry[1:].startswith('fsanitize'):
+ return True
return entry[1:].startswith('M')
def add_additional_options(self, lang, parent_node, file_args):
@@ -767,6 +773,7 @@ class Vs2010Backend(backends.Backend):
build_args = compiler.get_buildtype_args(self.buildtype)
build_args += compiler.get_optimization_args(self.optimization)
build_args += compiler.get_debug_args(self.debug)
+ build_args += compiler.sanitizer_compile_args(self.sanitize)
buildtype_link_args = compiler.get_buildtype_linker_args(self.buildtype)
vscrt_type = self.environment.coredata.options[OptionKey('b_vscrt')]
project_name = target.name
@@ -842,6 +849,9 @@ class Vs2010Backend(backends.Backend):
else:
ET.SubElement(type_config, 'UseDebugLibraries').text = 'false'
ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDLL'
+ # Sanitizers
+ if '/fsanitize=address' in build_args:
+ ET.SubElement(type_config, 'EnableASAN').text = 'true'
# Debug format
if '/ZI' in build_args:
ET.SubElement(clconf, 'DebugInformationFormat').text = 'EditAndContinue'
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index c9e1133..e911f64 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -125,7 +125,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
self.machine = 'arm'
else:
self.machine = target
- if mesonlib.version_compare(self.version, '>=19.29.29917'):
+ if mesonlib.version_compare(self.version, '>=19.28.29910'): # VS 16.9.0 includes cl 19.28.29910
self.base_options.add(mesonlib.OptionKey('b_sanitize'))
assert self.linker is not None
self.linker.machine = self.machine