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 84
84
// / Size of pointer in bytes
85
85
#define MODM_SIZEOF_POINTER
86
86
87
+ // / Only defined in debug profile
88
+ #define MODM_DEBUG_BUILD
89
+
87
90
// / @}
88
91
89
92
#else // !__DOXYGEN__
Original file line number Diff line number Diff line change @@ -175,6 +175,26 @@ just as above:
175
175
4 . ` bool modm_assert_continue_fail_debug() `
176
176
5 . ` bool modm_assert_continue_ignore_debug() `
177
177
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
+
178
198
179
199
### When to use what?
180
200
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ For *release builds*:
36
36
For * debug builds* :
37
37
38
38
- ` -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.
39
41
40
42
#### Only C
41
43
You can’t perform that action at this time.
0 commit comments