blob: e85900f03a96581aea2174be108981d6fba3e5f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright (c) 2026 Progmasoft.
// SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0
#pragma once
#include <cstdio>
#include <cstdlib>
#include <stdexcept>
namespace Progmasoft::Catch3::Detail
{
// An invalid generator contract cannot be represented by a value-returning
// factory. Preserve the exception API for normal clients and fail loudly
// when a caller deliberately compiles without language exceptions.
[[noreturn]] static inline void
RejectInvalidArgument(const char *message)
{
#if defined(__cpp_exceptions)
throw std::invalid_argument(message);
#else
std::fputs(message, stderr);
std::fputc('\n', stderr);
std::abort();
#endif
}
} // namespace Progmasoft::Catch3::Detail
|