In the preceding commit we have started to perform compiler checks for the value of `b_sanitize`, which allows us to detect sanitizers that aren't supported by the compiler toolchain. But we haven't yet loosened the option itself to accept arbitrary values, so until now it's still only possible to pass sanitizer combinations known by Meson, which is quite restrictive. Lift that restriction by adapting the `b_sanitize` option to become a free-form array. Like this, users can pass whatever combination of comma-separated sanitizers to Meson, which will then figure out whether that combination is supported via the compiler checks. This lifts a couple of restrictions and makes the supporting infrastructure way more future proof. A couple of notes regarding backwards compatibility: - All previous values of `b_sanitize` will remain valid as the syntax for free-form array values and valid combo choices is the same. We also treat 'none' specially so that we know to convert it into an empty array. - Even though the option has been converted into a free-form array, callers of `get_option('b_sanitize')` continue to get a string as value. We may eventually want to introduce a kwarg to alter this behaviour, but for now it is expected to be good enough for most use cases. Fixes #8283 Fixes #7761 Fixes #5154 Fixes #1582 Co-authored-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Patrick Steinhardt <ps@pks.im>pull/12277/merge
parent
e629d191b9
commit
43ea11ea49
14 changed files with 119 additions and 44 deletions
@ -0,0 +1,17 @@ |
||||
## Changes to the b_sanitize option |
||||
|
||||
Before 1.8 the `b_sanitize` option was a combo option, which is an enumerated |
||||
set of values. In 1.8 this was changed to a free-form array of options where |
||||
available sanitizers are not hardcoded anymore but instead verified via a |
||||
compiler check. |
||||
|
||||
This solves a number of longstanding issues such as: |
||||
|
||||
- Sanitizers may be supported by a compiler, but not on a specific platform |
||||
(OpenBSD). |
||||
- New sanitizers are not recognized by Meson. |
||||
- Using sanitizers in previously-unsupported combinations. |
||||
|
||||
To not break backwards compatibility, calling `get_option('b_sanitize')` |
||||
continues to return the configured value as a string, with a guarantee that |
||||
`address,undefined` remains ordered. |
@ -0,0 +1,8 @@ |
||||
# SPDX-License-Identifier: Apache-2.0 |
||||
# Copyright © 2023-2024 Intel Corporation |
||||
|
||||
project('sanitizer', 'c', meson_version : '>= 1.8') |
||||
|
||||
summary({ |
||||
'value': get_option('b_sanitize'), |
||||
}, section: 'summary') |
Loading…
Reference in new issue