2 * Copyright 2010-2016 Nest Labs Inc. All Rights Reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 * This file defines macros and interfaces for performing
21 * compile- and run-time assertion checking and run-time
22 * exception handling when #NL_ASSERT_PRODUCTION is false.
26 #ifndef NLCORE_NLASSERT_NONPRODUCTION_H
27 #define NLCORE_NLASSERT_NONPRODUCTION_H
29 #include "nlassert-internal.h"
32 * @ingroup check-style
39 * @def NL_ASSERT_CHECK_NONPRODUCTION_FLAGS_DEFAULT
42 * This defines the default behavioral flags for check-style
43 * exception family assertions when #NL_ASSERT_PRODUCTION is
46 * This may be used to override #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS as follows:
49 * #define NL_ASSERT_CHECK_NONPRODUCTION_FLAGS NL_ASSERT_CHECK_NONPRODUCTION_FLAGS_DEFAULT
51 * #include <nlassert.h>
54 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
56 * @sa #NL_ASSERT_PRODUCTION
58 * @sa #NL_ASSERT_FLAG_BACKTRACE
59 * @sa #NL_ASSERT_FLAG_LOG
60 * @sa #NL_ASSERT_FLAG_TRAP
63 #define NL_ASSERT_CHECK_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG | NL_ASSERT_FLAG_TRAP)
66 * @def NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
69 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
70 * disabled that govern the behavior for check-style exception
71 * family assertions when the assertion expression evaluates to
74 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
76 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS_DEFAULT
78 * @sa #NL_ASSERT_PRODUCTION
80 * @sa #NL_ASSERT_FLAG_BACKTRACE
81 * @sa #NL_ASSERT_FLAG_LOG
82 * @sa #NL_ASSERT_FLAG_TRAP
84 #if NL_ASSERT_USE_FLAGS_DEFAULT
85 #define NL_ASSERT_CHECK_NONPRODUCTION_FLAGS NL_ASSERT_CHECK_NONPRODUCTION_FLAGS_DEFAULT
86 #elif !defined(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS)
87 #define NL_ASSERT_CHECK_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
91 * @def nlCHECK(aCondition)
94 * This checks for the specified condition, which is expected to
95 * commonly be true and takes action, based on configuration, if
96 * the condition is false.
98 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
99 * side-effects, if any, in the asserted expression will still be produced.
101 * @param[in] aCondition A Boolean expression to be evaluated.
103 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
108 #define nlCHECK(aCondition) __nlCHECK(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition)
111 * @def nlCHECK_ACTION(aCondition, anAction)
114 * This checks for the specified condition, which is expected to
115 * commonly be true and takes action, based on configuration, and
116 * executes @p anAction if the condition is false.
118 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
119 * side-effects, if any, in the asserted expression will still be produced.
121 * @param[in] aCondition A Boolean expression to be evaluated.
122 * @param[in] anAction An expression or block to execute when the
123 * assertion fails. This will be executed
124 * after #NL_ASSERT_LOG() and
125 * #NL_ASSERT_BACKTRACE() but before
128 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
130 * @sa #nlVERIFY_ACTION
133 #define nlCHECK_ACTION(aCondition, anAction) __nlCHECK_ACTION(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition, anAction)
136 * @def nlCHECK_PRINT(aCondition, aMessage)
139 * This checks for the specified condition, which is expected to
140 * commonly be true and takes action, based on configuration, and
141 * prints @p aMessage if the condition is false.
143 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
144 * side-effects, if any, in the asserted expression will still be produced.
146 * @param[in] aCondition A Boolean expression to be evaluated.
147 * @param[in] aMessage A pointer to a NULL-terminated C string
148 * containing a caller-specified message
149 * further describing the assertion failure.
151 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
153 * @sa #nlVERIFY_PRINT
156 #define nlCHECK_PRINT(aCondition, aMessage) __nlCHECK_PRINT(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition, aMessage)
159 * @def nlCHECK_SUCCESS(aStatus)
162 * This checks for the specified status, which is expected to
163 * commonly be successful (i.e. zero (0)) and takes action, based
164 * on configuration, if the status is unsuccessful.
166 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
167 * side-effects, if any, in the asserted expression will still be produced.
169 * @param[in] aStatus A scalar status to be evaluated against zero (0).
171 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
173 * @sa #nlVERIFY_SUCCESS
176 #define nlCHECK_SUCCESS(aStatus) __nlCHECK_SUCCESS(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aStatus)
179 * @def nlCHECK_SUCCESS_ACTION(aStatus, anAction)
182 * This checks for the specified status, which is expected to
183 * commonly be successful (i.e. zero (0)) and takes action, based
184 * on configuration, and executes @p anAction if the status is
187 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
188 * side-effects, if any, in the asserted expression will still be produced.
190 * @param[in] aStatus A scalar status to be evaluated against zero (0).
191 * @param[in] anAction An expression or block to execute when the
192 * assertion fails. This will be executed
193 * after #NL_ASSERT_LOG() and
194 * #NL_ASSERT_BACKTRACE() but before
197 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
199 * @sa #nlVERIFY_SUCCESS_ACTION
202 #define nlCHECK_SUCCESS_ACTION(aStatus, anAction) __nlCHECK_SUCCESS_ACTION(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aStatus, anAction)
205 * @def nlCHECK_SUCCESS_PRINT(aStatus, aMessage)
208 * This checks for the specified status, which is expected to
209 * commonly be successful (i.e. zero (0)) and takes action, based
210 * on configuration, and prints @p aMessage if the status is
213 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
214 * side-effects, if any, in the asserted expression will still be produced.
216 * @param[in] aStatus A scalar status to be evaluated against zero (0).
217 * @param[in] aMessage A pointer to a NULL-terminated C string
218 * containing a caller-specified message
219 * further describing the assertion failure.
221 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
223 * @sa #nlVERIFY_SUCCESS_PRINT
226 #define nlCHECK_SUCCESS_PRINT(aStatus, aMessage) __nlCHECK_SUCCESS_PRINT(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aStatus, aMessage)
229 * @def nlNCHECK(aCondition)
232 * This checks for the specified condition, which is expected to
233 * commonly be false and takes action, based on configuration, if
234 * the condition is true.
236 * @note This is the logical inverse of #nlCHECK
238 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
239 * side-effects, if any, in the asserted expression will still be produced.
241 * @param[in] aCondition A Boolean expression to be evaluated.
243 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
249 #define nlNCHECK(aCondition) __nlNCHECK(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition)
252 * @def nlNCHECK_ACTION(aCondition, anAction)
255 * This checks for the specified condition, which is expected to
256 * commonly be false and takes action, based on configuration, and
257 * executes @p anAction if the condition is true.
259 * @note This is the logical inverse of #nlCHECK_ACTION
261 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
262 * side-effects, if any, in the asserted expression will still be produced.
264 * @param[in] aCondition A Boolean expression to be evaluated.
265 * @param[in] anAction An expression or block to execute when the
266 * assertion fails. This will be executed
267 * after #NL_ASSERT_LOG() and
268 * #NL_ASSERT_BACKTRACE() but before
271 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
273 * @sa #nlCHECK_ACTION
274 * @sa #nlNVERIFY_ACTION
277 #define nlNCHECK_ACTION(aCondition, anAction) __nlNCHECK_ACTION(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition, anAction)
280 * @def nlNCHECK_PRINT(aCondition, aMessage)
283 * This checks for the specified condition, which is expected to
284 * commonly be false and takes action, based on configuration, and
285 * prints @p aMessage if the condition is true.
287 * @note This is the logical inverse of #nlCHECK_PRINT
289 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
290 * side-effects, if any, in the asserted expression will still be produced.
292 * @param[in] aCondition A Boolean expression to be evaluated.
293 * @param[in] aMessage A pointer to a NULL-terminated C string
294 * containing a caller-specified message
295 * further describing the assertion failure.
297 * @sa #NL_ASSERT_CHECK_NONPRODUCTION_FLAGS
300 * @sa #nlNVERIFY_PRINT
303 #define nlNCHECK_PRINT(aCondition, aMessage) __nlNCHECK_PRINT(NL_ASSERT_CHECK_NONPRODUCTION_FLAGS, aCondition, aMessage)
311 * @ingroup verify-style
318 * @def NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS_DEFAULT
321 * This defines the default behavioral flags for verify-style
322 * exception family assertions when #NL_ASSERT_PRODUCTION is
325 * This may be used to override #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS as follows:
328 * #define NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS_DEFAULT
330 * #include <nlassert.h>
333 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
335 * @sa #NL_ASSERT_PRODUCTION
337 * @sa #NL_ASSERT_FLAG_BACKTRACE
338 * @sa #NL_ASSERT_FLAG_LOG
339 * @sa #NL_ASSERT_FLAG_TRAP
342 #define NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG | NL_ASSERT_FLAG_TRAP)
345 * @def NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
348 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
349 * disabled that govern the behavior for verify-style exception
350 * family assertions when the assertion expression evaluates to
353 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
355 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS_DEFAULT
357 * @sa #NL_ASSERT_PRODUCTION
359 * @sa #NL_ASSERT_FLAG_BACKTRACE
360 * @sa #NL_ASSERT_FLAG_LOG
361 * @sa #NL_ASSERT_FLAG_TRAP
363 #if NL_ASSERT_USE_FLAGS_DEFAULT
364 #define NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS_DEFAULT
365 #elif !defined(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS)
366 #define NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
370 * @def nlVERIFY(aCondition)
373 * This checks for the specified condition, which is expected to
374 * commonly be true and takes action, based on configuration, if
375 * the condition is false.
377 * @param[in] aCondition A Boolean expression to be evaluated.
379 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
380 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
385 #define nlVERIFY(aCondition) __nlVERIFY(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition)
388 * @def nlVERIFY_ACTION(aCondition, anAction)
391 * This checks for the specified condition, which is expected to
392 * commonly be true and takes action, based on configuration, and
393 * executes @p anAction if the condition is false.
395 * @param[in] aCondition A Boolean expression to be evaluated.
396 * @param[in] anAction An expression or block to execute when the
397 * assertion fails. This will be executed
398 * after #NL_ASSERT_LOG() and
399 * #NL_ASSERT_BACKTRACE() but before
402 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
403 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
405 * @sa #nlCHECK_ACTION
408 #define nlVERIFY_ACTION(aCondition, anAction) __nlVERIFY_ACTION(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition, anAction)
411 * @def nlVERIFY_PRINT(aCondition, aMessage)
414 * This checks for the specified condition, which is expected to
415 * commonly be true and takes action, based on configuration, and
416 * prints @p aMessage if the condition is false.
418 * @param[in] aCondition A Boolean expression to be evaluated.
419 * @param[in] aMessage A pointer to a NULL-terminated C string
420 * containing a caller-specified message
421 * further describing the assertion failure.
423 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
424 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
429 #define nlVERIFY_PRINT(aCondition, aMessage) __nlVERIFY_PRINT(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition, aMessage)
432 * @def nlVERIFY_SUCCESS(aStatus)
435 * This checks for the specified status, which is expected to
436 * commonly be successful (i.e. zero (0)) and takes action, based
437 * on configuration, if the status is unsuccessful.
439 * @param[in] aStatus A scalar status to be evaluated against zero (0).
441 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
442 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
444 * @sa #nlCHECK_SUCCESS
447 #define nlVERIFY_SUCCESS(aStatus) __nlVERIFY_SUCCESS(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aStatus)
450 * @def nlVERIFY_SUCCESS_ACTION(aStatus, anAction)
453 * This checks for the specified status, which is expected to
454 * commonly be successful (i.e. zero (0)) and takes action, based
455 * on configuration, and executes @p anAction if the status is
458 * @param[in] aStatus A scalar status to be evaluated against zero (0).
459 * @param[in] anAction An expression or block to execute when the
460 * assertion fails. This will be executed
461 * after #NL_ASSERT_LOG() and
462 * #NL_ASSERT_BACKTRACE() but before
465 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
466 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
468 * @sa #nlCHECK_SUCCESS_ACTION
471 #define nlVERIFY_SUCCESS_ACTION(aStatus, anAction) __nlVERIFY_SUCCESS_ACTION(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aStatus, anAction)
474 * @def nlVERIFY_SUCCESS_PRINT(aStatus, aMessage)
477 * This checks for the specified status, which is expected to
478 * commonly be successful (i.e. zero (0)) and takes action, based
479 * on configuration, and prints @p aMessage if the status is
482 * @param[in] aStatus A scalar status to be evaluated against zero (0).
483 * @param[in] aMessage A pointer to a NULL-terminated C string
484 * containing a caller-specified message
485 * further describing the assertion failure.
487 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
488 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
490 * @sa #nlCHECK_SUCCESS_PRINT
493 #define nlVERIFY_SUCCESS_PRINT(aStatus, aMessage) __nlVERIFY_SUCCESS_PRINT(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aStatus, aMessage)
496 * @def nlNVERIFY(aCondition)
499 * This checks for the specified condition, which is expected to
500 * commonly be false and takes action, based on configuration, if
501 * the condition is true.
503 * @note This is the logical inverse of #nlVERIFY
505 * @param[in] aCondition A Boolean expression to be evaluated.
507 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
508 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
514 #define nlNVERIFY(aCondition) __nlNVERIFY(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition)
517 * @def nlNVERIFY_ACTION(aCondition, anAction)
520 * This checks for the specified condition, which is expected to
521 * commonly be false and takes action, based on configuration, and
522 * executes @p anAction if the condition is true.
524 * @note This is the logical inverse of #nlVERIFY_ACTION
526 * @param[in] aCondition A Boolean expression to be evaluated.
527 * @param[in] anAction An expression or block to execute when the
528 * assertion fails. This will be executed
529 * after #NL_ASSERT_LOG() and
530 * #NL_ASSERT_BACKTRACE() but before
533 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
534 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
536 * @sa #nlVERIFY_ACTION
537 * @sa #nlNCHECK_ACTION
540 #define nlNVERIFY_ACTION(aCondition, anAction) __nlNVERIFY_ACTION(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition, anAction)
543 * @def nlNVERIFY_PRINT(aCondition, aMessage)
546 * This checks for the specified condition, which is expected to
547 * commonly be false and takes action, based on configuration, and
548 * prints @p aMessage if the condition is true.
550 * @note This is the logical inverse of #nlVERIFY_PRINT
552 * @param[in] aCondition A Boolean expression to be evaluated.
553 * @param[in] aMessage A pointer to a NULL-terminated C string
554 * containing a caller-specified message
555 * further describing the assertion failure.
557 * @sa #NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS
558 * @sa #NL_ASSERT_VERIFY_PRODUCTION_FLAGS
560 * @sa #nlVERIFY_PRINT
561 * @sa #nlNCHECK_PRINT
564 #define nlNVERIFY_PRINT(aCondition, aMessage) __nlNVERIFY_PRINT(NL_ASSERT_VERIFY_NONPRODUCTION_FLAGS, aCondition, aMessage)
572 * @ingroup desire-style
579 * @def NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS_DEFAULT
582 * This defines the default behavioral flags for desire-style
583 * exception family assertions when #NL_ASSERT_PRODUCTION is
586 * This may be used to override #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS as follows:
589 * #define NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS_DEFAULT
591 * #include <nlassert.h>
594 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
596 * @sa #NL_ASSERT_PRODUCTION
598 * @sa #NL_ASSERT_FLAG_BACKTRACE
599 * @sa #NL_ASSERT_FLAG_LOG
600 * @sa #NL_ASSERT_FLAG_TRAP
603 #define NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_LOG)
606 * @def NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
609 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
610 * disabled that govern the behavior for desire-style exception
611 * family assertions when the assertion expression evaluates to
614 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
616 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS_DEFAULT
618 * @sa #NL_ASSERT_PRODUCTION
620 * @sa #NL_ASSERT_FLAG_BACKTRACE
621 * @sa #NL_ASSERT_FLAG_LOG
622 * @sa #NL_ASSERT_FLAG_TRAP
624 #if NL_ASSERT_USE_FLAGS_DEFAULT
625 #define NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS_DEFAULT
626 #elif !defined(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS)
627 #define NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
631 * @def nlDESIRE(aCondition, aLabel)
634 * This checks for the specified condition, which is expected to
635 * commonly be true, and branches to @p aLabel if the condition is
638 * __Anticipated Assertion Firing Frequency:__ Occasional
640 * @param[in] aCondition A Boolean expression to be evaluated.
641 * @param[in] aLabel The local label to which execution branches
642 * when @p aCondition evaluates to false (i.e.
643 * compares equal to zero).
645 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
646 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
652 #define nlDESIRE(aCondition, aLabel) __nlEXPECT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel)
655 * @def nlDESIRE_PRINT(aCondition, aLabel, aMessage)
658 * This checks for the specified condition, which is expected to
659 * commonly be true, and both prints @p aMessage and then branches
660 * to @p aLabel if the condition is false.
662 * __Anticipated Assertion Firing Frequency:__ Occasional
664 * @param[in] aCondition A Boolean expression to be evaluated.
665 * @param[in] aLabel The local label to which execution branches
666 * when @p aCondition evaluates to false (i.e.
667 * compares equal to zero).
668 * @param[in] aMessage A pointer to a NULL-terminated C string
669 * containing a caller-specified message
670 * further describing the assertion failure.
672 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
673 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
675 * @sa #nlEXPECT_PRINT
676 * @sa #nlREQUIRE_PRINT
679 #define nlDESIRE_PRINT(aCondition, aLabel, aMessage) __nlEXPECT_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, aMessage)
682 * @def nlDESIRE_ACTION(aCondition, aLabel, anAction)
685 * This checks for the specified condition, which is expected to
686 * commonly be true, and both executes @p anAction and branches to
687 * @p aLabel if the condition is false.
689 * __Anticipated Assertion Firing Frequency:__ Occasional
691 * @param[in] aCondition A Boolean expression to be evaluated.
692 * @param[in] aLabel The local label to which execution branches
693 * when @p aCondition evaluates to false (i.e.
694 * compares equal to zero).
695 * @param[in] anAction An expression or block to execute when the
696 * assertion fails. This will be executed
697 * after #NL_ASSERT_LOG() and
698 * #NL_ASSERT_BACKTRACE() but before
701 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
702 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
704 * @sa #nlEXPECT_ACTION
705 * @sa #nlREQUIRE_ACTION
708 #define nlDESIRE_ACTION(aCondition, aLabel, anAction) __nlEXPECT_ACTION(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction)
711 * @def nlDESIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage)
714 * This checks for the specified condition, which is expected to
715 * commonly be true, prints @p aMessage, executes @p anAction, and
716 * branches to @p aLabel if the condition is false.
718 * __Anticipated Assertion Firing Frequency:__ Occasional
720 * @param[in] aCondition A Boolean expression to be evaluated.
721 * @param[in] aLabel The local label to which execution branches
722 * when @p aCondition evaluates to false (i.e.
723 * compares equal to zero).
724 * @param[in] anAction An expression or block to execute when the
725 * assertion fails. This will be executed
726 * after #NL_ASSERT_LOG() and
727 * #NL_ASSERT_BACKTRACE() but before
729 * @param[in] aMessage A pointer to a NULL-terminated C string
730 * containing a caller-specified message
731 * further describing the assertion failure.
733 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
734 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
736 * @sa #nlEXPECT_ACTION_PRINT
737 * @sa #nlREQUIRE_ACTION_PRINT
740 #define nlDESIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage) __nlEXPECT_ACTION_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction, aMessage)
743 * @def nlDESIRE_SUCCESS(aStatus, aLabel)
746 * This checks for the specified status, which is expected to
747 * commonly be successful (i.e. zero (0)), and branches to @p
748 * aLabel if the status is unsuccessful.
750 * __Anticipated Assertion Firing Frequency:__ Occasional
752 * @param[in] aStatus A scalar status to be evaluated against zero (0).
753 * @param[in] aLabel The local label to which execution branches
754 * when @p aStatus does not evaluate to zero
757 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
758 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
760 * @sa #nlEXPECT_SUCCESS
761 * @sa #nlREQUIRE_SUCCESS
764 #define nlDESIRE_SUCCESS(aStatus, aLabel) __nlEXPECT_SUCCESS(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aStatus, aLabel)
767 * @def nlDESIRE_SUCCESS_PRINT(aStatus, aLabel, aMessage)
770 * This checks for the specified status, which is expected to
771 * commonly be successful (i.e. zero (0)), and both prints @p
772 * aMessage and then branches to @p aLabel if the status is
775 * __Anticipated Assertion Firing Frequency:__ Occasional
777 * @param[in] aStatus A scalar status to be evaluated against zero (0).
778 * @param[in] aLabel The local label to which execution branches
779 * when @p aStatus does not evaluate to zero
781 * @param[in] aMessage A pointer to a NULL-terminated C string
782 * containing a caller-specified message
783 * further describing the assertion failure.
785 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
786 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
788 * @sa #nlEXPECT_SUCCESS_PRINT
789 * @sa #nlREQUIRE_SUCCESS_PRINT
792 #define nlDESIRE_SUCCESS_PRINT(aStatus, aLabel, aMessage) __nlEXPECT_SUCCESS_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, aMessage)
795 * @def nlDESIRE_SUCCESS_ACTION(aStatus, aLabel, anAction)
798 * This checks for the specified status, which is expected to
799 * commonly be successful (i.e. zero (0)), and both executes @p
800 * anAction and branches to @p aLabel if the status is
803 * __Anticipated Assertion Firing Frequency:__ Occasional
805 * @param[in] aStatus A scalar status to be evaluated against zero (0).
806 * @param[in] aLabel The local label to which execution branches
807 * when @p aStatus does not evaluate to zero
809 * @param[in] anAction An expression or block to execute when the
810 * assertion fails. This will be executed
811 * after #NL_ASSERT_LOG() and
812 * #NL_ASSERT_BACKTRACE() but before
815 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
816 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
818 * @sa #nlEXPECT_SUCCESS_ACTION
819 * @sa #nlREQUIRE_SUCCESS_ACTION
822 #define nlDESIRE_SUCCESS_ACTION(aStatus, aLabel, anAction) __nlEXPECT_SUCCESS_ACTION(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, anAction)
825 * @def nlDESIRE_SUCCESS_ACTION_PRINT(aStatus, aLabel, anAction, aMessage)
828 * This checks for the specified status, which is expected to
829 * commonly be successful (i.e. zero (0)), prints @p aMessage,
830 * executes @p anAction, and branches to @p aLabel if the status is
833 * __Anticipated Assertion Firing Frequency:__ Occasional
835 * @param[in] aStatus A scalar status to be evaluated against zero (0).
836 * @param[in] aLabel The local label to which execution branches
837 * when @p aStatus does not evaluate to zero
839 * @param[in] anAction An expression or block to execute when the
840 * assertion fails. This will be executed
841 * after #NL_ASSERT_LOG() and
842 * #NL_ASSERT_BACKTRACE() but before
844 * @param[in] aMessage A pointer to a NULL-terminated C string
845 * containing a caller-specified message
846 * further describing the assertion failure.
848 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
849 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
851 * @sa #nlEXPECT_SUCCESS_ACTION_PRINT
852 * @sa #nlREQUIRE_SUCCESS_ACTION_PRINT
855 #define nlDESIRE_SUCCESS_ACTION_PRINT(aStatus, aLabel, anAction, aMessage) __nlEXPECT_SUCCESS_ACTION_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, anAction, aMessage)
858 * @def nlNDESIRE(aCondition, aLabel)
861 * This checks for the specified condition, which is expected to
862 * commonly be false, and branches to @p aLabel if the condition is
865 * @note This is the logical inverse of #nlDESIRE.
867 * __Anticipated Assertion Firing Frequency:__ Occasional
869 * @param[in] aCondition A Boolean expression to be evaluated.
870 * @param[in] aLabel The local label to which execution branches
871 * when @p aCondition evaluates to false (i.e.
872 * compares equal to zero).
874 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
875 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
882 #define nlNDESIRE(aCondition, aLabel) __nlNEXPECT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel)
885 * @def nlNDESIRE_PRINT(aCondition, aLabel, aMessage)
888 * This checks for the specified condition, which is expected to
889 * commonly be false, and both prints @p aMessage and then branches
890 * to @p aLabel if the condition is true.
892 * @note This is the logical inverse of #nlDESIRE_PRINT.
894 * __Anticipated Assertion Firing Frequency:__ Occasional
896 * @param[in] aCondition A Boolean expression to be evaluated.
897 * @param[in] aLabel The local label to which execution branches
898 * when @p aCondition evaluates to false (i.e.
899 * compares equal to zero).
900 * @param[in] aMessage A pointer to a NULL-terminated C string
901 * containing a caller-specified message
902 * further describing the assertion failure.
904 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
905 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
907 * @sa #nlDESIRE_PRINT
908 * @sa #nlNEXPECT_PRINT
909 * @sa #nlNREQUIRE_PRINT
912 #define nlNDESIRE_PRINT(aCondition, aLabel, aMessage) __nlNEXPECT_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, aMessage)
915 * @def nlNDESIRE_ACTION(aCondition, aLabel, anAction)
918 * This checks for the specified condition, which is expected to
919 * commonly be false, and both executes @p anAction and branches to
920 * @p aLabel if the condition is true.
922 * @note This is the logical inverse of #nlDESIRE_ACTION.
924 * __Anticipated Assertion Firing Frequency:__ Occasional
926 * @param[in] aCondition A Boolean expression to be evaluated.
927 * @param[in] aLabel The local label to which execution branches
928 * when @p aCondition evaluates to false (i.e.
929 * compares equal to zero).
930 * @param[in] anAction An expression or block to execute when the
931 * assertion fails. This will be executed
932 * after #NL_ASSERT_LOG() and
933 * #NL_ASSERT_BACKTRACE() but before
936 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
937 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
939 * @sa #nlDESIRE_ACTION
940 * @sa #nlNEXPECT_ACTION
941 * @sa #nlNREQUIRE_ACTION
944 #define nlNDESIRE_ACTION(aCondition, aLabel, anAction) __nlNEXPECT_ACTION(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction)
947 * @def nlNDESIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage)
950 * This checks for the specified condition, which is expected to
951 * commonly be false, prints @p aMessage, executes @p anAction, and
952 * branches to @p aLabel if the condition is true.
954 * @note This is the logical inverse of #nlDESIRE_ACTION_PRINT.
956 * __Anticipated Assertion Firing Frequency:__ Occasional
958 * @param[in] aCondition A Boolean expression to be evaluated.
959 * @param[in] aLabel The local label to which execution branches
960 * when @p aCondition evaluates to false (i.e.
961 * compares equal to zero).
962 * @param[in] anAction An expression or block to execute when the
963 * assertion fails. This will be executed
964 * after #NL_ASSERT_LOG() and
965 * #NL_ASSERT_BACKTRACE() but before
967 * @param[in] aMessage A pointer to a NULL-terminated C string
968 * containing a caller-specified message
969 * further describing the assertion failure.
971 * @sa #NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS
972 * @sa #NL_ASSERT_DESIRE_PRODUCTION_FLAGS
974 * @sa #nlDESIRE_ACTION_PRINT
975 * @sa #nlNEXPECT_ACTION_PRINT
976 * @sa #nlNREQUIRE_ACTION_PRINT
979 #define nlNDESIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage) __nlNEXPECT_ACTION_PRINT(NL_ASSERT_DESIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction, aMessage)
987 * @ingroup require-style
994 * @def NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS_DEFAULT
997 * This defines the default behavioral flags for require-style
998 * exception family assertions when #NL_ASSERT_PRODUCTION is
1001 * This may be used to override #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS as follows:
1004 * #define NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS_DEFAULT
1006 * #include <nlassert.h>
1009 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1011 * @sa #NL_ASSERT_PRODUCTION
1013 * @sa #NL_ASSERT_FLAG_BACKTRACE
1014 * @sa #NL_ASSERT_FLAG_LOG
1015 * @sa #NL_ASSERT_FLAG_TRAP
1018 #define NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG | NL_ASSERT_FLAG_TRAP)
1021 * @def NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1024 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
1025 * disabled that govern the behavior for require-style exception
1026 * family assertions when the assertion expression evaluates to
1029 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
1031 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS_DEFAULT
1033 * @sa #NL_ASSERT_PRODUCTION
1035 * @sa #NL_ASSERT_FLAG_BACKTRACE
1036 * @sa #NL_ASSERT_FLAG_LOG
1037 * @sa #NL_ASSERT_FLAG_TRAP
1039 #if NL_ASSERT_USE_FLAGS_DEFAULT
1040 #define NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS_DEFAULT
1041 #elif !defined(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS)
1042 #define NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
1046 * @def nlREQUIRE(aCondition, aLabel)
1049 * This checks for the specified condition, which is expected to
1050 * commonly be true, and branches to @p aLabel if the condition is
1053 * __Anticipated Assertion Firing Frequency:__ Rare
1055 * @param[in] aCondition A Boolean expression to be evaluated.
1056 * @param[in] aLabel The local label to which execution branches
1057 * when @p aCondition evaluates to false (i.e.
1058 * compares equal to zero).
1060 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1061 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1067 #define nlREQUIRE(aCondition, aLabel) __nlEXPECT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel)
1070 * @def nlREQUIRE_PRINT(aCondition, aLabel, aMessage)
1073 * This checks for the specified condition, which is expected to
1074 * commonly be true, and both prints @p aMessage and then branches
1075 * to @p aLabel if the condition is false.
1077 * __Anticipated Assertion Firing Frequency:__ Rare
1079 * @param[in] aCondition A Boolean expression to be evaluated.
1080 * @param[in] aLabel The local label to which execution branches
1081 * when @p aCondition evaluates to false (i.e.
1082 * compares equal to zero).
1083 * @param[in] aMessage A pointer to a NULL-terminated C string
1084 * containing a caller-specified message
1085 * further describing the assertion failure.
1087 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1088 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1090 * @sa #nlEXPECT_PRINT
1091 * @sa #nlDESIRE_PRINT
1094 #define nlREQUIRE_PRINT(aCondition, aLabel, aMessage) __nlEXPECT_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, aMessage)
1097 * @def nlREQUIRE_ACTION(aCondition, aLabel, anAction)
1100 * This checks for the specified condition, which is expected to
1101 * commonly be true, and both executes @p anAction and branches to
1102 * @p aLabel if the condition is false.
1104 * __Anticipated Assertion Firing Frequency:__ Rare
1106 * @param[in] aCondition A Boolean expression to be evaluated.
1107 * @param[in] aLabel The local label to which execution branches
1108 * when @p aCondition evaluates to false (i.e.
1109 * compares equal to zero).
1110 * @param[in] anAction An expression or block to execute when the
1111 * assertion fails. This will be executed
1112 * after #NL_ASSERT_LOG() and
1113 * #NL_ASSERT_BACKTRACE() but before
1114 * #NL_ASSERT_TRAP().
1116 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1117 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1119 * @sa #nlEXPECT_ACTION
1120 * @sa #nlDESIRE_ACTION
1123 #define nlREQUIRE_ACTION(aCondition, aLabel, anAction) __nlEXPECT_ACTION(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction)
1126 * @def nlREQUIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage)
1129 * This checks for the specified condition, which is expected to
1130 * commonly be true, prints @p aMessage, executes @p anAction, and
1131 * branches to @p aLabel if the condition is false.
1133 * __Anticipated Assertion Firing Frequency:__ Rare
1135 * @param[in] aCondition A Boolean expression to be evaluated.
1136 * @param[in] aLabel The local label to which execution branches
1137 * when @p aCondition evaluates to false (i.e.
1138 * compares equal to zero).
1139 * @param[in] anAction An expression or block to execute when the
1140 * assertion fails. This will be executed
1141 * after #NL_ASSERT_LOG() and
1142 * #NL_ASSERT_BACKTRACE() but before
1143 * #NL_ASSERT_TRAP().
1144 * @param[in] aMessage A pointer to a NULL-terminated C string
1145 * containing a caller-specified message
1146 * further describing the assertion failure.
1148 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1149 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1151 * @sa #nlEXPECT_ACTION_PRINT
1152 * @sa #nlDESIRE_ACTION_PRINT
1155 #define nlREQUIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage) __nlEXPECT_ACTION_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction, aMessage)
1158 * @def nlREQUIRE_SUCCESS(aStatus, aLabel)
1161 * This checks for the specified status, which is expected to
1162 * commonly be successful (i.e. zero (0)), and branches to @p
1163 * aLabel if the status is unsuccessful.
1165 * __Anticipated Assertion Firing Frequency:__ Rare
1167 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1168 * @param[in] aLabel The local label to which execution branches
1169 * when @p aStatus does not evaluate to zero
1172 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1173 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1175 * @sa #nlEXPECT_SUCCESS
1176 * @sa #nlDESIRE_SUCCESS
1179 #define nlREQUIRE_SUCCESS(aStatus, aLabel) __nlEXPECT_SUCCESS(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aStatus, aLabel)
1182 * @def nlREQUIRE_SUCCESS_PRINT(aStatus, aLabel, aMessage)
1185 * This checks for the specified status, which is expected to
1186 * commonly be successful (i.e. zero (0)), and both prints @p
1187 * aMessage and then branches to @p aLabel if the status is
1190 * __Anticipated Assertion Firing Frequency:__ Rare
1192 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1193 * @param[in] aLabel The local label to which execution branches
1194 * when @p aStatus does not evaluate to zero
1196 * @param[in] aMessage A pointer to a NULL-terminated C string
1197 * containing a caller-specified message
1198 * further describing the assertion failure.
1200 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1201 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1203 * @sa #nlEXPECT_SUCCESS_PRINT
1204 * @sa #nlDESIRE_SUCCESS_PRINT
1207 #define nlREQUIRE_SUCCESS_PRINT(aStatus, aLabel, aMessage) __nlEXPECT_SUCCESS_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, aMessage)
1210 * @def nlREQUIRE_SUCCESS_ACTION(aStatus, aLabel, anAction)
1213 * This checks for the specified status, which is expected to
1214 * commonly be successful (i.e. zero (0)), and both executes @p
1215 * anAction and branches to @p aLabel if the status is
1218 * __Anticipated Assertion Firing Frequency:__ Rare
1220 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1221 * @param[in] aLabel The local label to which execution branches
1222 * when @p aStatus does not evaluate to zero
1224 * @param[in] anAction An expression or block to execute when the
1225 * assertion fails. This will be executed
1226 * after #NL_ASSERT_LOG() and
1227 * #NL_ASSERT_BACKTRACE() but before
1228 * #NL_ASSERT_TRAP().
1230 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1231 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1233 * @sa #nlEXPECT_SUCCESS_ACTION
1234 * @sa #nlDESIRE_SUCCESS_ACTION
1237 #define nlREQUIRE_SUCCESS_ACTION(aStatus, aLabel, anAction) __nlEXPECT_SUCCESS_ACTION(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, anAction)
1240 * @def nlREQUIRE_SUCCESS_ACTION_PRINT(aStatus, aLabel, anAction, aMessage)
1243 * This checks for the specified status, which is expected to
1244 * commonly be successful (i.e. zero (0)), prints @p aMessage,
1245 * executes @p anAction, and branches to @p aLabel if the status is
1248 * __Anticipated Assertion Firing Frequency:__ Rare
1250 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1251 * @param[in] aLabel The local label to which execution branches
1252 * when @p aStatus does not evaluate to zero
1254 * @param[in] anAction An expression or block to execute when the
1255 * assertion fails. This will be executed
1256 * after #NL_ASSERT_LOG() and
1257 * #NL_ASSERT_BACKTRACE() but before
1258 * #NL_ASSERT_TRAP().
1259 * @param[in] aMessage A pointer to a NULL-terminated C string
1260 * containing a caller-specified message
1261 * further describing the assertion failure.
1263 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1264 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1266 * @sa #nlEXPECT_SUCCESS_ACTION_PRINT
1267 * @sa #nlDESIRE_SUCCESS_ACTION_PRINT
1270 #define nlREQUIRE_SUCCESS_ACTION_PRINT(aStatus, aLabel, anAction, aMessage) __nlEXPECT_SUCCESS_ACTION_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aStatus, aLabel, anAction, aMessage)
1273 * @def nlNREQUIRE(aCondition, aLabel)
1276 * This checks for the specified condition, which is expected to
1277 * commonly be false, and branches to @p aLabel if the condition is
1280 * @note This is the logical inverse of #nlREQUIRE.
1282 * __Anticipated Assertion Firing Frequency:__ Rare
1284 * @param[in] aCondition A Boolean expression to be evaluated.
1285 * @param[in] aLabel The local label to which execution branches
1286 * when @p aCondition evaluates to false (i.e.
1287 * compares equal to zero).
1289 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1290 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1297 #define nlNREQUIRE(aCondition, aLabel) __nlNEXPECT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel)
1300 * @def nlNREQUIRE_PRINT(aCondition, aLabel, aMessage)
1303 * This checks for the specified condition, which is expected to
1304 * commonly be false, and both prints @p aMessage and then branches
1305 * to @p aLabel if the condition is true.
1307 * @note This is the logical inverse of #nlREQUIRE_PRINT.
1309 * __Anticipated Assertion Firing Frequency:__ Rare
1311 * @param[in] aCondition A Boolean expression to be evaluated.
1312 * @param[in] aLabel The local label to which execution branches
1313 * when @p aCondition evaluates to false (i.e.
1314 * compares equal to zero).
1315 * @param[in] aMessage A pointer to a NULL-terminated C string
1316 * containing a caller-specified message
1317 * further describing the assertion failure.
1319 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1320 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1322 * @sa #nlREQUIRE_PRINT
1323 * @sa #nlNEXPECT_PRINT
1324 * @sa #nlNDESIRE_PRINT
1327 #define nlNREQUIRE_PRINT(aCondition, aLabel, aMessage) __nlNEXPECT_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, aMessage)
1330 * @def nlNREQUIRE_ACTION(aCondition, aLabel, anAction)
1333 * This checks for the specified condition, which is expected to
1334 * commonly be false, and both executes @p anAction and branches to
1335 * @p aLabel if the condition is true.
1337 * @note This is the logical inverse of #nlREQUIRE_ACTION.
1339 * __Anticipated Assertion Firing Frequency:__ Rare
1341 * @param[in] aCondition A Boolean expression to be evaluated.
1342 * @param[in] aLabel The local label to which execution branches
1343 * when @p aCondition evaluates to false (i.e.
1344 * compares equal to zero).
1345 * @param[in] anAction An expression or block to execute when the
1346 * assertion fails. This will be executed
1347 * after #NL_ASSERT_LOG() and
1348 * #NL_ASSERT_BACKTRACE() but before
1349 * #NL_ASSERT_TRAP().
1351 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1352 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1354 * @sa #nlREQUIRE_ACTION
1355 * @sa #nlNEXPECT_ACTION
1356 * @sa #nlNDESIRE_ACTION
1359 #define nlNREQUIRE_ACTION(aCondition, aLabel, anAction) __nlNEXPECT_ACTION(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction)
1362 * @def nlNREQUIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage)
1365 * This checks for the specified condition, which is expected to
1366 * commonly be false, prints @p aMessage, executes @p anAction, and
1367 * branches to @p aLabel if the condition is true.
1369 * @note This is the logical inverse of #nlREQUIRE_ACTION_PRINT.
1371 * __Anticipated Assertion Firing Frequency:__ Rare
1373 * @param[in] aCondition A Boolean expression to be evaluated.
1374 * @param[in] aLabel The local label to which execution branches
1375 * when @p aCondition evaluates to false (i.e.
1376 * compares equal to zero).
1377 * @param[in] anAction An expression or block to execute when the
1378 * assertion fails. This will be executed
1379 * after #NL_ASSERT_LOG() and
1380 * #NL_ASSERT_BACKTRACE() but before
1381 * #NL_ASSERT_TRAP().
1382 * @param[in] aMessage A pointer to a NULL-terminated C string
1383 * containing a caller-specified message
1384 * further describing the assertion failure.
1386 * @sa #NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS
1387 * @sa #NL_ASSERT_REQUIRE_PRODUCTION_FLAGS
1389 * @sa #nlREQUIRE_ACTION_PRINT
1390 * @sa #nlNEXPECT_ACTION_PRINT
1391 * @sa #nlNDESIRE_ACTION_PRINT
1394 #define nlNREQUIRE_ACTION_PRINT(aCondition, aLabel, anAction, aMessage) __nlNEXPECT_ACTION_PRINT(NL_ASSERT_REQUIRE_NONPRODUCTION_FLAGS, aCondition, aLabel, anAction, aMessage)
1402 * @ingroup precondition-style
1409 * @def NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS_DEFAULT
1412 * This defines the default behavioral flags for precondition-style
1413 * exception family assertions when #NL_ASSERT_PRODUCTION is
1416 * This may be used to override #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS as follows:
1419 * #define NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS_DEFAULT
1421 * #include <nlassert.h>
1424 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1426 * @sa #NL_ASSERT_PRODUCTION
1428 * @sa #NL_ASSERT_FLAG_BACKTRACE
1429 * @sa #NL_ASSERT_FLAG_LOG
1430 * @sa #NL_ASSERT_FLAG_TRAP
1433 #define NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG | NL_ASSERT_FLAG_TRAP)
1436 * @def NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1439 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
1440 * disabled that govern the behavior for precondition-style exception
1441 * family assertions when the assertion expression evaluates to
1444 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
1446 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS_DEFAULT
1448 * @sa #NL_ASSERT_PRODUCTION
1450 * @sa #NL_ASSERT_FLAG_BACKTRACE
1451 * @sa #NL_ASSERT_FLAG_LOG
1452 * @sa #NL_ASSERT_FLAG_TRAP
1454 #if NL_ASSERT_USE_FLAGS_DEFAULT
1455 #define NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS_DEFAULT
1456 #elif !defined(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS)
1457 #define NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
1461 * @def nlPRECONDITION(aCondition)
1464 * This checks for the specified condition, which is expected to
1465 * commonly be true, and returns from the enclosing function if the
1466 * condition is false.
1468 * @param[in] aCondition A Boolean expression to be evaluated.
1470 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1471 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1478 #define nlPRECONDITION(aCondition) __nlPRECONDITION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return)
1481 * @def nlPRECONDITION_ACTION(aCondition, anAction)
1484 * This checks for the specified condition, which is expected to
1485 * commonly be true, and both executes @p anAction and returns from
1486 * the enclosing function if the condition is false.
1488 * @param[in] aCondition A Boolean expression to be evaluated.
1489 * @param[in] anAction An expression or block to execute when the
1490 * assertion fails. This will be executed
1491 * after #NL_ASSERT_LOG() and
1492 * #NL_ASSERT_BACKTRACE() but before
1493 * #NL_ASSERT_TRAP().
1495 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1496 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1498 * @sa #nlEXPECT_ACTION
1499 * @sa #nlDESIRE_ACTION
1500 * @sa #nlREQUIRE_ACTION
1503 #define nlPRECONDITION_ACTION(aCondition, anAction) __nlPRECONDITION_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return, anAction)
1506 * @def nlPRECONDITION_PRINT(aCondition, aMessage)
1509 * This checks for the specified condition, which is expected to
1510 * commonly be true, and both prints @p aMessage and then returns
1511 * from the enclosing function if the condition is false.
1513 * @param[in] aCondition A Boolean expression to be evaluated.
1514 * @param[in] aMessage A pointer to a NULL-terminated C string
1515 * containing a caller-specified message
1516 * further describing the assertion failure.
1518 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1519 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1521 * @sa #nlEXPECT_PRINT
1522 * @sa #nlDESIRE_PRINT
1523 * @sa #nlREQUIRE_PRINT
1526 #define nlPRECONDITION_PRINT(aCondition, aMessage) __nlPRECONDITION_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return, aMessage)
1529 * @def nlPRECONDITION_SUCCESS(aStatus)
1532 * This checks for the specified status, which is expected to
1533 * commonly be successful (i.e. zero (0)), and returns from the
1534 * enclosing function if the status is unsuccessful.
1536 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1538 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1539 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1541 * @sa #nlEXPECT_SUCCESS
1542 * @sa #nlDESIRE_SUCCESS
1543 * @sa #nlREQUIRE_SUCCESS
1546 #define nlPRECONDITION_SUCCESS(aStatus) __nlPRECONDITION_SUCCESS(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return)
1549 * @def nlPRECONDITION_SUCCESS_ACTION(aStatus, anAction)
1552 * This checks for the specified status, which is expected to
1553 * commonly be successful (i.e. zero (0)), and both executes @p
1554 * anAction and returns from the enclosing function if the status
1557 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1558 * @param[in] anAction An expression or block to execute when the
1559 * assertion fails. This will be executed
1560 * after #NL_ASSERT_LOG() and
1561 * #NL_ASSERT_BACKTRACE() but before
1562 * #NL_ASSERT_TRAP().
1564 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1565 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1567 * @sa #nlEXPECT_SUCCESS_ACTION
1568 * @sa #nlDESIRE_SUCCESS_ACTION
1569 * @sa #nlREQUIRE_SUCCESS_ACTION
1572 #define nlPRECONDITION_SUCCESS_ACTION(aStatus, anAction) __nlPRECONDITION_SUCCESS_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return, anAction)
1575 * @def nlPRECONDITION_SUCCESS_PRINT(aStatus, aMessage)
1578 * This checks for the specified status, which is expected to
1579 * commonly be successful (i.e. zero (0)), and both prints @p
1580 * aMessage and then returns from the enclosing function if the
1581 * status is unsuccessful.
1583 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1584 * @param[in] aMessage A pointer to a NULL-terminated C string
1585 * containing a caller-specified message
1586 * further describing the assertion failure.
1588 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1589 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1591 * @sa #nlEXPECT_SUCCESS_PRINT
1592 * @sa #nlDESIRE_SUCCESS_PRINT
1593 * @sa #nlREQUIRE_SUCCESS_PRINT
1596 #define nlPRECONDITION_SUCCESS_PRINT(aStatus, aMessage) __nlPRECONDITION_SUCCESS_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return, aMessage)
1599 * @def nlNPRECONDITION(aCondition)
1602 * This checks for the specified condition, which is expected to
1603 * commonly be false, and returns from the enclosing function if
1604 * the condition is true.
1606 * @note This is the logical inverse of #nlPRECONDITION.
1608 * @param[in] aCondition A Boolean expression to be evaluated.
1610 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1611 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1613 * @sa #nlPRECONDITION
1620 #define nlNPRECONDITION(aCondition) __nlNPRECONDITION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return)
1623 * @def nlNPRECONDITION_ACTION(aCondition, anAction)
1626 * This checks for the specified condition, which is expected to
1627 * commonly be false, and both executes @p anAction and returns from
1628 * the enclosing function if the condition is true.
1630 * @note This is the logical inverse of #nlPRECONDITION_ACTION.
1632 * @param[in] aCondition A Boolean expression to be evaluated.
1633 * @param[in] anAction An expression or block to execute when the
1634 * assertion fails. This will be executed
1635 * after #NL_ASSERT_LOG() and
1636 * #NL_ASSERT_BACKTRACE() but before
1637 * #NL_ASSERT_TRAP().
1639 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1640 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1642 * @sa #nlPRECONDITION_ACTION
1644 * @sa #nlNEXPECT_ACTION
1645 * @sa #nlNDESIRE_ACTION
1646 * @sa #nlNREQUIRE_ACTION
1649 #define nlNPRECONDITION_ACTION(aCondition, anAction) __nlNPRECONDITION_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return, anAction)
1652 * @def nlNPRECONDITION_PRINT(aCondition, aMessage)
1655 * This checks for the specified condition, which is expected to
1656 * commonly be false, and both prints @p aMessage and then returns
1657 * from the enclosing function if the condition is true.
1659 * @note This is the logical inverse of #nlPRECONDITION_PRINT.
1661 * @param[in] aCondition A Boolean expression to be evaluated.
1662 * @param[in] aMessage A pointer to a NULL-terminated C string
1663 * containing a caller-specified message
1664 * further describing the assertion failure.
1666 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1667 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1669 * @sa #nlPRECONDITION_PRINT
1671 * @sa #nlNEXPECT_PRINT
1672 * @sa #nlNDESIRE_PRINT
1673 * @sa #nlNREQUIRE_PRINT
1676 #define nlNPRECONDITION_PRINT(aCondition, aMessage) __nlNPRECONDITION_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return, aMessage)
1679 * @def nlPRECONDITION_VALUE(aCondition, aValue)
1682 * This checks for the specified condition, which is expected to
1683 * commonly be true, and returns @p aValue from the enclosing
1684 * function if the condition is false.
1686 * @param[in] aCondition A Boolean expression to be evaluated.
1687 * @param[in] aValue The value to be returned when the assertion
1690 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1691 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1698 #define nlPRECONDITION_VALUE(aCondition, aValue) __nlPRECONDITION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue)
1701 * @def nlPRECONDITION_VALUE_ACTION(aCondition, aValue, anAction)
1704 * This checks for the specified condition, which is expected to
1705 * commonly be true, and both executes @p anAction and returns @p
1706 * aValue from the enclosing function if the condition is false.
1708 * @param[in] aCondition A Boolean expression to be evaluated.
1709 * @param[in] aValue The value to be returned when the assertion
1711 * @param[in] anAction An expression or block to execute when the
1712 * assertion fails. This will be executed
1713 * after #NL_ASSERT_LOG() and
1714 * #NL_ASSERT_BACKTRACE() but before
1715 * #NL_ASSERT_TRAP().
1717 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1718 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1720 * @sa #nlEXPECT_ACTION
1721 * @sa #nlDESIRE_ACTION
1722 * @sa #nlREQUIRE_ACTION
1725 #define nlPRECONDITION_VALUE_ACTION(aCondition, aValue, anAction) __nlPRECONDITION_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue, anAction)
1728 * @def nlPRECONDITION_VALUE_PRINT(aCondition, aValue, aMessage)
1731 * This checks for the specified condition, which is expected to
1732 * commonly be true, and both prints @p aMessage and then returns
1733 * @p aValue from the enclosing function if the condition is false.
1735 * @param[in] aCondition A Boolean expression to be evaluated.
1736 * @param[in] aValue The value to be returned when the assertion
1738 * @param[in] aMessage A pointer to a NULL-terminated C string
1739 * containing a caller-specified message
1740 * further describing the assertion failure.
1742 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1743 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1745 * @sa #nlEXPECT_PRINT
1746 * @sa #nlDESIRE_PRINT
1747 * @sa #nlREQUIRE_PRINT
1750 #define nlPRECONDITION_VALUE_PRINT(aCondition, aValue, aMessage) __nlPRECONDITION_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue, aMessage)
1753 * @def nlPRECONDITION_VALUE_SUCCESS(aStatus, aValue)
1756 * This checks for the specified status, which is expected to
1757 * commonly be successful (i.e. zero (0)), and returns @p aValue
1758 * from the enclosing function if the status is unsuccessful.
1760 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1761 * @param[in] aValue The value to be returned when the assertion
1764 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1765 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1767 * @sa #nlEXPECT_SUCCESS
1768 * @sa #nlDESIRE_SUCCESS
1769 * @sa #nlREQUIRE_SUCCESS
1772 #define nlPRECONDITION_VALUE_SUCCESS(aStatus, aValue) __nlPRECONDITION_SUCCESS(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return aValue)
1775 * @def nlPRECONDITION_VALUE_SUCCESS_ACTION(aStatus, aValue, anAction)
1778 * This checks for the specified status, which is expected to
1779 * commonly be successful (i.e. zero (0)), and both executes @p
1780 * anAction and returns @p aValue from the enclosing function if
1781 * the status is unsuccessful.
1783 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1784 * @param[in] aValue The value to be returned when the assertion
1786 * @param[in] anAction An expression or block to execute when the
1787 * assertion fails. This will be executed
1788 * after #NL_ASSERT_LOG() and
1789 * #NL_ASSERT_BACKTRACE() but before
1790 * #NL_ASSERT_TRAP().
1792 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1793 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1795 * @sa #nlEXPECT_SUCCESS_ACTION
1796 * @sa #nlDESIRE_SUCCESS_ACTION
1797 * @sa #nlREQUIRE_SUCCESS_ACTION
1800 #define nlPRECONDITION_VALUE_SUCCESS_ACTION(aStatus, aValue, anAction) __nlPRECONDITION_SUCCESS_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return aValue, anAction)
1803 * @def nlPRECONDITION_VALUE_SUCCESS_PRINT(aStatus, aValue, aMessage)
1806 * This checks for the specified status, which is expected to
1807 * commonly be successful (i.e. zero (0)), and both prints @p
1808 * aMessage and then returns @p aValue from the enclosing function
1809 * if the status is unsuccessful.
1811 * @param[in] aStatus A scalar status to be evaluated against zero (0).
1812 * @param[in] aValue The value to be returned when the assertion
1814 * @param[in] aMessage A pointer to a NULL-terminated C string
1815 * containing a caller-specified message
1816 * further describing the assertion failure.
1818 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1819 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1821 * @sa #nlEXPECT_SUCCESS_PRINT
1822 * @sa #nlDESIRE_SUCCESS_PRINT
1823 * @sa #nlREQUIRE_SUCCESS_PRINT
1826 #define nlPRECONDITION_VALUE_SUCCESS_PRINT(aStatus, aValue, aMessage) __nlPRECONDITION_SUCCESS_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aStatus, return aValue, aMessage)
1829 * @def nlNPRECONDITION_VALUE(aCondition, aValue)
1832 * This checks for the specified condition, which is expected to
1833 * commonly be false, and returns @p aValue from the enclosing
1834 * function if the condition is true.
1836 * @note This is the logical inverse of #nlPRECONDITION_VALUE.
1838 * @param[in] aCondition A Boolean expression to be evaluated.
1839 * @param[in] aValue The value to be returned when the assertion
1842 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1843 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1845 * @sa #nlPRECONDITION_VALUE
1852 #define nlNPRECONDITION_VALUE(aCondition, aValue) __nlNPRECONDITION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue)
1855 * @def nlNPRECONDITION_VALUE_ACTION(aCondition, aValue, anAction)
1858 * This checks for the specified condition, which is expected to
1859 * commonly be false, and both executes @p anAction and returns @p
1860 * aValue from the enclosing function if the condition is true.
1862 * @note This is the logical inverse of #nlPRECONDITION_VALUE_ACTION.
1864 * @param[in] aCondition A Boolean expression to be evaluated.
1865 * @param[in] aValue The value to be returned when the assertion
1867 * @param[in] anAction An expression or block to execute when the
1868 * assertion fails. This will be executed
1869 * after #NL_ASSERT_LOG() and
1870 * #NL_ASSERT_BACKTRACE() but before
1871 * #NL_ASSERT_TRAP().
1873 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1874 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1876 * @sa #nlPRECONDITION_VALUE_ACTION
1878 * @sa #nlNEXPECT_ACTION
1879 * @sa #nlNDESIRE_ACTION
1880 * @sa #nlNREQUIRE_ACTION
1883 #define nlNPRECONDITION_VALUE_ACTION(aCondition, aValue, anAction) __nlNPRECONDITION_ACTION(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue, anAction)
1886 * @def nlNPRECONDITION_VALUE_PRINT(aCondition, aValue, aMessage)
1889 * This checks for the specified condition, which is expected to
1890 * commonly be false, and both prints @p aMessage and then returns
1891 * @p aValue from the enclosing function if the condition is true.
1893 * @note This is the logical inverse of #nlPRECONDITION_VALUE_PRINT.
1895 * @param[in] aCondition A Boolean expression to be evaluated.
1896 * @param[in] aValue The value to be returned when the assertion
1898 * @param[in] aMessage A pointer to a NULL-terminated C string
1899 * containing a caller-specified message
1900 * further describing the assertion failure.
1902 * @sa #NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS
1903 * @sa #NL_ASSERT_PRECONDITION_PRODUCTION_FLAGS
1905 * @sa #nlPRECONDITION_VALUE_PRINT
1907 * @sa #nlNEXPECT_PRINT
1908 * @sa #nlNDESIRE_PRINT
1909 * @sa #nlNREQUIRE_PRINT
1912 #define nlNPRECONDITION_VALUE_PRINT(aCondition, aValue, aMessage) __nlNPRECONDITION_PRINT(NL_ASSERT_PRECONDITION_NONPRODUCTION_FLAGS, aCondition, return aValue, aMessage)
1920 * @ingroup assert-style
1927 * @def NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS_DEFAULT
1930 * This defines the default behavioral flags for assert-style
1931 * exception family assertions when #NL_ASSERT_PRODUCTION is
1934 * This may be used to override #NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS as follows:
1937 * #define NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS_DEFAULT
1939 * #include <nlassert.h>
1942 * @sa #NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS
1944 * @sa #NL_ASSERT_PRODUCTION
1946 * @sa #NL_ASSERT_FLAG_BACKTRACE
1947 * @sa #NL_ASSERT_FLAG_LOG
1948 * @sa #NL_ASSERT_FLAG_TRAP
1951 #define NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG)
1954 * @def NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS
1957 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
1958 * disabled that govern the behavior for assert-style exception
1959 * family assertions when the assertion expression evaluates to
1962 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
1964 * @sa #NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS_DEFAULT
1966 * @sa #NL_ASSERT_PRODUCTION
1968 * @sa #NL_ASSERT_FLAG_BACKTRACE
1969 * @sa #NL_ASSERT_FLAG_LOG
1970 * @sa #NL_ASSERT_FLAG_TRAP
1972 #if NL_ASSERT_USE_FLAGS_DEFAULT
1973 #define NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS_DEFAULT
1974 #elif !defined(NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS)
1975 #define NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
1979 * @def nlASSERT(aCondition)
1982 * This checks for the specified condition, which is expected to
1983 * commonly be true and takes action, based on configuration, and
1984 * invokes #NL_ASSERT_ABORT() if the condition is false.
1986 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
1987 * side-effects, if any, in the asserted expression will still be produced.
1989 * @param[in] aCondition A Boolean expression to be evaluated.
1991 * @sa #NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS
1998 #define nlASSERT(aCondition) __nlABORT(NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS, aCondition)
2001 * @def nlASSERT_ACTION(aCondition, anAction)
2004 * This checks for the specified condition, which is expected to
2005 * commonly be true and takes action, based on configuration, and
2006 * both executes @p anAction and then invokes #NL_ASSERT_ABORT() if
2007 * the condition is false.
2009 * @note If #NL_ASSERT_PRODUCTION is true, the check is made inactive. But
2010 * side-effects, if any, in the asserted expression will still be produced.
2012 * @param[in] aCondition A Boolean expression to be evaluated.
2013 * @param[in] anAction An expression or block to execute when the
2014 * assertion fails. This will be executed
2015 * after #NL_ASSERT_LOG() and
2016 * #NL_ASSERT_BACKTRACE() but before
2017 * #NL_ASSERT_TRAP().
2019 * @sa #NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS
2021 * @sa #nlCHECK_ACTION
2022 * @sa #nlVERIFY_ACTION
2023 * @sa #nlABORT_ACTION
2026 #define nlASSERT_ACTION(aCondition, anAction) __nlABORT_ACTION(NL_ASSERT_ASSERT_NONPRODUCTION_FLAGS, aCondition, anAction)
2034 * @ingroup abort-style
2041 * @def NL_ASSERT_ABORT_NONPRODUCTION_FLAGS_DEFAULT
2044 * This defines the default behavioral flags for abort-style
2045 * exception family assertions when #NL_ASSERT_PRODUCTION is
2048 * This may be used to override #NL_ASSERT_ABORT_NONPRODUCTION_FLAGS as follows:
2051 * #define NL_ASSERT_ABORT_NONPRODUCTION_FLAGS NL_ASSERT_ABORT_NONPRODUCTION_FLAGS_DEFAULT
2053 * #include <nlassert.h>
2056 * @sa #NL_ASSERT_ABORT_NONPRODUCTION_FLAGS
2058 * @sa #NL_ASSERT_PRODUCTION
2060 * @sa #NL_ASSERT_FLAG_BACKTRACE
2061 * @sa #NL_ASSERT_FLAG_LOG
2062 * @sa #NL_ASSERT_FLAG_TRAP
2065 #define NL_ASSERT_ABORT_NONPRODUCTION_FLAGS_DEFAULT (NL_ASSERT_FLAG_BACKTRACE | NL_ASSERT_FLAG_LOG)
2068 * @def NL_ASSERT_ABORT_NONPRODUCTION_FLAGS
2071 * This defines the behavioral flags when #NL_ASSERT_PRODUCTION is
2072 * disabled that govern the behavior for abort-style exception
2073 * family assertions when the assertion expression evaluates to
2076 * @sa #NL_ASSERT_USE_FLAGS_DEFAULT
2078 * @sa #NL_ASSERT_ABORT_NONPRODUCTION_FLAGS_DEFAULT
2080 * @sa #NL_ASSERT_PRODUCTION
2082 * @sa #NL_ASSERT_FLAG_BACKTRACE
2083 * @sa #NL_ASSERT_FLAG_LOG
2084 * @sa #NL_ASSERT_FLAG_TRAP
2086 #if NL_ASSERT_USE_FLAGS_DEFAULT
2087 #define NL_ASSERT_ABORT_NONPRODUCTION_FLAGS NL_ASSERT_ABORT_NONPRODUCTION_FLAGS_DEFAULT
2088 #elif !defined(NL_ASSERT_ABORT_NONPRODUCTION_FLAGS)
2089 #define NL_ASSERT_ABORT_NONPRODUCTION_FLAGS (NL_ASSERT_FLAG_NONE)
2093 * @def nlABORT(aCondition)
2096 * This checks for the specified condition, which is expected to
2097 * commonly be true and takes action, based on configuration, and
2098 * invokes #NL_ASSERT_ABORT() if the condition is false.
2100 * @param[in] aCondition A Boolean expression to be evaluated.
2102 * @sa #NL_ASSERT_ABORT_NONPRODUCTION_FLAGS
2103 * @sa #NL_ASSERT_ABORT_PRODUCTION_FLAGS
2110 #define nlABORT(aCondition) __nlABORT(NL_ASSERT_ABORT_NONPRODUCTION_FLAGS, aCondition)
2113 * @def nlABORT_ACTION(aCondition, anAction)
2116 * This checks for the specified condition, which is expected to
2117 * commonly be true and takes action, based on configuration, and
2118 * both executes @p anAction and then invokes #NL_ASSERT_ABORT() if
2119 * the condition is false.
2121 * @param[in] aCondition A Boolean expression to be evaluated.
2122 * @param[in] anAction An expression or block to execute when the
2123 * assertion fails. This will be executed
2124 * after #NL_ASSERT_LOG() and
2125 * #NL_ASSERT_BACKTRACE() but before
2126 * #NL_ASSERT_TRAP().
2128 * @sa #NL_ASSERT_ABORT_NONPRODUCTION_FLAGS
2129 * @sa #NL_ASSERT_ABORT_PRODUCTION_FLAGS
2131 * @sa #nlCHECK_ACTION
2132 * @sa #nlVERIFY_ACTION
2133 * @sa #nlASSERT_ACTION
2136 #define nlABORT_ACTION(aCondition, anAction) __nlABORT_ACTION(NL_ASSERT_ABORT_NONPRODUCTION_FLAGS, aCondition, anAction)
2143 #endif /* NLCORE_NLASSERT_NONPRODUCTION_H */