swift
Namespaces | Functions
verify.h File Reference

Go to the source code of this file.

Namespaces

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

Macros

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

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)    SWIFT_AUDIT_X(COND, nullptr, nullptr)

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)    SWIFT_VERIFY_X(COND, nullptr, nullptr)

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.