|
||||
File indexing completed on 2025-01-18 09:30:25
0001 0002 #ifndef BOOST_CONTRACT_CONFIG_HPP_ 0003 #define BOOST_CONTRACT_CONFIG_HPP_ 0004 0005 // Copyright (C) 2008-2018 Lorenzo Caminiti 0006 // Distributed under the Boost Software License, Version 1.0 (see accompanying 0007 // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt). 0008 // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html 0009 0010 /** @file 0011 Configure this library compile-time and run-time behaviours. 0012 */ 0013 0014 // IMPORTANT: This header MUST NOT #include any other header of this lib. 0015 // That way users can #include this header and not #include any of this lib 0016 // headers after that depending on the contract 0/1 macros below ensuring no 0017 // compilation overhead. 0018 0019 // Export symbols when compiling as shared lib (for internal use only). (Named 0020 // after similar macros in all Boost libs.) 0021 // BOOST_CONTRACT_SOURCE 0022 0023 // Disable automatic library selection for linking. (Named after similar macros 0024 // in all Boost libs.) 0025 // BOOST_CONTRACT_NO_LIB 0026 // BOOST_ALL_NO_LIB 0027 0028 #if (!defined(BOOST_CONTRACT_DYN_LINK) && defined(BOOST_ALL_DYN_LINK)) || \ 0029 defined(BOOST_CONTRACT_DETAIL_DOXYGEN) 0030 /** 0031 Define this macro to compile this library as a shared library (recommended). 0032 0033 If this macro is defined, this library is compiled so it can be linked 0034 as a shared library (a.k.a., Dynamically Linked Library or DLL) to user 0035 code. 0036 This library will automatically define this macro when Boost libraries are 0037 built as shared libraries (e.g., defining @c BOOST_ALL_DYN_LINK or using 0038 <c>bjam link=shared ...</c>). 0039 0040 @warning In general this library will correctly check contracts at 0041 run-time only when compiled as a shared library, unless user 0042 code checks contracts in a single program unit (e.g., a single 0043 program with only statically linked libraries). 0044 Therefore, it is recommended to build and use this library as 0045 a shared library by defining this macro (or equivalently by 0046 building all Boost libraries as shared libraries). 0047 0048 @see @RefSect{getting_started, Getting Started} 0049 */ 0050 #define BOOST_CONTRACT_DYN_LINK 0051 #elif defined(BOOST_CONTRACT_DYN_LINK) && defined(BOOST_CONTRACT_STATIC_LINK) 0052 #error "DYN_LINK defined with STATIC_LINK" 0053 #endif 0054 0055 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0056 /** 0057 Define this macro to compile this library as a static library (not 0058 recommended). 0059 0060 If this macro is defined, this library is compiled so it can be linked 0061 statically to user code. 0062 This library will automatically define this macro when Boost libraries 0063 are built as static libraries. 0064 0065 @warning This library is not guaranteed to always work correctly at 0066 run-time when this macro is defined (define 0067 @RefMacro{BOOST_CONTRACT_DYN_LINK} or @c BOOST_ALL_DYN_LINK 0068 instead). 0069 However, this macro can be defined and this library can be 0070 safely used as a static library for user code that checks 0071 contracts in a single program unit (e.g., a single program with 0072 only statically linked libraries). 0073 0074 @see @RefSect{getting_started, Getting Started} 0075 */ 0076 #define BOOST_CONTRACT_STATIC_LINK 0077 #elif defined(BOOST_CONTRACT_STATIC_LINK) && defined(BOOST_CONTRACT_DYN_LINK) 0078 #error "STATIC_LINK defined with DYN_LINK" 0079 #endif 0080 0081 #ifdef BOOST_CONTRACT_HEADER_ONLY 0082 #error "leave DYN_LINK and STATIC_LINK undefined instead" 0083 #elif (!defined(BOOST_CONTRACT_DYN_LINK) && \ 0084 !defined(BOOST_CONTRACT_STATIC_LINK)) || \ 0085 defined(BOOST_CONTRACT_DETAIL_DOXYGEN) 0086 /** 0087 Automatically defined by this library when it is being used as a header-only 0088 library (not recommended). 0089 0090 This macro is not a configuration macro and this library will generate a 0091 compile-time error if users try to define it directly. 0092 This library will automatically define this macro when users do not define 0093 @RefMacro{BOOST_CONTRACT_DYN_LINK} (or @c BOOST_ALL_DYN_LINK) and 0094 @RefMacro{BOOST_CONTRACT_STATIC_LINK}. 0095 When used as a header-only library, this library code does not have to be 0096 compiled separately from user code, this library headers are simply included 0097 and compiled as part of the user program. 0098 0099 @warning This library is not guaranteed to always work correctly at 0100 run-time when this macro is defined (define 0101 @RefMacro{BOOST_CONTRACT_DYN_LINK} or @c BOOST_ALL_DYN_LINK 0102 instead). 0103 However, this macro can be defined and this library can be 0104 safely used as a header-only library for user code that checks 0105 contracts in a single program unit (e.g., a single program with 0106 only statically linked libraries). 0107 0108 @see @RefSect{getting_started, Getting Started} 0109 */ 0110 #define BOOST_CONTRACT_HEADER_ONLY 0111 #endif 0112 0113 #if (!defined(BOOST_CONTRACT_DISABLE_THREADS) && \ 0114 defined(BOOST_DISABLE_THREADS)) || \ 0115 defined(BOOST_CONTRACT_DETAIL_DOXYGEN) 0116 /** 0117 Define this macro to not lock internal library data for thread safety 0118 (undefined by default). 0119 0120 Defining this macro will make the library implementation code not thread 0121 safe so this macro should not be defined unless the library is being used by 0122 single-threaded applications only. 0123 This library will automatically define this macro when Boost libraries are 0124 built without threads (e.g., defining @c BOOST_DISABLE_THREADS). 0125 0126 @note When this macro is left undefined this library needs to internally 0127 use some sort of global lock (to ensure contract checking is 0128 globally disabled when other contracts are being checked and also to 0129 safely access failure handler functors). 0130 That could introduce an undesired amount of synchronization in some 0131 multi-threaded applications. 0132 0133 @see @RefSect{contract_programming_overview.assertions, Assertions} 0134 */ 0135 #define BOOST_CONTRACT_DISABLE_THREADS 0136 #endif 0137 0138 #ifndef BOOST_CONTRACT_MAX_ARGS 0139 /** 0140 Maximum number of arguments for public function overrides on compilers that 0141 do not support variadic templates (default to @c 10). 0142 0143 On compilers that do not support C++11 variadic templates, this macro is 0144 defined to the maximum number of arguments that public function overrides 0145 can have and pass to @RefFunc{boost::contract::public_function} (users can 0146 redefine this macro to a different value). 0147 On compilers that support variadic templates, this macro has no effect. 0148 0149 @note Regardless of the value of this macro and of compiler support for 0150 variadic templates, there might be an intrinsic limit of about 18 0151 arguments for public function overrides (because of similar limits 0152 in Boost.MPL and Boost.FunctionTypes internally used by this 0153 library). 0154 0155 @see @RefSect{extras.no_macros__and_no_variadic_macros_, No Macros} 0156 */ 0157 #define BOOST_CONTRACT_MAX_ARGS 10 0158 #endif 0159 0160 #ifndef BOOST_CONTRACT_BASES_TYPEDEF 0161 /** 0162 Define the name of the base type @c typedef (@c base_types by default). 0163 0164 This macro expands to the name of the @c typedef that lists the base 0165 classes for subcontracting via @RefMacro{BOOST_CONTRACT_BASE_TYPES}: 0166 0167 @code 0168 class u 0169 #define BASES public b, private w 0170 : BASES 0171 { 0172 friend class boost::contract:access; 0173 0174 typedef BOOST_CONTRACT_BASE_TYPES(BASES) BOOST_CONTRACT_TYPEDEF; 0175 #undef BASES 0176 0177 ... 0178 }; 0179 @endcode 0180 0181 When used this way, users can redefine this macro if the @c typedef must 0182 have a name different from @c base_types (because of name clashes in user 0183 code, etc.). 0184 0185 @see @RefSect{tutorial.base_classes__subcontracting_, Base Classes} 0186 */ 0187 #define BOOST_CONTRACT_BASES_TYPEDEF base_types 0188 #endif 0189 0190 #ifndef BOOST_CONTRACT_INVARIANT_FUNC 0191 /** 0192 Define the name of the class invariant member function (@c invariant by 0193 default). 0194 0195 This macro expands to the name of the @c const and <c>const volatile</c> 0196 member functions that check class invariants and volatile class invariants 0197 respectively: 0198 0199 @code 0200 class u { 0201 friend class boost::contract::access; 0202 0203 void BOOST_CONTRACT_INVARIANT_FUNC() const { 0204 BOOST_CONTRACT_ASSERT(...); 0205 ... 0206 } 0207 0208 void BOOST_CONTRACT_INVARIANT_FUNC() const volatile { 0209 BOOST_CONTRACT_ASSERT(...); 0210 ... 0211 } 0212 0213 ... 0214 }; 0215 @endcode 0216 0217 When used this way, users can redefine this macro if the invariant functions 0218 must have a name different from @c invariant (because of name clashes in 0219 user code, etc.). 0220 0221 @note C++ does not allow to overload member functions based on the 0222 @c static classifier, so this macro must always be defined to be 0223 different than the function name defined for 0224 @RefMacro{BOOST_CONTRACT_STATIC_INVARIANT_FUNC}. 0225 0226 @see @RefSect{tutorial.class_invariants, Class Invariants}, 0227 @RefSect{extras.volatile_public_functions, 0228 Volatile Public Functions} 0229 */ 0230 #define BOOST_CONTRACT_INVARIANT_FUNC invariant 0231 #endif 0232 0233 #ifndef BOOST_CONTRACT_STATIC_INVARIANT_FUNC 0234 /** 0235 Define the name of the static invariant member function (@c static_invariant 0236 by default). 0237 0238 This macro expands to the name of the @c static member function that checks 0239 static class invariants: 0240 0241 @code 0242 class u { 0243 friend class boost::contract::access; 0244 0245 static void BOOST_CONTRACT_STATIC_INVARIANT_FUNC() { 0246 BOOST_CONTRACT_ASSERT(...); 0247 ... 0248 } 0249 0250 ... 0251 }; 0252 @endcode 0253 0254 When used this way, users can redefine this macro if the static invariant 0255 function must have a name different from @c static_invariant (because of 0256 name clashes in user code, etc.). 0257 0258 @note C++ does not allow to overload member functions based on the 0259 @c static classifier, so this macro must always be defined to be 0260 different than the function name defined for 0261 @RefMacro{BOOST_CONTRACT_INVARIANT_FUNC}. 0262 0263 @see @RefSect{tutorial.class_invariants, Class Invariants} 0264 */ 0265 #define BOOST_CONTRACT_STATIC_INVARIANT_FUNC static_invariant 0266 #endif 0267 0268 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0269 /** 0270 Disable some compile-time errors generated by this library (undefined by 0271 default). 0272 0273 Defining this macro disables a number of static checks and related 0274 compile-time errors generated by this library, for example: 0275 0276 @li The static invariant member function named as 0277 @c BOOST_CONTRACT_STATIC_INVARIANT_FUNC must be declared @c static. 0278 @li Non-static invariant member functions named as 0279 @c BOOST_CONTRACT_INVARIANT_FUNC must be declared either @c const, 0280 <c>const volatile</c>, or <c>volatile const</c>. 0281 @li Derived classes that program contracts for one or more public function 0282 overrides via @RefFunc{boost::contract::public_function} must also 0283 define the @RefMacro{BOOST_CONTRACT_BASE_TYPES} @c typedef. 0284 0285 In general, it is not recommended to define this macro because these 0286 compile-time checks can guard against misuses of this library. 0287 0288 @see @RefSect{tutorial.class_invariants, Class Invariants}, 0289 @RefSect{tutorial.base_classes__subcontracting_, Base Classes} 0290 */ 0291 #define BOOST_CONTRACT_PERMISSIVE 0292 #endif 0293 0294 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0295 /** 0296 Code block to execute if contracts are not assigned to a 0297 @RefClass{boost::contract::check} variable (undefined and executes 0298 @c BOOST_ASSERT(false) by default). 0299 0300 In general, there is a logic error in the program when contracts are not 0301 explicitly assigned to a local variable of type 0302 @RefClass{boost::contract::check} and without using C++11 @c auto 0303 declarations (because that is a misuse of this library). 0304 Therefore, by default (i.e., when this macro is not defined) this library 0305 calls <c>BOOST_ASSERT(false)</c> in those cases. 0306 If this macro is defined, this library will execute the code expanded by 0307 this macro instead of calling @c BOOST_ASSERT(false) (if programmers prefer 0308 to throw an exception, etc.). 0309 0310 This macro can also be defined to be any block of code (and use empty curly 0311 brackets @c {} to generate no error, not recommended), for example (on GCC): 0312 @code 0313 gcc -DBOOST_CONTRACT_ON_MISSING_CHECK_DECL='{ throw std::logic_error("missing contract check declaration"); }' ... 0314 @endcode 0315 0316 @see @RefSect{tutorial, Tutorial} 0317 */ 0318 #define BOOST_CONTRACT_ON_MISSING_CHECK_DECL 0319 #endif 0320 0321 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0322 /** 0323 Define this macro to not disable other assertions while checking 0324 preconditions (undefined by default). 0325 0326 Not disabling other assertions while checking preconditions can lead to 0327 infinite recursion in user code so by default this macro is not defined. 0328 0329 However, the @RefSect{bibliography, [N1962]} proposal does not disable 0330 assertions while checking preconditions because arguments can reach the 0331 function body unchecked if assertions are disabled while checking 0332 preconditions (e.g., when these same functions bodies are called to check 0333 the preconditions in question). 0334 This macro can be defined to obtain the behaviour specified in 0335 @RefSect{bibliography, [N1962]} (at the risk of infinite recursion). 0336 0337 @see @RefSect{contract_programming_overview.feature_summary, 0338 Feature Summary} 0339 */ 0340 #define BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION 0341 #endif 0342 0343 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0344 /** 0345 Define this macro to not disable any assertion while checking other 0346 assertions (undefined by default). 0347 0348 Not disabling assertions while checking other assertions can lead to 0349 infinite recursion in user code so by default this macro is not defined. 0350 (Defining this macro automatically implies that other assertion checking is 0351 disabled while checking preconditions as if 0352 @RefMacro{BOOST_CONTRACT_PRECONDITIONS_DISABLE_NO_ASSERTION} was also 0353 defined.) 0354 0355 @see @RefSect{contract_programming_overview.feature_summary, 0356 Feature Summary} 0357 */ 0358 #define BOOST_CONTRACT_ALL_DISABLE_NO_ASSERTION 0359 #endif 0360 0361 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0362 /** 0363 Define this macro to evaluate and check audit assertions at run-time 0364 (undefined by default). 0365 0366 Audit assertions and implementation checks programmed via 0367 @RefMacro{BOOST_CONTRACT_ASSERT_AUDIT} and 0368 @RefMacro{BOOST_CONTRACT_CHECK_AUDIT} are always compiled and validated 0369 syntactically. 0370 However, they are not evaluated and checked at run-time unless 0371 this macro is defined (because these conditions can be computationally 0372 expensive, at least compared to the computational cost of executing the 0373 function body). 0374 0375 @see @RefSect{extras.assertion_levels, Assertion Levels} 0376 */ 0377 #define BOOST_CONTRACT_AUDITS 0378 #endif 0379 0380 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0381 /** 0382 If defined, this library disables implementation checks (undefined by 0383 default). 0384 0385 If this macro is defined, this library internal code is also optimized to 0386 reduce compile-time (not just run-time) overhead associated with 0387 implementation checks. 0388 In addition, users can manually program @c \#ifndef statements in their code 0389 using this macro to completely disable compilation of implementation checks 0390 or use @RefMacro{BOOST_CONTRACT_CHECK} (recommended). 0391 0392 @see @RefSect{advanced.implementation_checks, 0393 Implementation Checks}, 0394 @RefSect{extras.disable_contract_checking, 0395 Disable Contract Checking}, 0396 @RefSect{extras.disable_contract_compilation__macro_interface_, 0397 Disable Contract Compilation} 0398 */ 0399 #define BOOST_CONTRACT_NO_CHECKS 0400 #endif 0401 0402 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0403 /** 0404 If defined, this library does not check preconditions (undefined by 0405 default). 0406 0407 If this macro is defined, this library internal code is also optimized to 0408 reduce compile-time (not just run-time) overhead associated with 0409 checking preconditions. 0410 In addition, users can manually program @c \#ifndef statements in their code 0411 using this macro to completely disable compilation of preconditions or use 0412 the macros defined in @c boost/contract_macro.hpp (recommended only for 0413 applications where it is truly necessary to completely remove contract code 0414 compilation from production code). 0415 0416 @see @RefSect{tutorial.preconditions, Preconditions}, 0417 @RefSect{extras.disable_contract_checking, 0418 Disable Contract Checking}, 0419 @RefSect{extras.disable_contract_compilation__macro_interface_, 0420 Disable Contract Compilation} 0421 */ 0422 #define BOOST_CONTRACT_NO_PRECONDITIONS 0423 #endif 0424 0425 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0426 /** 0427 If defined, this library does not check postconditions (undefined by 0428 default). 0429 0430 If this macro is defined, this library internal code is also optimized to 0431 reduce compile-time (not just run-time) overhead associated with 0432 checking postconditions. 0433 In addition, users can manually program @c \#ifndef statements in their code 0434 using this macro to completely disable compilation of postconditions or use 0435 the macros defined in @c boost/contract_macro.hpp (recommended only for 0436 applications where it is truly necessary to completely remove contract code 0437 compilation from production code). 0438 0439 It is necessary to disable both postconditions and exception guarantees 0440 defining @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS} and 0441 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS} in order to disable old value copies 0442 (see @RefMacro{BOOST_CONTRACT_NO_OLDS}). 0443 0444 @see @RefSect{tutorial.postconditions, Postconditions}, 0445 @RefSect{extras.disable_contract_checking, 0446 Disable Contract Checking}, 0447 @RefSect{extras.disable_contract_compilation__macro_interface_, 0448 Disable Contract Compilation} 0449 */ 0450 #define BOOST_CONTRACT_NO_POSTCONDITIONS 0451 #endif 0452 0453 #ifdef BOOST_CONTRACT_DETAIL_DOXYGEN 0454 /** 0455 If defined, this library does not check exception guarantees (undefined by 0456 default). 0457 0458 If this macro is defined, this library internal code is also optimized to 0459 reduce compile-time (not just run-time) overhead associated with 0460 checking exception guarantees. 0461 In addition, users can manually program @c \#ifndef statements in their code 0462 using this macro to completely disable compilation of exception guarantees 0463 or use the macros defined in @c boost/contract_macro.hpp (recommended only 0464 for applications where it is truly necessary to completely remove contract 0465 code compilation from production code). 0466 0467 It is necessary to disable both postconditions and exception guarantees 0468 defining @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS} and 0469 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS} in order to disable old value copies 0470 (see @RefMacro{BOOST_CONTRACT_NO_OLDS}). 0471 0472 @see @RefSect{tutorial.exception_guarantees, Exception Guarantees}, 0473 @RefSect{extras.disable_contract_checking, 0474 Disable Contract Checking}, 0475 @RefSect{extras.disable_contract_compilation__macro_interface_, 0476 Disable Contract Compilation} 0477 */ 0478 #define BOOST_CONTRACT_NO_EXCEPTS 0479 #endif 0480 0481 #if defined(BOOST_CONTRACT_DETAIL_DOXYGEN) || \ 0482 ( \ 0483 !defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) && \ 0484 defined(BOOST_CONTRACT_NO_INVARIANTS) \ 0485 ) 0486 /** 0487 If defined, this library does not check class invariants at entry (undefined 0488 by default). 0489 0490 If this macro is defined, this library internal code is also optimized to 0491 reduce compile-time (not just run-time) overhead associated with 0492 checking class invariants at entry. 0493 In addition, users can manually program @c \#ifndef statements in their code 0494 using this macro to completely disable compilation of entry class invariants 0495 or use the macros defined in @c boost/contract_macro.hpp (recommended only 0496 for applications where it is truly necessary to completely remove contract 0497 code compilation from production code). 0498 0499 This macro is automatically defined when 0500 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS} is defined. 0501 0502 @see @RefSect{tutorial.class_invariants, Class Invariants}, 0503 @RefSect{extras.disable_contract_checking, 0504 Disable Contract Checking}, 0505 @RefSect{extras.disable_contract_compilation__macro_interface_, 0506 Disable Contract Compilation} 0507 */ 0508 #define BOOST_CONTRACT_NO_ENTRY_INVARIANTS 0509 #endif 0510 0511 #if defined(BOOST_CONTRACT_DETAIL_DOXYGEN) || \ 0512 ( \ 0513 !defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) && \ 0514 defined(BOOST_CONTRACT_NO_INVARIANTS) \ 0515 ) 0516 /** 0517 If defined, this library does not check class invariants at exit (undefined 0518 by default). 0519 0520 If this macro is defined, this library internal code is also optimized to 0521 reduce compile-time (not just run-time) overhead associated with 0522 checking class invariants at exit. 0523 In addition, users can manually program @c \#ifndef statements in their code 0524 using this macro to completely disable compilation of exit class invariants 0525 or use the macros defined in @c boost/contract_macro.hpp (recommended only 0526 for applications where it is truly necessary to completely remove contract 0527 code compilation from production code). 0528 0529 This macro is automatically defined when 0530 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS} is defined. 0531 0532 @see @RefSect{tutorial.class_invariants, Class Invariants}, 0533 @RefSect{extras.disable_contract_checking, 0534 Disable Contract Checking}, 0535 @RefSect{extras.disable_contract_compilation__macro_interface_, 0536 Disable Contract Compilation} 0537 */ 0538 #define BOOST_CONTRACT_NO_EXIT_INVARIANTS 0539 #endif 0540 0541 #if !defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0542 defined(BOOST_CONTRACT_NO_ENTRY_INVARIANTS) && \ 0543 defined(BOOST_CONTRACT_NO_EXIT_INVARIANTS) 0544 /** 0545 If defined, this library does not check class invariants (undefined by 0546 default). 0547 0548 If this macro is defined, this library internal code is also optimized to 0549 reduce compile-time (not just run-time) overhead associated with 0550 checking class invariants. 0551 In addition, users can manually program @c \#ifndef statements in their code 0552 using this macro to completely disable compilation of class invariants or 0553 use the macros defined in @c boost/contract_macro.hpp (recommended only for 0554 applications where it is truly necessary to completely remove contract code 0555 compilation from production code). 0556 0557 Defining this macro is equivalent to defining both 0558 @RefMacro{BOOST_CONTRACT_NO_ENTRY_INVARIANTS} and 0559 @RefMacro{BOOST_CONTRACT_NO_EXIT_INVARIANTS}. 0560 0561 @see @RefSect{tutorial.class_invariants, Class Invariants}, 0562 @RefSect{extras.disable_contract_checking, 0563 Disable Contract Checking}, 0564 @RefSect{extras.disable_contract_compilation__macro_interface_, 0565 Disable Contract Compilation} 0566 */ 0567 #define BOOST_CONTRACT_NO_INVARIANTS 0568 #endif 0569 0570 #ifdef BOOST_CONTRACT_NO_OLDS 0571 #error "define NO_POSTCONDITIONS and NO_EXCEPTS instead" 0572 #elif defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0573 defined(BOOST_CONTRACT_NO_EXCEPTS) 0574 /** 0575 Automatically defined by this library when old value copies are not to be 0576 performed. 0577 0578 This macro is not a configuration macro and this library will generate a 0579 compile-time error if users try to define it directly. 0580 This library will automatically define this macro when users define both 0581 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS} and 0582 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}. 0583 Users can manually program @c \#ifndef statements in their code using this 0584 macro to completely disable compilation of old value copies or use the 0585 macros defined in @c boost/contract_macro.hpp (recommended only for 0586 applications where it is truly necessary to completely remove contract code 0587 compilation from production code). 0588 0589 @see @RefSect{tutorial.old_values, Old Values}, 0590 @RefSect{advanced.old_values_copied_at_body, 0591 Old Values Copied at Body}, 0592 @RefSect{extras.disable_contract_compilation__macro_interface_, 0593 Disable Contract Compilation} 0594 */ 0595 #define BOOST_CONTRACT_NO_OLDS 0596 #endif 0597 0598 // Ctor pre checked separately and outside RAII so not part of this #define. 0599 #ifdef BOOST_CONTRACT_NO_CONSTRUCTORS 0600 #error "define NO_INVARIANTS, NO_POSTCONDITIONS, and NO_EXCEPTS instead" 0601 #elif defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0602 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0603 defined(BOOST_CONTRACT_NO_EXCEPTS) 0604 /** 0605 Automatically defined by this library when contracts are not checked for 0606 constructors. 0607 0608 This macro is not a configuration macro and this library will generate a 0609 compile-time error if users try to define it directly. 0610 This library will automatically define this macro when users define all 0611 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS}, 0612 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, and 0613 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}. 0614 Users can manually program @c \#ifndef statements in their code using this 0615 macro to completely disable compilation of contracts for constructors or use 0616 the macros defined in @c boost/contract_macro.hpp (recommended only for 0617 applications where it is truly necessary to completely remove contract code 0618 compilation from production code). 0619 0620 @note Constructor preconditions are checked separately by 0621 @RefClass{boost::contract::constructor_precondition} so they are 0622 disabled by @RefMacro{BOOST_CONTRACT_NO_PRECONDITIONS} instead. 0623 0624 @see @RefSect{tutorial.constructors, Constructors}, 0625 @RefSect{extras.disable_contract_compilation__macro_interface_, 0626 Disable Contract Compilation} 0627 */ 0628 #define BOOST_CONTRACT_NO_CONSTRUCTORS 0629 #endif 0630 0631 #ifdef BOOST_CONTRACT_NO_DESTRUCTORS 0632 #error "define NO_INVARIANTS, NO_POSTCONDITIONS, and NO_EXCEPTS instead" 0633 #elif defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0634 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0635 defined(BOOST_CONTRACT_NO_EXCEPTS) 0636 /** 0637 Automatically defined by this library when contracts are not checked for 0638 destructors. 0639 0640 This macro is not a configuration macro and this library will generate a 0641 compile-time error if users try to define it directly. 0642 This library will automatically define this macro when users define all 0643 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS}, 0644 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, and 0645 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}. 0646 Users can manually program @c \#ifndef statements in their code using this 0647 macro to completely disable compilation of contracts for destructors or use 0648 the macros defined in @c boost/contract_macro.hpp (recommended only for 0649 applications where it is truly necessary to completely remove contract code 0650 compilation from production code). 0651 0652 @see @RefSect{tutorial.destructors, Destructors}, 0653 @RefSect{extras.disable_contract_compilation__macro_interface_, 0654 Disable Contract Compilation} 0655 */ 0656 #define BOOST_CONTRACT_NO_DESTRUCTORS 0657 #endif 0658 0659 #ifdef BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS 0660 #error "define NO_INVARIANTS, NO_PRECONDITIONS, NO_POSTCONDITIONS, and NO_EXCEPTS instead" 0661 #elif defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0662 defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ 0663 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0664 defined(BOOST_CONTRACT_NO_EXCEPTS) 0665 /** 0666 Automatically defined by this library when contracts are not checked for 0667 public functions. 0668 0669 This macro is not a configuration macro and this library will generate a 0670 compile-time error if users try to define it directly. 0671 This library will automatically define this macro when users define all 0672 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS}, 0673 @RefMacro{BOOST_CONTRACT_NO_PRECONDITIONS}, 0674 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, and 0675 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}. 0676 Users can manually program @c \#ifndef statements in their code using this 0677 macro to completely disable compilation of contracts for public functions or 0678 use the macros defined in @c boost/contract_macro.hpp (recommended only for 0679 applications where it is truly necessary to completely remove contract code 0680 compilation from production code). 0681 0682 @see @RefSect{tutorial.public_functions, Public Functions}, 0683 @RefSect{extras.disable_contract_compilation__macro_interface_, 0684 Disable Contract Compilation} 0685 */ 0686 #define BOOST_CONTRACT_NO_PUBLIC_FUNCTIONS 0687 #endif 0688 0689 #ifdef BOOST_CONTRACT_NO_FUNCTIONS 0690 #error "define NO_PRECONDITIONS, NO_POSTCONDITIONS, and NO_EXCEPTS instead" 0691 #elif defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ 0692 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0693 defined(BOOST_CONTRACT_NO_EXCEPTS) 0694 /** 0695 Automatically defined by this library when contracts are not checked for 0696 non-member, private, or protected functions. 0697 0698 This macro is not a configuration macro and this library will generate a 0699 compile-time error if users try to define it directly. 0700 This library will automatically define this macro when users define all 0701 @RefMacro{BOOST_CONTRACT_NO_PRECONDITIONS}, 0702 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, and 0703 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}. 0704 Users can manually program @c \#ifndef statements in their code using this 0705 macro to completely disable compilation of contracts for non-member, 0706 private and protected functions, or use the macros defined in 0707 @c boost/contract_macro.hpp (recommended only for applications where it is 0708 truly necessary to completely remove contract code compilation from 0709 production code). 0710 0711 This macro is also used when contracts are not checked for private or 0712 protected functions, lambda functions, code blocks, loops, etc. 0713 0714 @see @RefSect{tutorial.non_member_functions, Non-Member Functions}, 0715 @RefSect{advanced.private_and_protected_functions, 0716 Private and Protected Functions}, 0717 @RefSect{advanced.lambdas__loops__code_blocks__and__constexpr__, 0718 Lambdas\, Loops\, Code Blocks}, 0719 @RefSect{extras.disable_contract_compilation__macro_interface_, 0720 Disable Contract Compilation} 0721 */ 0722 #define BOOST_CONTRACT_NO_FUNCTIONS 0723 #endif 0724 0725 #ifdef BOOST_CONTRACT_NO_CONDITIONS 0726 #error "define NO_INVARIANTS, NO_PRECONDITIONS, NO_POSTCONDITIONS, and NO_EXCEPTS instead" 0727 #elif defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0728 defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ 0729 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0730 defined(BOOST_CONTRACT_NO_EXCEPTS) 0731 /** 0732 Automatically defined by this library when contracts are not checked for 0733 preconditions, postconditions, exceptions guarantees, and class invariants 0734 (excluding implementation checks). 0735 0736 This macro is not a configuration macro and this library will generate a 0737 compile-time error if users try to define it directly. 0738 This library will automatically define this macro when users define all 0739 @RefMacro{BOOST_CONTRACT_NO_PRECONDITIONS}, 0740 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, 0741 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}, and 0742 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS}. 0743 Users can manually program @c \#ifndef statements in their code using this 0744 macro to completely disable compilation of contracts within specifications 0745 (so excluding implementation checks which are contracts within 0746 implementations instead), or use the macros defined in 0747 @c boost/contract_macro.hpp (recommended only for applications where it is 0748 truly necessary to completely remove contract code compilation from 0749 production code). 0750 0751 @see @RefSect{extras.disable_contract_compilation__macro_interface_, 0752 Disable Contract Compilation} 0753 */ 0754 #define BOOST_CONTRACT_NO_CONDITIONS 0755 #endif 0756 0757 #ifdef BOOST_CONTRACT_NO_ALL 0758 #error "define NO_INVARIANTS, NO_PRECONDITIONS, NO_POSTCONDITIONS, NO_EXCEPTS, and NO_CHECKS instead" 0759 #elif defined(BOOST_CONTRACT_NO_INVARIANTS) && \ 0760 defined(BOOST_CONTRACT_NO_PRECONDITIONS) && \ 0761 defined(BOOST_CONTRACT_NO_POSTCONDITIONS) && \ 0762 defined(BOOST_CONTRACT_NO_EXCEPTS) && \ 0763 defined(BOOST_CONTRACT_NO_CHECKS) 0764 /** 0765 Automatically defined by this library when contracts are not checked at all 0766 (neither for specifications nor for implementations). 0767 0768 This macro is not a configuration macro and this library will generate a 0769 compile-time error if users try to define it directly. 0770 This library will automatically define this macro when users define all 0771 @RefMacro{BOOST_CONTRACT_NO_INVARIANTS}, 0772 @RefMacro{BOOST_CONTRACT_NO_PRECONDITIONS}, 0773 @RefMacro{BOOST_CONTRACT_NO_POSTCONDITIONS}, 0774 @RefMacro{BOOST_CONTRACT_NO_EXCEPTS}, and 0775 @RefMacro{BOOST_CONTRACT_NO_CHECKS}. 0776 For example, users can manually program @c \#ifndef statements in their code 0777 using this macro to avoid including the @c boost/contract.hpp header all 0778 together: 0779 0780 @code 0781 #include <boost/contract/core/config.hpp> 0782 #ifndef BOOST_CONTRACT_NO_ALL 0783 #include <boost/contract.hpp> 0784 #endif 0785 @endcode 0786 0787 Or, use the @c boost/contract_macro.hpp header and related macros instead 0788 (because the @c boost/contract_macro.hpp header is already optimized to not 0789 include other headers from this library when contracts are not checked, but 0790 recommended only for applications where it is truly necessary to completely 0791 remove contract code compilation from production code). 0792 0793 @see @RefSect{extras.disable_contract_compilation__macro_interface_, 0794 Disable Contract Compilation} 0795 */ 0796 #define BOOST_CONTRACT_NO_ALL 0797 #endif 0798 0799 #endif // #include guard 0800
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |