File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
tools/build_script_generator Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 8484// / Size of pointer in bytes
8585#define MODM_SIZEOF_POINTER
8686
87+ // / Only defined in debug profile
88+ #define MODM_DEBUG_BUILD
89+
8790// / @}
8891
8992#else // !__DOXYGEN__
Original file line number Diff line number Diff line change @@ -175,6 +175,26 @@ just as above:
1751754 . ` bool modm_assert_continue_fail_debug() `
1761765 . ` bool modm_assert_continue_ignore_debug() `
177177
178+ Alternatively, you can guard the entire assertion statement with the
179+ ` MODM_BUILD_DEBUG ` macro if you only want to execute the check and branch in
180+ debug profile:
181+
182+ ``` cpp
183+ // The check is always performed, but only raises an assertion in debug profile!
184+ if (not modm_assert_continue_ignore_debug (cond, ...))
185+ {
186+ // if the check fails, this branch is executed in release profile too!
187+ }
188+
189+ #ifdef MODM_DEBUG_BUILD
190+ // This check if only performed in debug profile
191+ if (not modm_assert_continue_ignore(cond, ...))
192+ {
193+ // if the check fails, this branch is executed only in debug profile!
194+ }
195+ #endif
196+ ```
197+
178198
179199### When to use what?
180200
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ For *release builds*:
3636For * debug builds* :
3737
3838- ` -Og ` : optimize for debugging experience.
39+ - ` MODM_DEBUG_BUILD ` : this macro is only defined in debug profile. You can use
40+ it with ` #ifdef MODM_DEBUG_BUILD ` to enable debug code.
3941
4042#### Only C
4143
You can’t perform that action at this time.
0 commit comments