Skip to content

Commit

Permalink
Prevent exception handling warning on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony-Nicholls authored and julianstorer committed Nov 7, 2024
1 parent 8fae783 commit 2d58413
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions containers/choc_Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -2439,28 +2439,15 @@ void ValueView::serialise (OutputStream& output) const
return;
}

uint8_t* localCopy = nullptr;

#if _MSC_VER
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlanguage-extension-token"
#endif

__try
{
localCopy = (uint8_t*) _alloca (dataSize);
}
__except (1)
{
throwError ("Stack overflow");
}

#ifdef __clang__
#pragma clang diagnostic pop
#endif
#if defined (_MSC_VER)
#pragma warning (push)
#pragma warning (disable: 6255)
auto* localCopy = (uint8_t*) _alloca (dataSize);
#pragma warning (pop)
#elif defined (__MINGW32__)
auto* localCopy = (uint8_t*) _alloca (dataSize);
#else
localCopy = (uint8_t*) alloca (dataSize);
auto* localCopy = (uint8_t*) alloca (dataSize);
#endif

check (localCopy != nullptr, "Stack allocation failed");
Expand Down

0 comments on commit 2d58413

Please sign in to comment.