Previously it wasn't obvious what the default value of various sanitizer
options were. A very close approximation of the "default values" for the
options are the current value of the options at the time of printing the
help output.
In the case that no other options are provided then the current values
are the default values (apart from help).
ASAN_OPTIONS=help=1 ./program
This patch causes the current option values to be printed when the
help output is enabled. The original intention for this patch was to append
(Default: <value>) to an option's help text. However because this
is technically wrong (and misleading) I've opted to append
(Current Value: <value>) instead.
When trying to implement a way of displaying the default value of the
options I tried another solution where the default value used in *.inc files
were used to create compile time strings that where used when printing
the help output. This solution was not satisfactory for several reasons:
- Stringifying the default values with the preprocessor did not work very
well in several cases. Some options contain boolean operators which no
amount of macro expansion can get rid of.
- It was much more invasive than this patch. Every sanitizer had to be changed.
- The settings of __<sanitizer>_default_options() are ignored.
For those reasons I opted for the solution in this patch.
rdar://problem/42567204
:(
Maybe flip operands and remove negation to make it easier to follow.