mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-16 03:43:13 +01:00
Make -release only disable bounds checking in non-@safe code.
This commit is contained in:
@@ -175,6 +175,7 @@ int main(int argc, char** argv)
|
||||
global.params.argv0 = argv[0];
|
||||
#endif
|
||||
global.params.useSwitchError = 1;
|
||||
global.params.useArrayBounds = 2;
|
||||
|
||||
global.params.linkswitches = new Strings();
|
||||
global.params.libfiles = new Strings();
|
||||
@@ -369,6 +370,14 @@ int main(int argc, char** argv)
|
||||
if (global.params.useUnitTests)
|
||||
global.params.useAssert = 1;
|
||||
|
||||
// Bounds checking is a bit peculiar: -enable/disable-boundscheck is an
|
||||
// absolute decision. Only if no explicit option is specified, -release
|
||||
// downgrades useArrayBounds 2 to 1 (only for safe functions).
|
||||
if (opts::boundsChecks == cl::BOU_UNSET)
|
||||
global.params.useArrayBounds = opts::nonSafeBoundsChecks ? 2 : 1;
|
||||
else
|
||||
global.params.useArrayBounds = (opts::boundsChecks == cl::BOU_TRUE) ? 2 : 0;
|
||||
|
||||
// LDC output determination
|
||||
|
||||
// if we don't link, autodetect target from extension
|
||||
|
||||
Reference in New Issue
Block a user