Permalink
Browse files

use _setjmp/_longjmp on OS X

  • Loading branch information...
kazuho committed Dec 31, 2015
1 parent 38b9c2d commit f4bb329c748a9c1de2a373b5ddeb1e4baf6ac8d8
Showing with 10 additions and 2 deletions.
  1. +10 −2 include/mruby/throw.h
View
@@ -20,11 +20,19 @@ typedef mrb_int mrb_jmpbuf_impl;
#include <setjmp.h>
#define MRB_TRY(buf) do { if (setjmp((buf)->impl) == 0) {
#if defined(__APPLE__)
#define MRB_SETJMP _setjmp
#define MRB_LONGJMP _longjmp
#else
#define MRB_SETJMP setjmp
#define MRB_LONGJMP longjmp
#endif
#define MRB_TRY(buf) do { if (MRB_SETJMP((buf)->impl) == 0) {
#define MRB_CATCH(buf) } else {
#define MRB_END_EXC(buf) } } while(0)
#define MRB_THROW(buf) longjmp((buf)->impl, 1);
#define MRB_THROW(buf) MRB_LONGJMP((buf)->impl, 1);
#define mrb_jmpbuf_impl jmp_buf
#endif

0 comments on commit f4bb329

Please sign in to comment.