Fix error: ISO C++ forbids in-class initialization of non-const static member 'm_started'

This commit is contained in:
Benoit Blanchon 2023-01-17 09:47:20 +01:00 committed by Martin Hořeňovský
parent 6c6cfe126a
commit 908c370f24

View File

@ -30,7 +30,7 @@ namespace Catch {
namespace Catch { namespace Catch {
class FatalConditionHandler { class FatalConditionHandler {
bool m_started = false; bool m_started;
// Install/disengage implementation for specific platform. // Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume // Should be if-defed to work on current platform, can assume
@ -40,7 +40,7 @@ namespace Catch {
public: public:
// Should also have platform-specific implementations as needed // Should also have platform-specific implementations as needed
FatalConditionHandler() {} FatalConditionHandler() : m_started(false) {}
~FatalConditionHandler() {} ~FatalConditionHandler() {}
void engage() { void engage() {
@ -90,7 +90,7 @@ namespace Catch {
static PVOID exceptionHandlerHandle = CATCH_NULL; static PVOID exceptionHandlerHandle = CATCH_NULL;
class FatalConditionHandler { class FatalConditionHandler {
bool m_started = false; bool m_started;
// Install/disengage implementation for specific platform. // Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume // Should be if-defed to work on current platform, can assume
@ -112,7 +112,7 @@ namespace Catch {
} }
public: public:
FatalConditionHandler() { FatalConditionHandler() : m_started(false) {
ULONG guaranteeSize = static_cast<ULONG>(32 * 1024); ULONG guaranteeSize = static_cast<ULONG>(32 * 1024);
if (!SetThreadStackGuarantee(&guaranteeSize)) { if (!SetThreadStackGuarantee(&guaranteeSize)) {
// We do not want to fully error out, because needing // We do not want to fully error out, because needing
@ -150,7 +150,7 @@ namespace Catch {
namespace Catch { namespace Catch {
class FatalConditionHandler { class FatalConditionHandler {
bool m_started = false; bool m_started;
// Install/disengage implementation for specific platform. // Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume // Should be if-defed to work on current platform, can assume
@ -160,7 +160,7 @@ namespace Catch {
public: public:
// Should also have platform-specific implementations as needed // Should also have platform-specific implementations as needed
FatalConditionHandler() {} FatalConditionHandler() : m_started(false) {}
~FatalConditionHandler() {} ~FatalConditionHandler() {}
void engage() { void engage() {
@ -241,7 +241,7 @@ namespace Catch {
} }
class FatalConditionHandler { class FatalConditionHandler {
bool m_started = false; bool m_started;
// Install/disengage implementation for specific platform. // Install/disengage implementation for specific platform.
// Should be if-defed to work on current platform, can assume // Should be if-defed to work on current platform, can assume
@ -267,7 +267,7 @@ namespace Catch {
} }
public: public:
FatalConditionHandler() { FatalConditionHandler() : m_started(false) {
assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
if (altStackSize == 0) { if (altStackSize == 0) {
altStackSize = SIGSTKSZ; altStackSize = SIGSTKSZ;