summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-11-21 12:07:17 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-11-25 06:05:07 +0900
commit91bf55bbe5c837531f5785309eb0983e7ce78633 (patch)
tree54618e533fbfb48ec32555e980143d5b8e4e1d9d /include
parentb158f26f0c94c3d8e5917522ceac3b00ae8840d0 (diff)
downloadmruby-91bf55bbe5c837531f5785309eb0983e7ce78633.tar.gz
mruby-91bf55bbe5c837531f5785309eb0983e7ce78633.zip
Remove `do { ... } while(0)` hacks from `MRB_TRY` macros.
Because it can swallow `break` etc. if they are used in loops.
Diffstat (limited to 'include')
-rw-r--r--include/mruby/throw.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/mruby/throw.h b/include/mruby/throw.h
index 5d3d214e7..4a1fd8d60 100644
--- a/include/mruby/throw.h
+++ b/include/mruby/throw.h
@@ -15,9 +15,9 @@
#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
-#define MRB_TRY(buf) do { try {
+#define MRB_TRY(buf) try {
#define MRB_CATCH(buf) } catch(mrb_jmpbuf_impl e) { if (e != (buf)->impl) { throw e; }
-#define MRB_END_EXC(buf) } } while(0)
+#define MRB_END_EXC(buf) }
#define MRB_THROW(buf) throw((buf)->impl)
typedef mrb_int mrb_jmpbuf_impl;
@@ -34,9 +34,9 @@ typedef mrb_int mrb_jmpbuf_impl;
#define MRB_LONGJMP longjmp
#endif
-#define MRB_TRY(buf) do { if (MRB_SETJMP((buf)->impl) == 0) {
+#define MRB_TRY(buf) if (MRB_SETJMP((buf)->impl) == 0) {
#define MRB_CATCH(buf) } else {
-#define MRB_END_EXC(buf) } } while(0)
+#define MRB_END_EXC(buf) }
#define MRB_THROW(buf) MRB_LONGJMP((buf)->impl, 1);
#define mrb_jmpbuf_impl jmp_buf