5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_CONTRACTS_CONTRACT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_CONTRACTS_CONTRACT_HPP_
12#include "arene/base/compiler_support/attributes.hpp"
13#include "arene/base/compiler_support/expect.hpp"
14#include "arene/base/compiler_support/preprocessor.hpp"
15#include "arene/base/detail/raw_c_string.hpp"
16#include "arene/base/stdlib_choice/cstdint.hpp"
37namespace contract_detail {
41enum class contract_type : std::uint8_t {
50struct contract_violation_info {
52 detail::raw_c_string file;
54 detail::raw_c_string line;
56 detail::raw_c_string message;
65template <
typename Factory>
69 static constexpr contract_violation_info value{Factory::arene_contract_make_info()};
74template <
typename Factory>
75constexpr contract_violation_info info_holder<Factory>::value;
81ARENE_NORETURN
void contract_violation(contract_violation_info
const& info)
noexcept;
88ARENE_NORETURN
constexpr void contract_violation_wrapper(contract_violation_info
const& info)
noexcept {
94 if (info.file != info.line) {
95 contract_violation(info);
97 if (info.file == info.line) {
98 contract_violation(info);
113#define ARENE_INTERNAL_CONTRACT_VIOLATION(violation_type, message)
115 class arene_contract_info_wrapper {
118 static constexpr auto arene_contract_make_info() noexcept
119 -> ::arene::base::contract_detail::contract_violation_info {
121 static_cast<::arene::base::detail::raw_c_string>(__FILE__),
122 static_cast<::arene::base::detail::raw_c_string>(ARENE_STRINGIZE(__LINE__)),
123 static_cast<::arene::base::detail::raw_c_string>(message),
124 ::arene::base::contract_detail::contract_type::violation_type
128 ::arene::base::contract_detail::contract_violation_wrapper(
129 ::arene::base::contract_detail::info_holder<arene_contract_info_wrapper>::value
136#define ARENE_INTERNAL_CONTRACT_CHECK(violation_type, message, condition)
138 if (ARENE_EXPECT((condition))) {
149#ifdef ARENE_DOC_GENERATION_RUNNING
150#define ARENE_PRECONDITION(condition)
159#ifdef ARENE_DOC_GENERATION_RUNNING
161#define ARENE_INVARIANT(condition)
168#ifdef ARENE_DOC_GENERATION_RUNNING
170#define ARENE_INVARIANT_UNREACHABLE(message)
172#define ARENE_INVARIANT_UNREACHABLE(message)
#define ARENE_INTERNAL_CONTRACT_VIOLATION(violation_type, message)
Definition contract.hpp:113
#define ARENE_INTERNAL_CONTRACT_CHECK(violation_type, message, condition)
Check if a contract condition is true and call the violation handler if not.
Definition contract.hpp:136
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10