Redefine `CHECKPOINT_*` macros.
By definition `mrb_assert()` called only when `MRB_DEBUG` is defined too.
But make I wanted to make clear that the local variable `current_checkpoint_tag`
is only accessed when `MRB_DEBUG` is set by wrapping with `DEBUG_ONLY_EXPR()`.
@@ -919,8 +919,7 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define CHECKPOINT_RESTORE(tag) \
do { \
- DEBUG_ONLY_EXPR(int current_checkpoint_tag); \
- DEBUG_ONLY_EXPR(current_checkpoint_tag = (tag)); \
+ DEBUG_ONLY_EXPR(int current_checkpoint_tag = (tag)); \
if (FALSE) { \
CHECKPOINT_LABEL_MAKE(tag): \
DEBUG_ONLY_EXPR(current_checkpoint_tag = (tag)); \
@@ -929,12 +928,12 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define CHECKPOINT_MAIN(tag) \
} while (0); \
} \
- mrb_assert((tag) == current_checkpoint_tag); \
+ DEBUG_ONLY_EXPR(mrb_assert((tag) == current_checkpoint_tag)); \
do {
#define CHECKPOINT_END(tag) \
} while (0); \
- mrb_assert((tag) == current_checkpoint_tag); \
+ DEBUG_ONLY_EXPR(mrb_assert((tag) == current_checkpoint_tag)); \
} while (0)
#ifdef MRB_DEBUG
