Introduce g_fuzzing global for fuzzing checks

This commit is contained in:
dergoegge
2024-10-15 12:10:36 +01:00
parent b95adf057a
commit 9f243cd7fa
5 changed files with 9 additions and 10 deletions

View File

@@ -14,6 +14,8 @@
#include <string>
#include <string_view>
bool g_fuzzing = false;
std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func)
{
return strprintf("Internal bug detected: %s\n%s:%d (%s)\n"

View File

@@ -13,6 +13,8 @@
#include <string_view>
#include <utility>
extern bool g_fuzzing;
std::string StrFormatInternalBug(std::string_view msg, std::string_view file, int line, std::string_view func);
class NonFatalCheckError : public std::runtime_error
@@ -42,7 +44,7 @@ void assertion_fail(std::string_view file, int line, std::string_view func, std:
template <bool IS_ASSERT, typename T>
constexpr T&& inline_assertion_check(LIFETIMEBOUND T&& val, [[maybe_unused]] const char* file, [[maybe_unused]] int line, [[maybe_unused]] const char* func, [[maybe_unused]] const char* assertion)
{
if (IS_ASSERT || std::is_constant_evaluated()
if (IS_ASSERT || std::is_constant_evaluated() || g_fuzzing
#ifdef ABORT_ON_FAILED_ASSUME
|| true
#endif