summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 13:14:22 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-26 13:14:22 +0000
commit2d9a4afb137d18bf16ec99f5a841b0f232b05a16 (patch)
tree6b68d63abd1d3e02e7fcbfcbb724446b9bc55ea4
parent9d00f3f536e40d13bfa8a80ace3c8ac1b92b18cd (diff)
vm_exec.h: fix CHECK_VM_STACK_OVERFLOW_FOR_INSN
* vm_exec.h (CHECK_VM_STACK_OVERFLOW_FOR_INSN): surround with do/while (0), and remove unnecessary casts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--vm_exec.h11
2 files changed, 12 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4eb41db18d6..6b84b766a48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 26 22:14:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_exec.h (CHECK_VM_STACK_OVERFLOW_FOR_INSN): surround with
+ do/while (0), and remove unnecessary casts.
+
Fri Jul 26 20:12:07 2013 Akinori MUSHA <knu@iDaemons.org>
* ext/syslog/lib/syslog/logger.rb (Syslog::Logger): Add facility
diff --git a/vm_exec.h b/vm_exec.h
index b785c4fdd32..c92f715594e 100644
--- a/vm_exec.h
+++ b/vm_exec.h
@@ -169,9 +169,12 @@ default: \
#endif
#define SCREG(r) (reg_##r)
-#define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin) \
- if ((VALUE *)((char *)(((VALUE *)(cfp)->sp) + (margin)) + sizeof(rb_control_frame_t)) >= ((VALUE *)(cfp))) { \
- rb_bug("CHECK_VM_STACK_OVERFLOW_FOR_INSN: should not overflow here. Please contact ruby-core/dev with your (a part of) script. This check will be removed soon."); \
- } while (0);
+#define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin) do { \
+ if (((rb_control_frame_t *)(((cfp)->sp) + (margin)) + 1) >= (cfp)) { \
+ rb_bug("CHECK_VM_STACK_OVERFLOW_FOR_INSN: should not overflow here. " \
+ "Please contact ruby-core/dev with your (a part of) script. " \
+ "This check will be removed soon."); \
+ } \
+} while (0)
#endif /* RUBY_VM_EXEC_H */