From 0bcf9e28fc6b41f75e78557295decfdcdb947b7a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Thu, 2 Mar 2017 10:58:26 +0900 Subject: 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) --- mrbgems/mruby-bin-mruby/mrbgem.rake | 6 ++++++ mrbgems/mruby-compiler/mrbgem.rake | 4 ++-- mrbgems/mruby-error/mrbgem.rake | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'mrbgems') diff --git a/mrbgems/mruby-bin-mruby/mrbgem.rake b/mrbgems/mruby-bin-mruby/mrbgem.rake index ba7fad1fa..243b413eb 100644 --- a/mrbgems/mruby-bin-mruby/mrbgem.rake +++ b/mrbgems/mruby-bin-mruby/mrbgem.rake @@ -4,4 +4,10 @@ MRuby::Gem::Specification.new('mruby-bin-mruby') do |spec| spec.summary = 'mruby command' spec.bins = %w(mruby) spec.add_dependency('mruby-compiler', :core => 'mruby-compiler') + spec.add_dependency('mruby-error', :core => 'mruby-error') + + if build.cxx_exception_enabled? + @objs << build.compile_as_cxx("#{spec.dir}/tools/mruby/mruby.c", "#{spec.build_dir}/tools/mruby/mruby.cxx") + @objs.delete_if { |v| v == objfile("#{spec.build_dir}/tools/mruby/mruby") } + end end diff --git a/mrbgems/mruby-compiler/mrbgem.rake b/mrbgems/mruby-compiler/mrbgem.rake index 3a22762fa..3bf6d6ae3 100644 --- a/mrbgems/mruby-compiler/mrbgem.rake +++ b/mrbgems/mruby-compiler/mrbgem.rake @@ -8,11 +8,11 @@ MRuby::Gem::Specification.new 'mruby-compiler' do |spec| lex_def = "#{current_dir}/core/lex.def" core_objs = Dir.glob("#{current_dir}/core/*.c").map { |f| - next nil if build.cxx_abi_enabled? and f =~ /(codegen).c$/ + next nil if build.cxx_exception_enabled? and f =~ /(codegen).c$/ objfile(f.pathmap("#{current_build_dir}/core/%n")) }.compact - if build.cxx_abi_enabled? + if build.cxx_exception_enabled? core_objs << build.compile_as_cxx("#{current_build_dir}/core/y.tab.c", "#{current_build_dir}/core/y.tab.cxx", objfile("#{current_build_dir}/y.tab"), ["#{current_dir}/core"]) << diff --git a/mrbgems/mruby-error/mrbgem.rake b/mrbgems/mruby-error/mrbgem.rake index b8281b17e..30a4259a8 100644 --- a/mrbgems/mruby-error/mrbgem.rake +++ b/mrbgems/mruby-error/mrbgem.rake @@ -3,7 +3,7 @@ MRuby::Gem::Specification.new('mruby-error') do |spec| spec.author = 'mruby developers' spec.summary = 'extensional error handling' - if build.cxx_abi_enabled? + if build.cxx_exception_enabled? @objs << build.compile_as_cxx("#{spec.dir}/src/exception.c", "#{spec.build_dir}/src/exception.cxx") @objs.delete_if { |v| v == objfile("#{spec.build_dir}/src/exception") } end -- cgit v1.2.3