8#ifndef INCLUDED_BSLS_ASSERT
9#define INCLUDED_BSLS_ASSERT
1661#include <bsls_annotation.h>
1670#ifdef BSLS_ASSERT_USE_CONTRACTS
1678#if defined(BSLS_ASSERT_OPT)
1679#error BSLS_ASSERT_OPT is already defined!
1682#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
1683#error BSLS_ASSERT_OPT_IS_ACTIVE is already defined!
1686#if defined(BSLS_ASSERT_OPT_IS_ASSUMED)
1687#error BSLS_ASSERT_OPT_IS_ASSUMED is already defined!
1690#if defined(BSLS_ASSERT_OPT_IS_REVIEW)
1691#error BSLS_ASSERT_OPT_IS_REVIEW is already defined!
1694#if defined(BSLS_ASSERT_OPT_IS_USED)
1695#error BSLS_ASSERT_OPT_IS_USED is already defined!
1698#if defined(BSLS_ASSERT)
1699#error BSLS_ASSERT is already defined!
1702#if defined(BSLS_ASSERT_IS_ACTIVE)
1703#error BSLS_ASSERT_IS_ACTIVE is already defined!
1706#if defined(BSLS_ASSERT_IS_ASSUMED)
1707#error BSLS_ASSERT_IS_ASSUMED is already defined!
1710#if defined(BSLS_ASSERT_IS_REVIEW)
1711#error BSLS_ASSERT_IS_REVIEW is already defined!
1714#if defined(BSLS_ASSERT_IS_USED)
1715#error BSLS_ASSERT_IS_USED is already defined!
1718#if defined(BSLS_ASSERT_SAFE)
1719#error BSLS_ASSERT_SAFE is already defined!
1722#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
1723#error BSLS_ASSERT_SAFE_IS_ACTIVE is already defined!
1726#if defined(BSLS_ASSERT_SAFE_IS_ASSUMED)
1727#error BSLS_ASSERT_SAFE_IS_ASSUMED is already defined!
1730#if defined(BSLS_ASSERT_SAFE_IS_REVIEW)
1731#error BSLS_ASSERT_SAFE_IS_REVIEW is already defined!
1734#if defined(BSLS_ASSERT_SAFE_IS_USED)
1735#error BSLS_ASSERT_SAFE_IS_USED is already defined!
1738#if defined(BSLS_ASSERT_INVOKE)
1739#error BSLS_ASSERT_INVOKE is already defined!
1742#if defined(BSLS_ASSERT_INVOKE_NORETURN)
1743#error BSLS_ASSERT_INVOKE_NORETURN is already defined!
1746#if defined(BSLS_ASSERT_SAFE_UNREACHABLE)
1747#error BSLS_ASSERT_SAFE_UNREACHABLE is already defined!
1750#if defined(BSLS_ASSERT_UNREACHABLE)
1751#error BSLS_ASSERT_UNREACHABLE is already defined!
1754#if defined(BSLS_ASSERT_OPT_UNREACHABLE)
1755#error BSLS_ASSERT_OPT_UNREACHABLE is already defined!
1772#if !(defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) || \
1773 defined(BSLS_ASSERT_LEVEL_ASSERT) || \
1774 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) || \
1775 defined(BSLS_ASSERT_LEVEL_NONE) || \
1776 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) || \
1777 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) || \
1778 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE))
1779 #define BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED 1
1781 #define BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED 0
1784#ifdef BSLS_ASSERT_USE_CONTRACTS
1785#define BSLS_ASSERT_ASSERT_IMP(X,LVL) [[ assert check_never_continue : X ]]
1787#define BSLS_ASSERT_ASSUME_IMP(X,LVL) [[ assert assume : X ]]
1788#define BSLS_ASSERT_ASSUME_ENABLED
1790#ifdef BSLS_ASSERT_VALIDATE_DISABLED_MACROS
1791#define BSLS_ASSERT_DISABLED_IMP(X,LVL) [[ assert ignore : X ]]
1793#define BSLS_ASSERT_DISABLED_IMP(X,LVL) [[ assert : true ]]
1797#define BSLS_ASSERT_ASSERT_IMP(X,LVL) do { \
1798 if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!(X))) { \
1799 BSLS_PERFORMANCEHINT_UNLIKELY_HINT; \
1800 BloombergLP::bsls::Assert::invokeHandler( \
1801 BloombergLP::bsls::AssertViolation(#X, \
1802 BSLS_ASSERTIMPUTIL_FILE, \
1803 BSLS_ASSERTIMPUTIL_LINE, \
1808#if defined(BSLS_PLATFORM_CMP_CLANG)
1810#define BSLS_ASSERT_ASSUME_IMP(X,LVL) __builtin_assume((X)?true:false)
1811#define BSLS_ASSERT_ASSUME_ENABLED
1813#elif defined(BSLS_PLATFORM_CMP_GNU)
1825#elif defined (BSLS_PLATFORM_CMP_MSVC)
1826#define BSLS_ASSERT_ASSUME_IMP(X,LVL) __assume((X)?true:false)
1827#define BSLS_ASSERT_ASSUME_ENABLED
1831#if !defined(BSLS_ASSERT_ASSUME_IMP)
1835#define BSLS_ASSERT_ASSUME_IMP(X,LVL) BSLS_ASSERT_DISABLED_IMP(X,LVL)
1838#ifdef BSLS_ASSERT_VALIDATE_DISABLED_MACROS
1839#define BSLS_ASSERT_DISABLED_IMP(X,LVL) do { \
1840 static_cast<void>(sizeof((!(X))?true:false)); \
1843#define BSLS_ASSERT_DISABLED_IMP(X,LVL) do {} while (false)
1855#define BSLS_ASSERT_UNREACHABLE_IMP(X,LVL) do { \
1856 BloombergLP::bsls::Assert::invokeHandler( \
1857 BloombergLP::bsls::AssertViolation( \
1859 BSLS_ASSERTIMPUTIL_FILE, \
1860 BSLS_ASSERTIMPUTIL_LINE, \
1868#define BSLS_ASSERT_UNREACHABLE_DISABLED_IMP(X,LVL) do { \
1869 (void)sizeof(static_cast<const char*>(X)); \
1879#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) \
1880 || BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED && ( \
1881 defined(BDE_BUILD_TARGET_SAFE_2) || \
1882 defined(BDE_BUILD_TARGET_SAFE) )
1883 #define BSLS_ASSERT_SAFE_IS_ACTIVE
1884#elif defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
1885 #define BSLS_ASSERT_SAFE_IS_REVIEW
1886#elif defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE) && \
1887 !defined(BSLS_REVIEW_OPT_IS_ACTIVE) && \
1888 !defined(BSLS_REVIEW_IS_ACTIVE) && \
1889 !defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
1890 #define BSLS_ASSERT_SAFE_IS_ASSUMED
1894#if defined(BSLS_ASSERT_SAFE_IS_REVIEW) || \
1895 defined(BSLS_ASSERT_SAFE_IS_ACTIVE) || \
1896 (defined(BSLS_ASSERT_SAFE_IS_ASSUMED) \
1897 && defined(BSLS_ASSERT_ASSUME_ENABLED)) || \
1898 defined(BSLS_ASSERT_VALIDATE_DISABLED_MACROS)
1899 #define BSLS_ASSERT_SAFE_IS_USED
1904#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
1905 #define BSLS_ASSERT_SAFE(X) BSLS_ASSERT_ASSERT_IMP( \
1907 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1908#elif defined(BSLS_ASSERT_SAFE_IS_REVIEW)
1909 #define BSLS_ASSERT_SAFE(X) BSLS_REVIEW_REVIEW_IMP( \
1911 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1912#elif defined(BSLS_ASSERT_SAFE_IS_ASSUMED)
1913 #define BSLS_ASSERT_SAFE(X) BSLS_ASSERT_ASSUME_IMP( \
1915 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1917 #define BSLS_ASSERT_SAFE(X) BSLS_ASSERT_DISABLED_IMP( \
1919 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1924#if defined(BSLS_ASSERT_SAFE_IS_ACTIVE)
1925 #define BSLS_ASSERT_SAFE_UNREACHABLE(X) BSLS_ASSERT_UNREACHABLE_IMP( \
1927 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1928#elif defined(BSLS_ASSERT_SAFE_IS_REVIEW)
1929 #define BSLS_ASSERT_SAFE_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
1931 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1933 #define BSLS_ASSERT_SAFE_UNREACHABLE(X) \
1934 BSLS_ASSERT_UNREACHABLE_DISABLED_IMP( \
1936 BloombergLP::bsls::Assert::k_LEVEL_SAFE)
1947#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) || \
1948 defined(BSLS_ASSERT_LEVEL_ASSERT) \
1949 || BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED && ( \
1950 defined(BDE_BUILD_TARGET_SAFE_2) || \
1951 defined(BDE_BUILD_TARGET_SAFE) || \
1952 !defined(BDE_BUILD_TARGET_OPT) )
1953 #define BSLS_ASSERT_IS_ACTIVE
1954#elif defined(BSLS_REVIEW_IS_ACTIVE)
1955 #define BSLS_ASSERT_IS_REVIEW
1956#elif (defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE) || \
1957 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)) && \
1958 !defined(BSLS_REVIEW_OPT_IS_ACTIVE) && \
1959 !defined(BSLS_REVIEW_IS_ACTIVE) && \
1960 !defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
1961 #define BSLS_ASSERT_IS_ASSUMED
1965#if defined(BSLS_ASSERT_IS_REVIEW) || \
1966 defined(BSLS_ASSERT_IS_ACTIVE) || \
1967 (defined(BSLS_ASSERT_IS_ASSUMED) \
1968 && defined(BSLS_ASSERT_ASSUME_ENABLED)) || \
1969 defined(BSLS_ASSERT_VALIDATE_DISABLED_MACROS)
1970 #define BSLS_ASSERT_IS_USED
1975#if defined(BSLS_ASSERT_IS_ACTIVE)
1976 #define BSLS_ASSERT(X) BSLS_ASSERT_ASSERT_IMP( \
1978 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
1979#elif defined(BSLS_ASSERT_IS_REVIEW)
1980 #define BSLS_ASSERT(X) BSLS_REVIEW_REVIEW_IMP( \
1982 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
1983#elif defined(BSLS_ASSERT_IS_ASSUMED)
1984 #define BSLS_ASSERT(X) BSLS_ASSERT_ASSUME_IMP( \
1986 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
1988 #define BSLS_ASSERT(X) BSLS_ASSERT_DISABLED_IMP( \
1990 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
1995#if defined(BSLS_ASSERT_IS_ACTIVE)
1996 #define BSLS_ASSERT_UNREACHABLE(X) BSLS_ASSERT_UNREACHABLE_IMP( \
1998 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
1999#elif defined(BSLS_ASSERT_IS_REVIEW)
2000 #define BSLS_ASSERT_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
2002 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
2004 #define BSLS_ASSERT_UNREACHABLE(X) \
2005 BSLS_ASSERT_UNREACHABLE_DISABLED_IMP( \
2007 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
2017#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) || \
2018 defined(BSLS_ASSERT_LEVEL_ASSERT) || \
2019 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) \
2020 || BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED
2021 #define BSLS_ASSERT_OPT_IS_ACTIVE
2022#elif defined(BSLS_REVIEW_OPT_IS_ACTIVE)
2023 #define BSLS_ASSERT_OPT_IS_REVIEW
2024#elif (defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE) || \
2025 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) || \
2026 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)) && \
2027 !defined(BSLS_REVIEW_OPT_IS_ACTIVE) && \
2028 !defined(BSLS_REVIEW_IS_ACTIVE) && \
2029 !defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
2030 #define BSLS_ASSERT_OPT_IS_ASSUMED
2034#if defined(BSLS_ASSERT_OPT_IS_REVIEW) || \
2035 defined(BSLS_ASSERT_OPT_IS_ACTIVE) || \
2036 (defined(BSLS_ASSERT_OPT_IS_ASSUMED) \
2037 && defined(BSLS_ASSERT_ASSUME_ENABLED)) || \
2038 defined(BSLS_ASSERT_VALIDATE_DISABLED_MACROS)
2039 #define BSLS_ASSERT_OPT_IS_USED
2044#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
2045 #define BSLS_ASSERT_OPT(X) BSLS_ASSERT_ASSERT_IMP( \
2047 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2048#elif defined(BSLS_ASSERT_OPT_IS_REVIEW)
2049 #define BSLS_ASSERT_OPT(X) BSLS_REVIEW_REVIEW_IMP( \
2051 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2052#elif defined(BSLS_ASSERT_OPT_IS_ASSUMED)
2053 #define BSLS_ASSERT_OPT(X) BSLS_ASSERT_ASSUME_IMP( \
2055 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2057 #define BSLS_ASSERT_OPT(X) BSLS_ASSERT_DISABLED_IMP( \
2059 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2064#if defined(BSLS_ASSERT_OPT_IS_ACTIVE)
2065 #define BSLS_ASSERT_OPT_UNREACHABLE(X) BSLS_ASSERT_UNREACHABLE_IMP( \
2067 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2068#elif defined(BSLS_ASSERT_OPT_IS_REVIEW)
2069 #define BSLS_ASSERT_OPT_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
2071 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2073 #define BSLS_ASSERT_OPT_UNREACHABLE(X) \
2074 BSLS_ASSERT_UNREACHABLE_DISABLED_IMP( \
2076 BloombergLP::bsls::Assert::k_LEVEL_OPT)
2084#define BSLS_ASSERT_INVOKE(X) do { \
2085 BloombergLP::bsls::Assert::invokeHandler( \
2086 BloombergLP::bsls::AssertViolation( \
2088 BSLS_ASSERTIMPUTIL_FILE, \
2089 BSLS_ASSERTIMPUTIL_LINE, \
2090 BloombergLP::bsls::Assert::k_LEVEL_INVOKE));\
2101#define BSLS_ASSERT_INVOKE_NORETURN(X) do { \
2102 BloombergLP::bsls::Assert::invokeHandlerNoReturn( \
2103 BloombergLP::bsls::AssertViolation( \
2105 BSLS_ASSERTIMPUTIL_FILE, \
2106 BSLS_ASSERTIMPUTIL_LINE, \
2107 BloombergLP::bsls::Assert::k_LEVEL_INVOKE));\
2115#ifdef BSLS_ASSERT_ENABLE_NORETURN_FOR_INVOKE_HANDLER
2116#define BSLS_ASSERT_NORETURN_INVOKE_HANDLER BSLS_ANNOTATION_NORETURN
2118#define BSLS_ASSERT_NORETURN_INVOKE_HANDLER BSLS_ANNOTATION_ANALYZER_NORETURN
2125#ifndef BSLS_ASSERT_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
2126#define BSLS_ASSERT_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
2142 const char *d_comment_p;
2146 const char *d_fileName_p;
2152 const char *d_assertLevel_p;
2229 typedef void (*
Handler)(
const char *,
const char *, int);
2337#ifdef BSLS_ASSERT_USE_CONTRACTS
2341 static void invokeLanguageContractHandler(
2342 const std::contract_violation& violation);
2381 static void failAbort(
const char *comment,
const char *file,
int line);
2391 static void failSleep(
const char *comment,
const char *file,
int line);
2400 static void failThrow(
const char *comment,
const char *file,
int line);
2478#ifndef BDE_OPENSOURCE_PUBLICATION
2490#ifndef BDE_OMIT_INTERNAL_DEPRECATED
2497#define BDE_ASSERT_H(X) BSLS_ASSERT_SAFE(X)
2498#define BSL_ASSERT_H(X) BSLS_ASSERT_SAFE(X)
2506#define BDE_ASSERT_CPP(X) BSLS_ASSERT(X)
2507#define BSL_ASSERT_CPP(X) BSLS_ASSERT(X)
2521#define BSLS_ASSERT_ASSERT(X) BSLS_ASSERT_ASSERT_IMP( \
2523 BloombergLP::bsls::Assert::k_LEVEL_ASSERT)
2550 const char *fileName,
2552 const char *assertLevel)
2553: d_comment_p((comment == 0) ?
"" : comment)
2554, d_fileName_p((fileName == 0) ?
"" : fileName)
2555, d_lineNumber(lineNumber)
2556, d_assertLevel_p((assertLevel == 0) ?
"" : assertLevel)
2564 return d_assertLevel_p;
2576 return d_fileName_p;
2582 return d_lineNumber;
2594#undef BSLS_ASSERT_NORETURN_INVOKE_HANDLER
2595#undef BSLS_ASSERT_NO_ASSERTION_MACROS_DEFINED
2596#undef BSLS_ASSERT_ASSUME_ENABLED
2615#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2616 defined(BSLS_ASSERT_LEVEL_ASSERT)
2617#error incompatible BSLS_ASSERT levels: \
2618..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT
2621#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2622 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
2623#error incompatible BSLS_ASSERT levels: \
2624..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT_OPT
2627#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2628 defined(BSLS_ASSERT_LEVEL_NONE)
2629#error incompatible BSLS_ASSERT levels: \
2630..._LEVEL_ASSERT_SAFE and ..._LEVEL_NONE
2633#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2634 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
2635#error incompatible BSLS_ASSERT levels: \
2636..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_OPT
2639#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2640 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
2641#error incompatible BSLS_ASSERT levels: \
2642..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_ASSERT
2645#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
2646 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2647#error incompatible BSLS_ASSERT levels: \
2648..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_SAFE
2651#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
2652 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
2653#error incompatible BSLS_ASSERT levels: \
2654..._LEVEL_ASSERT and ..._LEVEL_ASSERT_OPT
2657#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
2658 defined(BSLS_ASSERT_LEVEL_NONE)
2659#error incompatible BSLS_ASSERT levels: \
2660..._LEVEL_ASSERT and ..._LEVEL_NONE
2663#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
2664 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
2665#error incompatible BSLS_ASSERT levels: \
2666..._LEVEL_ASSERT and ..._LEVEL_ASSUME_OPT
2669#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
2670 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
2671#error incompatible BSLS_ASSERT levels: \
2672..._LEVEL_ASSERT and ..._LEVEL_ASSUME_ASSERT
2675#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
2676 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2677#error incompatible BSLS_ASSERT levels: \
2678..._LEVEL_ASSERT and ..._LEVEL_ASSUME_SAFE
2681#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
2682 defined(BSLS_ASSERT_LEVEL_NONE)
2683#error incompatible BSLS_ASSERT levels: \
2684..._LEVEL_ASSERT_OPT and ..._LEVEL_NONE
2687#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
2688 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
2689#error incompatible BSLS_ASSERT levels: \
2690..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_OPT
2693#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
2694 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
2695#error incompatible BSLS_ASSERT levels: \
2696..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_ASSERT
2699#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
2700 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2701#error incompatible BSLS_ASSERT levels: \
2702..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_SAFE
2705#if defined(BSLS_ASSERT_LEVEL_NONE) && \
2706 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
2707#error incompatible BSLS_ASSERT levels: \
2708..._LEVEL_NONE and ..._LEVEL_ASSUME_OPT
2711#if defined(BSLS_ASSERT_LEVEL_NONE) && \
2712 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
2713#error incompatible BSLS_ASSERT levels: \
2714..._LEVEL_NONE and ..._LEVEL_ASSUME_ASSERT
2717#if defined(BSLS_ASSERT_LEVEL_NONE) && \
2718 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2719#error incompatible BSLS_ASSERT levels: \
2720..._LEVEL_NONE and ..._LEVEL_ASSUME_SAFE
2723#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
2724 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
2725#error incompatible BSLS_ASSERT levels: \
2726..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_ASSERT
2729#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
2730 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2731#error incompatible BSLS_ASSERT levels: \
2732..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_SAFE
2735#if defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) && \
2736 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
2737#error incompatible BSLS_ASSERT levels: \
2738..._LEVEL_ASSUME_ASSERT and ..._LEVEL_ASSUME_SAFE
Definition bsls_assert.h:2451
AssertFailureHandlerGuard(Assert::Handler temporary)
AssertFailureHandlerGuard(Assert::ViolationHandler temporary)
~AssertFailureHandlerGuard()
Definition bsls_assert.h:2139
BSLS_KEYWORD_CONSTEXPR AssertViolation(const char *comment, const char *fileName, int lineNumber, const char *assertLevel)
Definition bsls_assert.h:2549
int lineNumber() const
Return the lineNumber attribute of this object.
Definition bsls_assert.h:2580
const char * comment() const
Return the comment attribute of this object.
Definition bsls_assert.h:2568
const char * assertLevel() const
Return the assertLevel attribute of this object.
Definition bsls_assert.h:2562
const char * fileName() const
Return the fileName attribute of this object.
Definition bsls_assert.h:2574
Definition bsls_assert.h:2209
static Assert::ViolationHandler violationHandler()
static BSLS_ANNOTATION_NORETURN void invokeHandlerNoReturn(const AssertViolation &violation)
static BSLS_ANNOTATION_NORETURN void failSleep(const char *comment, const char *file, int line)
static const char k_LEVEL_ASSERT[]
Definition bsls_assert.h:2258
static void setViolationHandler(Assert::ViolationHandler function)
static void lockAssertAdministration()
static const char k_LEVEL_SAFE[]
Definition bsls_assert.h:2256
static Assert::Handler failureHandler()
static BSLS_ASSERT_NORETURN_INVOKE_HANDLER void invokeHandler(const char *text, const char *file, int line)
static BSLS_ANNOTATION_NORETURN void failByThrow(const AssertViolation &violation)
static BSLS_ANNOTATION_NORETURN void failBySleep(const AssertViolation &violation)
static bool abortUponReturningAssertionFailureHandler()
static void setFailureHandler(Assert::Handler function)
static BSLS_ANNOTATION_NORETURN void failAbort(const char *comment, const char *file, int line)
static BSLS_ANNOTATION_NORETURN void failByAbort(const AssertViolation &violation)
static void permitOutOfPolicyReturningFailureHandler()
void(* Handler)(const char *, const char *, int)
Definition bsls_assert.h:2229
static BSLS_ASSERT_NORETURN_INVOKE_HANDLER void invokeHandler(const AssertViolation &violation)
static const char k_LEVEL_INVOKE[]
Definition bsls_assert.h:2259
static const char k_LEVEL_OPT[]
Definition bsls_assert.h:2257
void(* ViolationHandler)(const AssertViolation &)
Definition bsls_assert.h:2220
static const char * k_permitOutOfPolicyReturningAssertionBuildKey
Definition bsls_assert.h:2262
static BSLS_ANNOTATION_NORETURN void failThrow(const char *comment, const char *file, int line)
#define BSLS_ANNOTATION_ANALYZER_NORETURN
Definition bsls_annotation.h:391
#define BSLS_ANNOTATION_NORETURN
Definition bsls_annotation.h:378
bsls::Assert bsls_Assert
This alias is defined for backward compatibility.
Definition bsls_assert.h:2528
bsls::AssertFailureHandlerGuard bsls_AssertFailureHandlerGuard
This alias is defined for backward compatibility.
Definition bsls_assert.h:2531
bsls::AssertFailureHandlerGuard bdes_AssertFailureHandlerGuard
This alias is defined for backward compatibility.
Definition bsls_assert.h:2513
#define BSLS_ASSERT_NORETURN_INVOKE_HANDLER
Definition bsls_assert.h:2118
bsls::Assert bdes_Assert
This alias is defined for backward compatibility.
Definition bsls_assert.h:2510
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:624
Definition bdlt_iso8601util.h:707