summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-09-01 18:01:49 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 18:20:09 +0900
commitc2444b84249a53175c5b720099f64ea580daf315 (patch)
tree66d96f7c164bba154f276b9717b2444f02402ae2
parent8461be11fcad64dc8a60215a20a55409aff7fccf (diff)
downloadmruby-c2444b84249a53175c5b720099f64ea580daf315.tar.gz
mruby-c2444b84249a53175c5b720099f64ea580daf315.zip
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()`.
-rw-r--r--src/vm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vm.c b/src/vm.c
index 5f781e8bb..68725798b 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -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