sparrow 0.3.0
Loading...
Searching...
No Matches
contracts.hpp File Reference
#include <csignal>
#include <cstdio>
#include <cstdlib>
Include dependency graph for contracts.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SPARROW_CONTRACTS_IGNORE_WARNINGS
 
#define SPARROW_CONTRACTS_RESTORE_WARNINGS
 
#define SPARROW_CONTRACTS_LOG_FAILURE(expr__, message__)
 
#define SPARROW_CONTRACTS_ABORT()
 
#define SPARROW_CONTRACTS_DEBUGBREAK()
 
#define SPARROW_CONTRACTS_DEFAULT_CHECKS_ENABLED   1
 
#define SPARROW_CONTRACTS_DEFAULT_ABORT_ON_FAILURE   1
 
#define SPARROW_CONTRACTS_DEFAULT_ON_FAILURE(expr__, message__)
 
#define SPARROW_CONTRACTS_CHECKS_ENABLED   SPARROW_CONTRACTS_DEFAULT_CHECKS_ENABLED
 
#define SPARROW_CONTRACTS_ON_FAILURE(expr__, message__)
 
#define SPARROW_ASSERT(expr__, message__)
 
#define SPARROW_ASSERT_TRUE(expr__)
 
#define SPARROW_ASSERT_FALSE(expr__)
 

Macro Definition Documentation

◆ SPARROW_ASSERT

#define SPARROW_ASSERT ( expr__,
message__ )
Value:
if (!(expr__)) \
{ \
SPARROW_CONTRACTS_ON_FAILURE(expr__, message__); \
}

Definition at line 166 of file contracts.hpp.

◆ SPARROW_ASSERT_FALSE

#define SPARROW_ASSERT_FALSE ( expr__)
Value:
SPARROW_ASSERT(!(expr__), "!(" #expr__ ")")
#define SPARROW_ASSERT(expr__, message__)

Definition at line 174 of file contracts.hpp.

◆ SPARROW_ASSERT_TRUE

#define SPARROW_ASSERT_TRUE ( expr__)
Value:
SPARROW_ASSERT(expr__, #expr__)

Definition at line 173 of file contracts.hpp.

◆ SPARROW_CONTRACTS_ABORT

#define SPARROW_CONTRACTS_ABORT ( )
Value:
std::abort()

Definition at line 122 of file contracts.hpp.

◆ SPARROW_CONTRACTS_CHECKS_ENABLED

#define SPARROW_CONTRACTS_CHECKS_ENABLED   SPARROW_CONTRACTS_DEFAULT_CHECKS_ENABLED

Definition at line 155 of file contracts.hpp.

◆ SPARROW_CONTRACTS_DEBUGBREAK

#define SPARROW_CONTRACTS_DEBUGBREAK ( )
Value:
std::raise(SIGTRAP);

Definition at line 135 of file contracts.hpp.

◆ SPARROW_CONTRACTS_DEFAULT_ABORT_ON_FAILURE

#define SPARROW_CONTRACTS_DEFAULT_ABORT_ON_FAILURE   1

Definition at line 143 of file contracts.hpp.

◆ SPARROW_CONTRACTS_DEFAULT_CHECKS_ENABLED

#define SPARROW_CONTRACTS_DEFAULT_CHECKS_ENABLED   1

Definition at line 142 of file contracts.hpp.

◆ SPARROW_CONTRACTS_DEFAULT_ON_FAILURE

#define SPARROW_CONTRACTS_DEFAULT_ON_FAILURE ( expr__,
message__ )
Value:
SPARROW_CONTRACTS_LOG_FAILURE(expr__, message__); \
SPARROW_CONTRACTS_DEBUGBREAK(); \
SPARROW_CONTRACTS_ABORT();
#define SPARROW_CONTRACTS_LOG_FAILURE(expr__, message__)

Definition at line 145 of file contracts.hpp.

◆ SPARROW_CONTRACTS_IGNORE_WARNINGS

#define SPARROW_CONTRACTS_IGNORE_WARNINGS

Definition at line 87 of file contracts.hpp.

◆ SPARROW_CONTRACTS_LOG_FAILURE

#define SPARROW_CONTRACTS_LOG_FAILURE ( expr__,
message__ )
Value:
::fprintf(stderr, "Assertion Failed (%s:%i): %s - (%s is wrong)\n", __FILE__, __LINE__, message__, #expr__);

Definition at line 115 of file contracts.hpp.

◆ SPARROW_CONTRACTS_ON_FAILURE

#define SPARROW_CONTRACTS_ON_FAILURE ( expr__,
message__ )
Value:
#define SPARROW_CONTRACTS_DEFAULT_ON_FAILURE(expr__, message__)

Definition at line 161 of file contracts.hpp.

◆ SPARROW_CONTRACTS_RESTORE_WARNINGS

#define SPARROW_CONTRACTS_RESTORE_WARNINGS

Definition at line 88 of file contracts.hpp.