summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-03-02 10:58:26 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-03-02 10:58:26 +0900
commit0bcf9e28fc6b41f75e78557295decfdcdb947b7a (patch)
treef35fed4d182ee5dadeb91048a1bdba9da1d9063b /src
parentfdd92750fe7e65150b067bc5179e813e7b5e2312 (diff)
downloadmruby-0bcf9e28fc6b41f75e78557295decfdcdb947b7a.tar.gz
mruby-0bcf9e28fc6b41f75e78557295decfdcdb947b7a.zip
Reorganize C++ exceptions; ref #3470
There are 3 levels of C++ exception handling: * default - no C++ exception (use setjmp/longjmp) * enable_cxx_exception (use C++ exceptions with C ABI) * enable_cxx_abi (use C++ ABI including exceptions)
Diffstat (limited to 'src')
-rw-r--r--src/mruby_core.rake4
-rw-r--r--src/vm.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/mruby_core.rake b/src/mruby_core.rake
index abde441d5..4558493d9 100644
--- a/src/mruby_core.rake
+++ b/src/mruby_core.rake
@@ -4,11 +4,11 @@ MRuby.each_target do
current_build_dir = "#{build_dir}/#{relative_from_root}"
objs = Dir.glob("#{current_dir}/*.c").map { |f|
- next nil if cxx_abi_enabled? and f =~ /(error|vm).c$/
+ next nil if cxx_exception_enabled? and f =~ /(error|vm).c$/
objfile(f.pathmap("#{current_build_dir}/%n"))
}.compact
- if cxx_abi_enabled?
+ if cxx_exception_enabled?
objs += %w(vm error).map { |v| compile_as_cxx "#{current_dir}/#{v}.c", "#{current_build_dir}/#{v}.cxx" }
end
self.libmruby << objs
diff --git a/src/vm.c b/src/vm.c
index 458968524..c05afca9d 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -2583,3 +2583,7 @@ mrb_top_run(mrb_state *mrb, struct RProc *proc, mrb_value self, unsigned int sta
return v;
}
+
+#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
+mrb_int mrb_jmpbuf::jmpbuf_id = 0;
+#endif