15#define MMCFILTERS_CONTRACT_UNCHECKED 0
18#define MMCFILTERS_CONTRACT_CHECKED 1
20#ifndef MMCFILTERS_CONTRACT_MODE
22#define MMCFILTERS_CONTRACT_MODE MMCFILTERS_CONTRACT_CHECKED
25#if MMCFILTERS_CONTRACT_MODE != MMCFILTERS_CONTRACT_UNCHECKED && MMCFILTERS_CONTRACT_MODE != MMCFILTERS_CONTRACT_CHECKED
26#error "MMCFILTERS_CONTRACT_MODE must be MMCFILTERS_CONTRACT_CHECKED or MMCFILTERS_CONTRACT_UNCHECKED."
29namespace mmcfilters::contract {
53#define MMCFILTERS_CONTRACT_REQUIRE(condition, ...) \
55 if constexpr (::mmcfilters::contract::validationsEnabled) { \
67#define MMCFILTERS_CONTRACT_CHECKED_ONLY(...) \
69 if constexpr (::mmcfilters::contract::validationsEnabled) { \
constexpr bool validationsEnabled
Whether defensive API-boundary validation is enabled in this build.
#define MMCFILTERS_CONTRACT_CHECKED
Compile-time value selecting a build with defensive boundary validation.
#define MMCFILTERS_CONTRACT_MODE
Contract mode selected for the current translation unit.
constexpr Mode mode
Contract policy selected when this translation unit was compiled.
Mode
Available compile-time policies for defensive API-boundary validation.
@ Checked
Public boundaries validate caller-provided preconditions.
@ Unchecked
Caller-established preconditions are trusted without defensive checks.
#define MMCFILTERS_CONTRACT_UNCHECKED
Compile-time value selecting a build without defensive boundary validation.