|
BDE 4.39.x Production Release
|
#include <bsls_assert.h>
This "utility" class maintains a pointer containing the address of the current assertion-failure handler function (of type Assert::ViolationHandler) and provides methods to administer this function pointer. The invokeHandler method calls the currently-installed failure handler. This class also provides a suite of standard failure-handler functions that are suitable to be installed as the current Assert::ViolationHandler function.
abort, exit, terminate, throw, or hang).Finally, this class defines the constant strings that are passed as the reviewLevel to the bsls_review handler for checks that failed in "review mode" (see {Assertion Modes}).
See bsls_assert
Public Types | |
| typedef void(* | ViolationHandler) (const AssertViolation &) |
| typedef void(* | Handler) (const char *, const char *, int) |
Static Public Attributes | |
| static const char | k_LEVEL_SAFE [] |
| static const char | k_LEVEL_OPT [] |
| static const char | k_LEVEL_ASSERT [] |
| static const char | k_LEVEL_INVOKE [] |
| static const char * | k_permitOutOfPolicyReturningAssertionBuildKey |
Friends | |
| class | AssertFailureHandlerGuard |
| typedef void(* bsls::Assert::Handler) (const char *, const char *, int) |
Handler is an alias for a pointer to a function returning void, and taking, as parameters, two null-terminated strings and an int, which is the structure of all assertion-failure handler functions supported by this class – e.g.,
| typedef void(* bsls::Assert::ViolationHandler) (const AssertViolation &) |
ViolationHandler is an alias for a pointer to a function returning void, and taking, as a parameter a single const reference to a bsls::AssertViolation – e.g.,
|
static |
Return true if k_permitOutOfPolicyReturningAssertionBuildKey does not have the value "bsls-PermitOutOfPolicyReturn" or permitOutOfPolicyReturningFailureHandler has not previously been invoked, and false otherwise.
true indicates that bsls::Assert should abort the task if the currently installed assertion-failure handler returns normally (after the detection of a failed assertion).
|
static |
Emulate the invocation of the standard assert macro with a false argument, using the specified expression comment, file name, and line number to generate a helpful output message and then, after logging, unconditionally aborting.
|
static |
(Default Handler) Emulate the invocation of the standard assert macro with a false argument, using the expression comment, file name, and line number from the specified violation to generate a helpful output message and then, after logging, unconditionally aborting.
|
static |
Use the expression comment, file name, and line number from the specified violation to generate a helpful output message and then, after logging, spin in an infinite loop.
|
static |
Throw an AssertTestException whose attributes are the comemnt, file, line, and level from the specified violation provided that BDE_BUILD_TARGET_EXC is defined; otherwise, log an appropriate message and abort the program (similar to failByAbort).
|
static |
Use the specified expression comment, file name, and line number to generate a helpful output message and then, after logging, spin in an infinite loop.
|
static |
Throw an AssertTestException whose attributes are the specified comemnt, file, line, and level provided that BDE_BUILD_TARGET_EXC is defined; otherwise, log an appropriate message and abort the program (similar to failAbort).
|
static |
Return the address of the currently installed assertion-failure handler function if it is a Handler (and not a ViolationHandler); otherwise, return NULL.
|
static |
Invoke the currently installed assertion-failure handler function with the specified violation.
BSLS_ASSERT_ENABLE_NORETURN_FOR_INVOKE_HANDLER is defined, and the currently installed assertion-failure handler function returns to the caller (i.e., the assertion handler does not abort, exit, terminate, throw, or hang). BSLS_ASSERT_INVOKE). Also note that the configuration macro BSLS_ASSERT_ENABLE_NORETURN_FOR_INVOKE_HANDLER is intended to support static analysis tools, which require an annotation to see that a failed "ASSERT" prevents further execution of a function with "bad" values.
|
static |
Invoke the currently installed assertion-failure handler function with the specified expression text, file name, and line number as its arguments.
BSLS_ASSERT_ENABLE_NORETURN_FOR_INVOKE_HANDLER is defined, and the currently installed assertion-failure handler function returns to the caller (i.e., the assertion handler does not abort, exit, terminate, throw, or hang). bsls::AssertViolation overload of invokeHandler instead.
|
static |
Invoke the currently installed assertion-failure handler function with the specified violation. If the handler returns normally, invoke bsls::Assert::failByAbort.
|
static |
Disable all subsequent calls to setFailureHandler.
AssertFailureHandlerGuard object.
|
static |
DO NOT USE! It is a violation of Bloomberg policy to invoke this function without having prior authorization from senior management.
Allow an assertion handler to return control to the calling function (after a failed assertion).
BSLS_ASSERT_ENABLE_NORETURN_FOR_INVOKE_HANDLER is defined (and thus invokeHandler would not be able to return anyway). Internal Bloomberg users should contact the BDE team if they feel their application might need to violate Bloomberg policy by allowing the currently installed assertion handler to return normally (after a failed assertion).
|
static |
Make the specified handler function the current assertion-failure handler. This method has no effect if the lockAssertAdministration method has been called.
|
static |
Make the specified violation handler function the current assertion-failure handler. This method has no effect if the lockAssertAdministration method has been called.
|
static |
Return the address of the currently installed assertion-failure handler function.
|
friend |
|
static |
|
static |
|
static |
|
static |
|
static |