diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-03-07 11:41:18 +0100 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-03-09 18:06:14 -0400 |
| commit | 43ea11ea49948635b1d672fef1bd397233b65b19 (patch) | |
| tree | e1fa9be70e178fb12d6d01ca8c07d3d4fa437ab9 /docs/markdown/Builtin-options.md | |
| parent | e629d191b99119c360605b056b954fff0905c83f (diff) | |
| download | meson-43ea11ea49948635b1d672fef1bd397233b65b19.tar.gz | |
compilers: convert `b_sanitize` to a free-form array option
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>
Diffstat (limited to 'docs/markdown/Builtin-options.md')
| -rw-r--r-- | docs/markdown/Builtin-options.md | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md index ffbab47d8..e1686f8d2 100644 --- a/docs/markdown/Builtin-options.md +++ b/docs/markdown/Builtin-options.md @@ -231,10 +231,20 @@ available on all platforms or with all compilers: | b_pie | false | true, false | Build position-independent executables (since 0.49.0) | | 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 -only supports the address sanitizer. +The default and possible values of sanitizers changed in 1.8. Before 1.8 they +were string values, and restricted to a specific subset of values: `none`, +`address`, `thread`, `undefined`, `memory`, `leak`, or `address,undefined`. In +1.8 it was changed to a free form array of sanitizers, which are checked by a +compiler and linker check. For backwards compatibility reasons +`get_option('b_sanitize')` continues to return a string with the array values +separated by a comma. Furthermore: + + - If the `b_sanitize` option is empty, the `'none'` string is returned. + + - If it contains only the values `'address'` and `'undefined'`, they are + always returned as the `'address,undefined'` string, in this order. + + - Otherwise, the array elements are returned in undefined order. \* < 0 means disable, == 0 means automatic selection, > 0 sets a specific number to use |
