swift
Loading...
Searching...
No Matches
verify.h File Reference

Go to the source code of this file.

Namespaces

namespace  swift::misc
 Free functions in swift::misc.

Macros

#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
 A weaker kind of assert.
#define SWIFT_VERIFY(COND)
 A weaker kind of assert.
#define SWIFT_AUDIT_X(COND, WHERE, WHAT)
 A weaker kind of verify.
#define SWIFT_AUDIT(COND)
 A weaker kind of verify.

Functions

void swift::misc::private_ns::failedVerify (const char *condition, const char *filename, int line, const char *context, const char *message, bool audit)
 Called by SWIFT_VERIFY when the condition is false.

Macro Definition Documentation

◆ SWIFT_AUDIT

#define SWIFT_AUDIT ( COND)
Value:
SWIFT_AUDIT_X(COND, nullptr, nullptr)
#define SWIFT_AUDIT_X(COND, WHERE, WHAT)
A weaker kind of verify.
Definition verify.h:38

A weaker kind of verify.

Indicative of a serious but recoverable problem originating in an external data source. In debug builds under debugging, triggers a debugger breakpoint. Otherwise generates a warning. Not a substitute for proper validation. A failed audit in production is suggestive of insufficient validation.

Definition at line 41 of file verify.h.

◆ SWIFT_AUDIT_X

#define SWIFT_AUDIT_X ( COND,
WHERE,
WHAT )
Value:
((COND) ? swift::misc::private_ns::noop() : \
swift::misc::private_ns::failedVerify(#COND, __FILE__, __LINE__, WHERE, WHAT, true))

A weaker kind of verify.

Indicative of a serious but recoverable problem originating in an external data source. In debug builds under debugging, triggers a debugger breakpoint. Otherwise generates a warning. Not a substitute for proper validation. A failed audit in production is suggestive of insufficient validation.

Definition at line 38 of file verify.h.

◆ SWIFT_VERIFY

#define SWIFT_VERIFY ( COND)
Value:
SWIFT_VERIFY_X(COND, nullptr, nullptr)
#define SWIFT_VERIFY_X(COND, WHERE, WHAT)
A weaker kind of assert.
Definition verify.h:26

A weaker kind of assert.

Still indicates a programmer mistake, but one which is recoverable. In debug builds, triggers a debugger breakpoint. In release builds, generates a warning.

Definition at line 29 of file verify.h.

◆ SWIFT_VERIFY_X

#define SWIFT_VERIFY_X ( COND,
WHERE,
WHAT )
Value:
((COND) ? swift::misc::private_ns::noop() : \
swift::misc::private_ns::failedVerify(#COND, __FILE__, __LINE__, WHERE, WHAT, false))

A weaker kind of assert.

Still indicates a programmer mistake, but one which is recoverable. In debug builds, triggers a debugger breakpoint. In release builds, generates a warning.

Definition at line 26 of file verify.h.

Function Documentation

◆ failedVerify()

SWIFT_MISC_EXPORT SWIFT_NO_INLINE void swift::misc::private_ns::failedVerify ( const char * condition,
const char * filename,
int line,
const char * context,
const char * message,
bool audit )

Called by SWIFT_VERIFY when the condition is false.

Definition at line 34 of file verify.cpp.