Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compilers: allow combining address and leak sanitizers #14128

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/markdown/Builtin-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ available on all platforms or with all compilers:
| b_vscrt | from_buildtype | none, md, mdd, mt, mtd, from_buildtype, static_from_buildtype | VS runtime library to use (since 0.48.0) (static_from_buildtype since 0.56.0) |

The value of `b_sanitize` can be one of: `none`, `address`, `thread`,
`undefined`, `memory`, `leak`, `address,undefined`, but note that some
compilers might not support all of them. For example Visual Studio
`undefined`, `memory`, `leak`, `address,leak`, `address,undefined`, but note
that some compilers might not support all of them. For example Visual Studio
only supports the address sanitizer.

\* < 0 means disable, == 0 means automatic selection, > 0 sets a specific number to use
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/Configuring-a-build-directory.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ a sample output for a simple project.
b_ndebug false [true, false, if-release] Disable asserts
b_pch true [true, false] Use precompiled headers
b_pgo off [off, generate, use] Use profile guided optimization
b_sanitize none [none, address, thread, undefined, leak, memory, address,undefined] Code sanitizer to use
b_sanitize none [none, address, thread, undefined, leak, memory, address,leak, address,undefined] Code sanitizer to use
b_staticpic true [true, false] Build static libraries as position independent

Compiler options:
Expand Down
4 changes: 4 additions & 0 deletions docs/markdown/snippets/sanitize-address-leak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## `-b_sanitize` supports combining address and leak sanitizers

The `-b_sanitize` option now supports combining the address and leak
sanitizers with each other by passing `-b_sanitize=address,leak`.
2 changes: 1 addition & 1 deletion mesonbuild/compilers/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def init_option(self, name: OptionKey) -> options._U:
OptionKey('b_thinlto_cache'): BaseOption(options.UserBooleanOption, 'Use LLVM ThinLTO caching for faster incremental builds', False),
OptionKey('b_thinlto_cache_dir'): BaseOption(options.UserStringOption, 'Directory to store ThinLTO cache objects', ''),
OptionKey('b_sanitize'): BaseOption(options.UserComboOption, 'Code sanitizer to use', 'none',
choices=['none', 'address', 'thread', 'undefined', 'memory', 'leak', 'address,undefined']),
choices=['none', 'address', 'thread', 'undefined', 'memory', 'leak', 'address,leak', 'address,undefined']),
OptionKey('b_lundef'): BaseOption(options.UserBooleanOption, 'Use -Wl,--no-undefined when linking', True),
OptionKey('b_asneeded'): BaseOption(options.UserBooleanOption, 'Use -Wl,--as-needed when linking', True),
OptionKey('b_pgo'): BaseOption(options.UserComboOption, 'Use profile guided optimization', 'off',
Expand Down
11 changes: 11 additions & 0 deletions unittests/linuxliketests.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,17 @@ def test_generate_gir_with_address_sanitizer(self):
self.init(testdir, extra_args=['-Db_sanitize=address', '-Db_lundef=false'])
self.build()

@skip_if_not_base_option('b_sanitize')
def test_cpp_with_address_and_leak_sanitizer(self):
if is_cygwin():
raise SkipTest('asan not available on Cygwin')
if is_openbsd():
raise SkipTest('-fsanitize=address is not supported on OpenBSD')

testdir = os.path.join(self.common_test_dir, '2 cpp')
self.init(testdir, extra_args=['-Db_sanitize=address,leak', '-Db_lundef=false'])
self.build()

def test_qt5dependency_no_lrelease(self):
'''
Test that qt5 detection with qmake works. This can't be an ordinary
Expand Down
Loading