From 351f1804c87039875a42bd1cd3c5c4725302439c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 1 Jun 2019 02:02:37 -0700 Subject: [PATCH] Add runtime program option to soften assert behavior. --- construct/construct.cc | 5 +++++ include/ircd/ircd.h | 1 + ircd/assert.cc | 4 ++++ ircd/ircd.cc | 8 ++++++++ 4 files changed, 18 insertions(+) diff --git a/construct/construct.cc b/construct/construct.cc index 24df22cb8..e5aaea48a 100644 --- a/construct/construct.cc +++ b/construct/construct.cc @@ -31,6 +31,7 @@ bool no6; bool norun; bool read_only; bool write_avoid; +bool soft_assert; const char *execute; std::array smoketest; @@ -54,6 +55,7 @@ lgetopt opts[] { "ro", &read_only, lgetopt::BOOL, "Read-only mode. No writes to database allowed." }, { "wa", &write_avoid, lgetopt::BOOL, "Like read-only mode, but writes permitted if triggered." }, { "smoketest", &smoketest[0], lgetopt::BOOL, "Starts and stops the daemon to return success."}, + { "sassert", &soft_assert, lgetopt::BOOL, "Softens assertion effects in debug mode."}, { nullptr, nullptr, lgetopt::STRING, nullptr }, }; @@ -358,4 +360,7 @@ applyargs() if(no6) ircd::net::enable_ipv6.set("false"); + + if(soft_assert) + ircd::soft_assert.set("true"); } diff --git a/include/ircd/ircd.h b/include/ircd/ircd.h index 6bcd792fa..2b8c205a7 100644 --- a/include/ircd/ircd.h +++ b/include/ircd/ircd.h @@ -76,6 +76,7 @@ namespace ircd extern conf::item debugmode; extern conf::item read_only; extern conf::item write_avoid; + extern conf::item soft_assert; } #endif // HAVE_IRCD_IRCD_H diff --git a/ircd/assert.cc b/ircd/assert.cc index add44e82f..7328b7c17 100644 --- a/ircd/assert.cc +++ b/ircd/assert.cc @@ -10,6 +10,7 @@ #include