Add new cmdline option -checkaction=<D|C|halt>

This commit is contained in:
Martin Kinkelin 2018-12-21 21:36:42 +01:00
parent d4e680bcdb
commit 2d539fa63d
2 changed files with 17 additions and 1 deletions

View file

@ -368,6 +368,18 @@ static cl::opt<MultiSetter, true, FlagParser<bool>>
contracts("contracts", cl::ZeroOrMore, cl::location(ContractsSetter),
cl::desc("(*) Enable function pre- and post-conditions"));
static cl::opt<CHECKACTION, true> checkAction(
"checkaction", cl::ZeroOrMore, cl::location(global.params.checkAction),
cl::desc("Action to take when an assert/boundscheck/final-switch fails"),
cl::init(CHECKACTION_D),
clEnumValues(
clEnumValN(CHECKACTION_D, "D",
"Throw an unrecoverable Error (default)"),
clEnumValN(CHECKACTION_C, "C",
"Call the C runtime library assert failure function"),
clEnumValN(CHECKACTION_halt, "halt",
"Execute a halt instruction, terminating the program")));
CHECKENABLE invReleaseMode = CHECKENABLEon;
static MultiSetter ReleaseSetter(true, &invReleaseMode,
&global.params.useInvariants,

View file

@ -163,6 +163,7 @@ Where:\n\
-boundscheck=[on|safeonly|off] bounds checks on, in @safe only, or off\n\
-c do not link\n\
-check=[assert|bounds|in|invariant|out|switch][=[on|off]] Enable or disable specific checks\n\
-checkaction=D|C|halt behavior on assert/boundscheck/finalswitch failure\n\
-color turn colored console output on\n\
-color=[on|off] force colored console output on or off\n\
-conf=<filename> use config file at filename\n\
@ -418,7 +419,10 @@ void translateArgs(size_t originalArgc, char **originalArgv,
check(6, "switch", "switch-errors"))) {
goto Lerror;
}
} else if (strncmp(p + 1, "color", 5) == 0) {
}
/* -checkaction
*/
else if (strncmp(p + 1, "color", 5) == 0) {
bool color = true;
// Parse:
// -color