8#ifndef INCLUDED_BSLS_REVIEW
9#define INCLUDED_BSLS_REVIEW
701#include <bsls_assertimputil.h>
709#ifdef BSLS_ASSERT_USE_CONTRACTS
717#if defined(BSLS_REVIEW)
718#error BSLS_REVIEW is already defined!
721#if defined(BSLS_REVIEW_REVIEW_IMP)
722#error BSLS_REVIEW_REVIEW_IMP is already defined!
725#if defined(BSLS_REVIEW_REVIEW_COUNT_IMP)
726#error BSLS_REVIEW_REVIEW_COUNT_IMP is already defined!
729#if defined(BSLS_REVIEW_DISABLED_IMP)
730#error BSLS_REVIEW_DISABLED_IMP is already defined!
733#if defined(BSLS_REVIEW_INVOKE)
734#error BSLS_REVIEW_INVOKE is already defined!
737#if defined(BSLS_REVIEW_IS_ACTIVE)
738#error BSLS_REVIEW_IS_ACTIVE is already defined!
741#if defined(BSLS_REVIEW_IS_USED)
742#error BSLS_REVIEW_IS_USED is already defined!
745#if defined(BSLS_REVIEW_OPT)
746#error BSLS_REVIEW_OPT is already defined!
749#if defined(BSLS_REVIEW_OPT_IS_ACTIVE)
750#error BSLS_REVIEW_OPT_IS_ACTIVE is already defined!
753#if defined(BSLS_REVIEW_OPT_IS_USED)
754#error BSLS_REVIEW_OPT_IS_USED is already defined!
757#if defined(BSLS_REVIEW_SAFE)
758#error BSLS_REVIEW_SAFE is already defined!
761#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
762#error BSLS_REVIEW_SAFE_IS_ACTIVE is already defined!
765#if defined(BSLS_REVIEW_SAFE_IS_USED)
766#error BSLS_REVIEW_SAFE_IS_USED is already defined!
783#if !(defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) || \
784 defined(BSLS_REVIEW_LEVEL_REVIEW) || \
785 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT) || \
786 defined(BSLS_REVIEW_LEVEL_NONE))
792 #if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE)
793 #define BSLS_REVIEW_LEVEL_REVIEW_SAFE
794 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
795 #elif defined(BSLS_ASSERT_LEVEL_ASSERT)
796 #define BSLS_REVIEW_LEVEL_REVIEW
797 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
798 #elif defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
799 #define BSLS_REVIEW_LEVEL_REVIEW_OPT
800 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
801 #elif defined(BSLS_ASSERT_LEVEL_NONE) || \
802 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE) || \
803 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) || \
804 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
805 #define BSLS_REVIEW_LEVEL_NONE
806 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
811 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 1
814 #define BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED 0
826#ifdef BSLS_COMPILERFEATURES_SUPPORT_CONSTEXPR_CPP14
827 #define BSLS_REVIEW_REVIEW_COUNT_IMP \
828 int lastCount = BloombergLP::bsls::Review::updateCount( \
830 static BloombergLP::bsls::Review::Count count = {0}; \
834 #define BSLS_REVIEW_REVIEW_COUNT_IMP \
835 static BloombergLP::bsls::Review::Count count = {0}; \
836 int lastCount = BloombergLP::bsls::Review::updateCount(&count);
843#ifdef BSLS_ASSERT_USE_CONTRACTS
844#define BSLS_REVIEW_REVIEW_IMP(X,LVL) [[ assert check_maybe_continue : X ]]
846#ifdef BSLS_REVIEW_VALIDATE_DISABLED_MACROS
847#define BSLS_REVIEW_DISABLED_IMP(X,LVL) [[ assert ignore : X ]]
849#define BSLS_REVIEW_DISABLED_IMP(X,LVL)
854#define BSLS_REVIEW_REVIEW_IMP(X,LVL) do { \
855 if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!(X))) { \
856 BSLS_PERFORMANCEHINT_UNLIKELY_HINT; \
857 BSLS_REVIEW_REVIEW_COUNT_IMP; \
858 BloombergLP::bsls::ReviewViolation violation( \
860 BSLS_ASSERTIMPUTIL_FILE, \
861 BSLS_ASSERTIMPUTIL_LINE, \
864 BloombergLP::bsls::Review::invokeHandler(violation); \
868#ifdef BSLS_REVIEW_VALIDATE_DISABLED_MACROS
869#define BSLS_REVIEW_DISABLED_IMP(X,LVL) (void)sizeof((X)?true:false)
871#define BSLS_REVIEW_DISABLED_IMP(X,LVL)
881#define BSLS_REVIEW_INVOKE(X) do { \
882 BSLS_REVIEW_REVIEW_COUNT_IMP; \
883 BloombergLP::bsls::ReviewViolation violation( \
885 BSLS_ASSERTIMPUTIL_FILE, \
886 BSLS_ASSERTIMPUTIL_LINE, \
887 BloombergLP::bsls::Review::k_LEVEL_INVOKE, \
889 BloombergLP::bsls::Review::invokeHandler(violation); \
898#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) \
899 || BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED && ( \
900 defined(BDE_BUILD_TARGET_SAFE_2) || \
901 defined(BDE_BUILD_TARGET_SAFE) )
903 #define BSLS_REVIEW_SAFE_IS_ACTIVE
907#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE) || \
908 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
909 #define BSLS_REVIEW_SAFE_IS_USED
914#if defined(BSLS_REVIEW_SAFE_IS_ACTIVE)
915 #define BSLS_REVIEW_SAFE(X) BSLS_REVIEW_REVIEW_IMP( \
917 BloombergLP::bsls::Review::k_LEVEL_SAFE)
919 #define BSLS_REVIEW_SAFE(X) BSLS_REVIEW_DISABLED_IMP( \
921 BloombergLP::bsls::Review::k_LEVEL_SAFE)
930#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) || \
931 defined(BSLS_REVIEW_LEVEL_REVIEW) \
932 || BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED && ( \
933 defined(BDE_BUILD_TARGET_SAFE_2) || \
934 defined(BDE_BUILD_TARGET_SAFE) || \
935 !defined(BDE_BUILD_TARGET_OPT) )
937 #define BSLS_REVIEW_IS_ACTIVE
941#if defined(BSLS_REVIEW_IS_ACTIVE) || \
942 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
943 #define BSLS_REVIEW_IS_USED
948#if defined(BSLS_REVIEW_IS_ACTIVE)
949 #define BSLS_REVIEW(X) BSLS_REVIEW_REVIEW_IMP( \
951 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
953 #define BSLS_REVIEW(X) BSLS_REVIEW_DISABLED_IMP( \
955 BloombergLP::bsls::Review::k_LEVEL_REVIEW)
964#if !defined(BSLS_REVIEW_LEVEL_NONE)
965 #define BSLS_REVIEW_OPT_IS_ACTIVE
969#if defined(BSLS_REVIEW_OPT_IS_ACTIVE) || \
970 defined(BSLS_REVIEW_VALIDATE_DISABLED_MACROS)
971 #define BSLS_REVIEW_OPT_IS_USED
976#if defined(BSLS_REVIEW_OPT_IS_ACTIVE)
977 #define BSLS_REVIEW_OPT(X) BSLS_REVIEW_REVIEW_IMP( \
979 BloombergLP::bsls::Review::k_LEVEL_OPT)
981 #define BSLS_REVIEW_OPT(X) BSLS_REVIEW_DISABLED_IMP( \
983 BloombergLP::bsls::Review::k_LEVEL_OPT)
987#ifndef BSLS_REVIEW_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
988#define BSLS_REVIEW_RECURSIVELY_INCLUDED_TESTDRIVER_GUARD
1004 const char *d_comment_p;
1008 const char *d_fileName_p;
1014 const char *d_reviewLevel_p;
1090 typedef bsls::AtomicOperations::AtomicTypes::Int
Count;
1153#ifdef BSLS_ASSERT_USE_CONTRACTS
1154 static void invokeLanguageContractHandler(
1155 const std::contract_violation& violation);
1238 const char *fileName,
1240 const char *reviewLevel,
1242: d_comment_p((comment == 0) ?
"" : comment)
1243, d_fileName_p((fileName == 0) ?
"" : fileName)
1244, d_lineNumber(lineNumber)
1245, d_reviewLevel_p((reviewLevel == 0) ?
"" : reviewLevel)
1266 return d_fileName_p;
1272 return d_lineNumber;
1278 return d_reviewLevel_p;
1290#undef BSLS_REVIEW_NO_REVIEW_MACROS_DEFINED
1306#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1307 defined(BSLS_REVIEW_LEVEL_REVIEW)
1308#error incompatible BSLS_REVIEW levels: \
1309..._LEVEL_REVIEW_SAFE and ..._LEVEL_REVIEW
1312#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1313 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT)
1314#error incompatible BSLS_REVIEW levels: \
1315..._LEVEL_REVIEW_SAFE and ..._LEVEL_REVIEW_OPT
1318#if defined(BSLS_REVIEW_LEVEL_REVIEW_SAFE) && \
1319 defined(BSLS_REVIEW_LEVEL_NONE)
1320#error incompatible BSLS_REVIEW levels: \
1321..._LEVEL_REVIEW_SAFE and ..._LEVEL_NONE
1324#if defined(BSLS_REVIEW_LEVEL_REVIEW) && \
1325 defined(BSLS_REVIEW_LEVEL_REVIEW_OPT)
1326#error incompatible BSLS_REVIEW levels: \
1327..._LEVEL_REVIEW and ..._LEVEL_REVIEW_OPT
1330#if defined(BSLS_REVIEW_LEVEL_REVIEW) && \
1331 defined(BSLS_REVIEW_LEVEL_NONE)
1332#error incompatible BSLS_REVIEW levels: \
1333..._LEVEL_REVIEW and ..._LEVEL_NONE
1336#if defined(BSLS_REVIEW_LEVEL_REVIEW_OPT) && \
1337 defined(BSLS_REVIEW_LEVEL_NONE)
1338#error incompatible BSLS_REVIEW levels: \
1339..._LEVEL_REVIEW_OPT and ..._LEVEL_NONE
1357#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1358 defined(BSLS_ASSERT_LEVEL_ASSERT)
1359#error incompatible BSLS_ASSERT levels: \
1360..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT
1363#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1364 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
1365#error incompatible BSLS_ASSERT levels: \
1366..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSERT_OPT
1369#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1370 defined(BSLS_ASSERT_LEVEL_NONE)
1371#error incompatible BSLS_ASSERT levels: \
1372..._LEVEL_ASSERT_SAFE and ..._LEVEL_NONE
1375#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1376 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1377#error incompatible BSLS_ASSERT levels: \
1378..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_OPT
1381#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1382 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1383#error incompatible BSLS_ASSERT levels: \
1384..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_ASSERT
1387#if defined(BSLS_ASSERT_LEVEL_ASSERT_SAFE) && \
1388 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1389#error incompatible BSLS_ASSERT levels: \
1390..._LEVEL_ASSERT_SAFE and ..._LEVEL_ASSUME_SAFE
1393#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1394 defined(BSLS_ASSERT_LEVEL_ASSERT_OPT)
1395#error incompatible BSLS_ASSERT levels: \
1396..._LEVEL_ASSERT and ..._LEVEL_ASSERT_OPT
1399#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1400 defined(BSLS_ASSERT_LEVEL_NONE)
1401#error incompatible BSLS_ASSERT levels: \
1402..._LEVEL_ASSERT and ..._LEVEL_NONE
1405#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1406 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1407#error incompatible BSLS_ASSERT levels: \
1408..._LEVEL_ASSERT and ..._LEVEL_ASSUME_OPT
1411#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1412 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1413#error incompatible BSLS_ASSERT levels: \
1414..._LEVEL_ASSERT and ..._LEVEL_ASSUME_ASSERT
1417#if defined(BSLS_ASSERT_LEVEL_ASSERT) && \
1418 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1419#error incompatible BSLS_ASSERT levels: \
1420..._LEVEL_ASSERT and ..._LEVEL_ASSUME_SAFE
1423#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1424 defined(BSLS_ASSERT_LEVEL_NONE)
1425#error incompatible BSLS_ASSERT levels: \
1426..._LEVEL_ASSERT_OPT and ..._LEVEL_NONE
1429#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1430 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1431#error incompatible BSLS_ASSERT levels: \
1432..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_OPT
1435#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1436 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1437#error incompatible BSLS_ASSERT levels: \
1438..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_ASSERT
1441#if defined(BSLS_ASSERT_LEVEL_ASSERT_OPT) && \
1442 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1443#error incompatible BSLS_ASSERT levels: \
1444..._LEVEL_ASSERT_OPT and ..._LEVEL_ASSUME_SAFE
1447#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1448 defined(BSLS_ASSERT_LEVEL_ASSUME_OPT)
1449#error incompatible BSLS_ASSERT levels: \
1450..._LEVEL_NONE and ..._LEVEL_ASSUME_OPT
1453#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1454 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1455#error incompatible BSLS_ASSERT levels: \
1456..._LEVEL_NONE and ..._LEVEL_ASSUME_ASSERT
1459#if defined(BSLS_ASSERT_LEVEL_NONE) && \
1460 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1461#error incompatible BSLS_ASSERT levels: \
1462..._LEVEL_NONE and ..._LEVEL_ASSUME_SAFE
1465#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
1466 defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT)
1467#error incompatible BSLS_ASSERT levels: \
1468..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_ASSERT
1471#if defined(BSLS_ASSERT_LEVEL_ASSUME_OPT) && \
1472 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1473#error incompatible BSLS_ASSERT levels: \
1474..._LEVEL_ASSUME_OPT and ..._LEVEL_ASSUME_SAFE
1477#if defined(BSLS_ASSERT_LEVEL_ASSUME_ASSERT) && \
1478 defined(BSLS_ASSERT_LEVEL_ASSUME_SAFE)
1479#error incompatible BSLS_ASSERT levels: \
1480..._LEVEL_ASSUME_ASSERT and ..._LEVEL_ASSUME_SAFE
Definition bsls_review.h:1203
~ReviewFailureHandlerGuard()
ReviewFailureHandlerGuard(Review::ViolationHandler temporary)
Definition bsls_review.h:1001
BSLS_KEYWORD_CONSTEXPR ReviewViolation(const char *comment, const char *fileName, int lineNumber, const char *reviewLevel, int count)
Definition bsls_review.h:1237
int lineNumber() const
Return the lineNumber attribute of this object.
Definition bsls_review.h:1270
int count() const
Return the count attribute of this object.
Definition bsls_review.h:1258
const char * reviewLevel() const
Return the reviewLevel attribute of this object.
Definition bsls_review.h:1276
const char * fileName() const
Return the fileName attribute of this object.
Definition bsls_review.h:1264
const char * comment() const
Return the comment attribute of this object.
Definition bsls_review.h:1252
Definition bsls_review.h:1081
static Review::ViolationHandler violationHandler()
static const char k_LEVEL_REVIEW[]
Definition bsls_review.h:1118
static void setViolationHandler(Review::ViolationHandler function)
static void failByThrow(const ReviewViolation &violation)
static int updateCount(Count *count)
static const char k_LEVEL_OPT[]
Definition bsls_review.h:1117
static void failByAbort(const ReviewViolation &violation)
bsls::AtomicOperations::AtomicTypes::Int Count
Definition bsls_review.h:1090
static void failByLog(const ReviewViolation &violation)
static const char k_LEVEL_SAFE[]
Definition bsls_review.h:1116
static void invokeHandler(const ReviewViolation &violation)
void(* ViolationHandler)(const ReviewViolation &)
Definition bsls_review.h:1098
static void failBySleep(const ReviewViolation &violation)
static void lockReviewAdministration()
static const char k_LEVEL_INVOKE[]
Definition bsls_review.h:1119
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_CONSTEXPR
Definition bsls_keyword.h:588
Definition bdlt_iso8601util.h:691