8#ifndef INCLUDED_BSLS_REVIEW
9#define INCLUDED_BSLS_REVIEW
709#include <bsls_annotation.h>
718#ifdef BSLS_ASSERT_USE_CONTRACTS
726#if defined(BSLS_REVIEW)
727#error BSLS_REVIEW is already defined!
730#if defined(BSLS_REVIEW_REVIEW_IMP)
731#error BSLS_REVIEW_REVIEW_IMP is already defined!
734#if defined(BSLS_REVIEW_REVIEW_COUNT_IMP)
735#error BSLS_REVIEW_REVIEW_COUNT_IMP is already defined!
738#if defined(BSLS_REVIEW_DISABLED_IMP)
739#error BSLS_REVIEW_DISABLED_IMP is already defined!
742#if defined(BSLS_REVIEW_INVOKE)
743#error BSLS_REVIEW_INVOKE is already defined!
746#if defined(BSLS_REVIEW_UNREACHABLE_IMP)
747#error BSLS_REVIEW_UNREACHABLE_IMP is already defined!
750#if defined(BSLS_REVIEW_UNREACHABLE_DISABLED_IMP)
751#error BSLS_REVIEW_UNREACHABLE_DISABLED_IMP is already defined!
754#if defined(BSLS_REVIEW_IS_ACTIVE)
755#error BSLS_REVIEW_IS_ACTIVE is already defined!
758#if defined(BSLS_REVIEW_IS_USED)
759#error BSLS_REVIEW_IS_USED is already defined!
762#if defined(BSLS_REVIEW_OPT)
763#error BSLS_REVIEW_OPT is already defined!
766#if defined(BSLS_REVIEW_OPT_IS_ACTIVE)
767#error BSLS_REVIEW_OPT_IS_ACTIVE is already defined!
770#if defined(BSLS_REVIEW_OPT_IS_USED)
771#error BSLS_REVIEW_OPT_IS_USED is already defined!
774#if defined(BSLS_REVIEW_SAFE)
775#error BSLS_REVIEW_SAFE is already defined!
778#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
779#error BSLS_REVIEW_SAFE_IS_ACTIVE is already defined!
782#if defined(BSLS_REVIEW_SAFE_IS_USED)
783#error BSLS_REVIEW_SAFE_IS_USED is already defined!
786#if defined(BSLS_REVIEW_SAFE_UNREACHABLE)
787#error BSLS_REVIEW_SAFE_UNREACHABLE is already defined!
790#if defined(BSLS_REVIEW_UNREACHABLE)
791#error BSLS_REVIEW_UNREACHABLE is already defined!
794#if defined(BSLS_REVIEW_OPT_UNREACHABLE)
795#error BSLS_REVIEW_OPT_UNREACHABLE is already defined!
812#if !(defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) || \
813 defined(BSLS_REVIEW_LEVEL_REVIEW) || \
814 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT) || \
815 defined(BSLS_REVIEW_LEVEL_NONE))
821 #if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE)
822 #define BSLS_REVIEW_LEVEL_REVIEW_SAFE
823 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
824 #elif defined(BSLS_ASSERT_LEVEL_ASSERT)
825 #define BSLS_REVIEW_LEVEL_REVIEW
826 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
827 #elif defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
828 #define BSLS_REVIEW_LEVEL_REVIEW_OPT
829 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
830 #elif defined(BSLS_ASSERT_LEVEL_NONE) || \
831 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE) || \
832 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) || \
833 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
834 #define BSLS_REVIEW_LEVEL_NONE
835 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
840 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 1
843 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
855#ifdef BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14
856 #define BSLS_REVIEW_REVIEW_COUNT_IMP \
857 const int lastCount = BloombergLP::bsls::Review::updateCount( \
859 static BloombergLP::bsls::Review::Count count = {0}; \
863 #define BSLS_REVIEW_REVIEW_COUNT_IMP \
864 static BloombergLP::bsls::Review::Count count = {0}; \
865 const int lastCount = BloombergLP::bsls::Review::updateCount(&count);
872#ifdef BSLS_ASSERT_USE_CONTRACTS
873#define BSLS_REVIEW_REVIEW_IMP(X,LVL) [[ assert check_maybe_continue : X ]]
875#ifdef BSLS_REVIEW_VALIDATE_DISABLED_MACROS
876#define BSLS_REVIEW_DISABLED_IMP(X,LVL) [[ assert ignore : X ]]
878#define BSLS_REVIEW_DISABLED_IMP(X,LVL) [[ assert : true ]]
883#define BSLS_REVIEW_REVIEW_IMP(X,LVL) do { \
884 if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!(X))) { \
885 BSLS_PERFORMANCEHINT_UNLIKELY_HINT; \
886 BSLS_REVIEW_REVIEW_COUNT_IMP; \
887 BloombergLP::bsls::Review::invokeHandler( \
888 BloombergLP::bsls::ReviewViolation(#X, \
889 BSLS_ASSERTIMPUTIL_FILE, \
890 BSLS_ASSERTIMPUTIL_LINE, \
896#ifdef BSLS_REVIEW_VALIDATE_DISABLED_MACROS
897#define BSLS_REVIEW_DISABLED_IMP(X,LVL) do { \
898 static_cast<void>(sizeof(!(X)?true:false)); \
901#define BSLS_REVIEW_DISABLED_IMP(X,LVL) do {} while (false)
911#define BSLS_REVIEW_INVOKE(X) do { \
912 BSLS_REVIEW_REVIEW_COUNT_IMP; \
913 BloombergLP::bsls::Review::invokeHandler( \
914 BloombergLP::bsls::ReviewViolation( \
916 BSLS_ASSERTIMPUTIL_FILE, \
917 BSLS_ASSERTIMPUTIL_LINE, \
918 BloombergLP::bsls::Review::k_LEVEL_INVOKE, \
930#define BSLS_REVIEW_UNREACHABLE_IMP(X,LVL) do { \
931 BSLS_REVIEW_REVIEW_COUNT_IMP; \
932 BloombergLP::bsls::Review::invokeHandler( \
933 BloombergLP::bsls::ReviewViolation( \
935 BSLS_ASSERTIMPUTIL_FILE, \
936 BSLS_ASSERTIMPUTIL_LINE, \
945#define BSLS_REVIEW_UNREACHABLE_DISABLED_IMP(X,LVL) do { \
946 (void)sizeof(static_cast<const char*>(X)); \
955#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) \
956 || BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED && ( \
957 defined(BDE_BUILD_TARGET_SAFE_2) || \
958 defined(BDE_BUILD_TARGET_SAFE) )
960 #define BSLS_REVIEW_SAFE_IS_ACTIVE
964#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE) || \
965 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
966 #define BSLS_REVIEW_SAFE_IS_USED
971#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
972 #define BSLS_REVIEW_SAFE(X) BSLS_REVIEW_REVIEW_IMP( \
974 BloombergLP::bsls::Review::k_LEVEL_SAFE)
976 #define BSLS_REVIEW_SAFE(X) BSLS_REVIEW_DISABLED_IMP( \
978 BloombergLP::bsls::Review::k_LEVEL_SAFE)
983#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
984 #define BSLS_REVIEW_SAFE_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
986 BloombergLP::bsls::Review::k_LEVEL_SAFE)
988 #define BSLS_REVIEW_SAFE_UNREACHABLE(X) \
989 BSLS_REVIEW_UNREACHABLE_DISABLED_IMP( \
991 BloombergLP::bsls::Review::k_LEVEL_SAFE)
1000#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) || \
1001 defined(BSLS_REVIEW_LEVEL_REVIEW) \
1002 || BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED && ( \
1003 defined(BDE_BUILD_TARGET_SAFE_2) || \
1004 defined(BDE_BUILD_TARGET_SAFE) || \
1005 !defined(BDE_BUILD_TARGET_OPT) )
1007 #define BSLS_REVIEW_IS_ACTIVE
1011#if defined(BSLS_REVIEW_IS_ACTIVE) || \
1012 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
1013 #define BSLS_REVIEW_IS_USED
1018#if defined(BSLS_REVIEW_IS_ACTIVE)
1019 #define BSLS_REVIEW(X) BSLS_REVIEW_REVIEW_IMP( \
1021 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
1023 #define BSLS_REVIEW(X) BSLS_REVIEW_DISABLED_IMP( \
1025 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
1030#if defined(BSLS_REVIEW_IS_ACTIVE)
1031 #define BSLS_REVIEW_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
1033 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
1035 #define BSLS_REVIEW_UNREACHABLE(X) \
1036 BSLS_REVIEW_UNREACHABLE_DISABLED_IMP( \
1038 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
1047#if !defined(BSLS_REVIEW_LEVEL_NONE)
1048 #define BSLS_REVIEW_OPT_IS_ACTIVE
1052#if defined(BSLS_REVIEW_OPT_IS_ACTIVE) || \
1053 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
1054 #define BSLS_REVIEW_OPT_IS_USED
1059#if defined(BSLS_REVIEW_OPT_IS_ACTIVE)
1060 #define BSLS_REVIEW_OPT(X) BSLS_REVIEW_REVIEW_IMP( \
1062 BloombergLP::bsls::Review::k_LEVEL_OPT)
1064 #define BSLS_REVIEW_OPT(X) BSLS_REVIEW_DISABLED_IMP( \
1066 BloombergLP::bsls::Review::k_LEVEL_OPT)
1071#if defined(BSLS_REVIEW_OPT_IS_ACTIVE)
1072 #define BSLS_REVIEW_OPT_UNREACHABLE(X) BSLS_REVIEW_UNREACHABLE_IMP( \
1074 BloombergLP::bsls::Review::k_LEVEL_OPT)
1076 #define BSLS_REVIEW_OPT_UNREACHABLE(X) \
1077 BSLS_REVIEW_UNREACHABLE_DISABLED_IMP( \
1079 BloombergLP::bsls::Review::k_LEVEL_OPT)
1083#ifndef BSLS_REVIEW_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
1084#define BSLS_REVIEW_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
1100 const char *d_comment_p;
1104 const char *d_fileName_p;
1110 const char *d_reviewLevel_p;
1188 typedef bsls::AtomicOperations::AtomicTypes::Int
Count;
1254#ifdef BSLS_ASSERT_USE_CONTRACTS
1255 static void invokeLanguageContractHandler(
1256 const std::contract_violation& violation);
1345 const char *fileName,
1347 const char *reviewLevel,
1349: d_comment_p((comment == 0) ?
"" : comment)
1350, d_fileName_p((fileName == 0) ?
"" : fileName)
1351, d_lineNumber(lineNumber)
1352, d_reviewLevel_p((reviewLevel == 0) ?
"" : reviewLevel)
1373 return d_fileName_p;
1379 return d_lineNumber;
1385 return d_reviewLevel_p;
1397#undef BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED
1413#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1414 defined(BSLS_REVIEW_LEVEL_REVIEW)
1415#error incompatible BSLS_REVIEW levels: \
1416..._LEVEL_REVIEW_SAFE and ..._LEVEL_REVIEW
1419#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1420 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT)
1421#error incompatible BSLS_REVIEW levels: \
1422..._LEVEL_REVIEW_SAFE and ..._LEVEL_REVIEW_OPT
1425#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1426 defined(BSLS_REVIEW_LEVEL_NONE)
1427#error incompatible BSLS_REVIEW levels: \
1428..._LEVEL_REVIEW_SAFE and ..._LEVEL_NONE
1431#if defined(BSLS_REVIEW_LEVEL_REVIEW) && \
1432 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT)
1433#error incompatible BSLS_REVIEW levels: \
1434..._LEVEL_REVIEW and ..._LEVEL_REVIEW_OPT
1437#if defined(BSLS_REVIEW_LEVEL_REVIEW) && \
1438 defined(BSLS_REVIEW_LEVEL_NONE)
1439#error incompatible BSLS_REVIEW levels: \
1440..._LEVEL_REVIEW and ..._LEVEL_NONE
1443#if defined(BSLS_REVIEW_LEVEL_REVIEW_OPT) && \
1444 defined(BSLS_REVIEW_LEVEL_NONE)
1445#error incompatible BSLS_REVIEW levels: \
1446..._LEVEL_REVIEW_OPT and ..._LEVEL_NONE
1464#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1465 defined(BSLS_ASSERT_LEVEL_ASSERT)
1466#error incompatible BSLS_ASSERT levels: \
1467..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT
1470#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1471 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
1472#error incompatible BSLS_ASSERT levels: \
1473..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT_OPT
1476#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1477 defined(BSLS_ASSERT_LEVEL_NONE)
1478#error incompatible BSLS_ASSERT levels: \
1479..._LEVEL_ASSERT_SAFE and ..._LEVEL_NONE
1482#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1483 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1484#error incompatible BSLS_ASSERT levels: \
1485..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_OPT
1488#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1489 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1490#error incompatible BSLS_ASSERT levels: \
1491..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_ASSERT
1494#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1495 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1496#error incompatible BSLS_ASSERT levels: \
1497..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_SAFE
1500#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1501 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
1502#error incompatible BSLS_ASSERT levels: \
1503..._LEVEL_ASSERT and ..._LEVEL_ASSERT_OPT
1506#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1507 defined(BSLS_ASSERT_LEVEL_NONE)
1508#error incompatible BSLS_ASSERT levels: \
1509..._LEVEL_ASSERT and ..._LEVEL_NONE
1512#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1513 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1514#error incompatible BSLS_ASSERT levels: \
1515..._LEVEL_ASSERT and ..._LEVEL_ASSUME_OPT
1518#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1519 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1520#error incompatible BSLS_ASSERT levels: \
1521..._LEVEL_ASSERT and ..._LEVEL_ASSUME_ASSERT
1524#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1525 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1526#error incompatible BSLS_ASSERT levels: \
1527..._LEVEL_ASSERT and ..._LEVEL_ASSUME_SAFE
1530#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1531 defined(BSLS_ASSERT_LEVEL_NONE)
1532#error incompatible BSLS_ASSERT levels: \
1533..._LEVEL_ASSERT_OPT and ..._LEVEL_NONE
1536#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1537 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1538#error incompatible BSLS_ASSERT levels: \
1539..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_OPT
1542#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1543 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1544#error incompatible BSLS_ASSERT levels: \
1545..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_ASSERT
1548#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1549 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1550#error incompatible BSLS_ASSERT levels: \
1551..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_SAFE
1554#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1555 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1556#error incompatible BSLS_ASSERT levels: \
1557..._LEVEL_NONE and ..._LEVEL_ASSUME_OPT
1560#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1561 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1562#error incompatible BSLS_ASSERT levels: \
1563..._LEVEL_NONE and ..._LEVEL_ASSUME_ASSERT
1566#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1567 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1568#error incompatible BSLS_ASSERT levels: \
1569..._LEVEL_NONE and ..._LEVEL_ASSUME_SAFE
1572#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
1573 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1574#error incompatible BSLS_ASSERT levels: \
1575..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_ASSERT
1578#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
1579 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1580#error incompatible BSLS_ASSERT levels: \
1581..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_SAFE
1584#if defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) && \
1585 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1586#error incompatible BSLS_ASSERT levels: \
1587..._LEVEL_ASSUME_ASSERT and ..._LEVEL_ASSUME_SAFE
Definition bsls_review.h:1310
~ReviewFailureHandlerGuard()
ReviewFailureHandlerGuard(Review::ViolationHandler temporary)
Definition bsls_review.h:1097
BSLS_KEYWORD_CONSTEXPR ReviewViolation(const char *comment, const char *fileName, int lineNumber, const char *reviewLevel, int count)
Definition bsls_review.h:1344
int lineNumber() const
Return the lineNumber attribute of this object.
Definition bsls_review.h:1377
int count() const
Return the count attribute of this object.
Definition bsls_review.h:1365
const char * reviewLevel() const
Return the reviewLevel attribute of this object.
Definition bsls_review.h:1383
const char * fileName() const
Return the fileName attribute of this object.
Definition bsls_review.h:1371
const char * comment() const
Return the comment attribute of this object.
Definition bsls_review.h:1359
Definition bsls_review.h:1179
static Review::ViolationHandler violationHandler()
static const char k_LEVEL_REVIEW[]
Definition bsls_review.h:1216
static void setViolationHandler(Review::ViolationHandler function)
static BSLS_ANNOTATION_NORETURN void failByThrow(const ReviewViolation &violation)
static int updateCount(Count *count)
static const char k_LEVEL_OPT[]
Definition bsls_review.h:1215
bsls::AtomicOperations::AtomicTypes::Int Count
Definition bsls_review.h:1188
static void failByLog(const ReviewViolation &violation)
static const char k_LEVEL_SAFE[]
Definition bsls_review.h:1214
static void invokeHandler(const ReviewViolation &violation)
void(* ViolationHandler)(const ReviewViolation &)
Definition bsls_review.h:1196
static BSLS_ANNOTATION_NORETURN void failByAbort(const ReviewViolation &violation)
static void lockReviewAdministration()
static const char k_LEVEL_INVOKE[]
Definition bsls_review.h:1217
static BSLS_ANNOTATION_NORETURN void failBySleep(const ReviewViolation &violation)
#define BSLS_ANNOTATION_NORETURN
Definition bsls_annotation.h:378
#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