D lang compilers have an option -release (or similar) which turns off
asserts, contracts, and other runtime type checking. This patch wires
that up to the b_ndebug flag.
Fixes#7082
The Windows CI runs with codepage 1252, which is basically ISO-8859-1 and does not
have a mapping for character U+0151 (ő). It is currently passing because of a
happy accident, as the generator command line is emitted in UTF-8 anyway
(starting at commit 6089631a, "Open build files with utf-8", 2018-04-17, which
however lacks documentation or history) and file.py treats it as two
single-byte characters.
When going through meson_exe, however, Windows passes a genuine Unicode
character via CreateProcessW and file.py fails to decode it, so we need to
pass errors='replace' when opening the output file.
On Windows, the test is then fixed. On POSIX systems it is _still_ passing as
a happy accident because (according to the current locale) the output file
contains two single-byte characters rather than the single Unicode character
"ő"; in fact, if one modifies the ninja backend to use force_serialize=True,
meson_exe fails to build the command line for file.py and stops with a
UnicodeEncodeError.