summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md11
-rw-r--r--build_config/boxing.rb168
-rw-r--r--build_config/travis.rb2
-rw-r--r--lib/mruby/build.rb2
-rw-r--r--tasks/toolchains/gcc.rake2
5 files changed, 22 insertions, 163 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ec25f89b1..fec2e8907 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -33,11 +33,6 @@ mruby should be highly portable to other systems and compilers. For this it is
recommended to keep your code as close as possible to the C99 standard
(http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf).
-Although we target C99, we've heard some compilers in the embedded environment
-still requires declarations of local variables to be at the beginning of a
-scope. Until we confirm the situation has changed, we use the old-style
-variable declaration.
-
Visual C++ is also an important target for mruby (supported version is 2013 or
later). For this reason features that are not supported by Visual C++ may not
be used (e.g. `%z` of `strftime()`).
@@ -50,12 +45,6 @@ The dependencies to libraries should be kept to an absolute minimum. This
increases the portability but makes it also easier to cut away parts of mruby
on-demand.
-#### Don't use C++ style comments
-
- /* This is the preferred comment style */
-
-Use C++ style comments only for temporary comment e.g. commenting out some code lines.
-
#### Insert a break after the function return value:
int
diff --git a/build_config/boxing.rb b/build_config/boxing.rb
index 75046e371..bc35f1600 100644
--- a/build_config/boxing.rb
+++ b/build_config/boxing.rb
@@ -1,151 +1,21 @@
-MRuby::Build.new('boxing-no-m64-i64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m64'
- conf.linker.flags << '-m64'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NO_BOXING MRB_INT64)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-no-m64-i32') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m64'
- conf.linker.flags << '-m64'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NO_BOXING MRB_INT32)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-no-m32-i64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m32'
- conf.linker.flags << '-m32'
-
- # Turn on `enable_debug` for better debugging
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NO_BOXING MRB_INT64)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-no-m32-i32') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m32'
- conf.linker.flags << '-m32'
-
- # Turn on `enable_debug` for better debugging
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NO_BOXING MRB_INT32)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-word-m64-i64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m64'
- conf.linker.flags << '-m64'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_WORD_BOXING MRB_INT64)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-word-m64-i32') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m64'
- conf.linker.flags << '-m64'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_WORD_BOXING MRB_INT32)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-word-m32-i64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m32'
- conf.linker.flags << '-m32'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_WORD_BOXING MRB_INT64)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-word-m32-i32') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m32'
- conf.linker.flags << '-m32'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_WORD_BOXING MRB_INT32)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-nan-m64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m64'
- conf.linker.flags << '-m64'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NAN_BOXING)
- end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
-end
-
-MRuby::Build.new('boxing-nan-m64') do |conf|
- toolchain :gcc
-
- conf.cc.flags << '-m32'
- conf.linker.flags << '-m32'
-
- conf.gembox 'default'
- conf.compilers.each do |c|
- c.defines += %w(MRB_NAN_BOXING MRB_INT32)
+BOXINGS = %w[no word nan]
+BITS = [64, 32]
+INTS = [64, 32]
+
+BOXINGS.product(BITS, INTS) do |boxing, bit, int|
+ next if boxing == "nan" && int == 64
+
+ MRuby::Build.new("boxing-#{boxing}-m#{bit}-i#{int}") do |conf|
+ conf.toolchain :gcc
+ conf.gembox 'default'
+ conf.compilers.each do |c|
+ c.defines << "MRB_#{boxing.upcase}_BOXING"
+ c.defines << "MRB_INT#{int}"
+ c.flags << "-m#{bit}"
+ end
+ conf.linker.flags << "-m#{bit}"
+ conf.enable_debug
+ conf.enable_test
+ conf.enable_bintest
end
- conf.enable_debug
- conf.enable_test
- conf.enable_bintest
end
diff --git a/build_config/travis.rb b/build_config/travis.rb
index 58a739ce6..3b28b4c4e 100644
--- a/build_config/travis.rb
+++ b/build_config/travis.rb
@@ -4,7 +4,6 @@ MRuby::Build.new('full-debug') do |conf|
# include all core GEMs
conf.gembox 'full-core'
- conf.cc.flags += %w(-Werror=declaration-after-statement)
conf.cc.defines += %w(MRB_GC_STRESS MRB_ENABLE_DEBUG_HOOK)
conf.enable_test
@@ -15,7 +14,6 @@ MRuby::Build.new do |conf|
# include all core GEMs
conf.gembox 'full-core'
- conf.cc.flags += %w(-Werror=declaration-after-statement)
conf.compilers.each do |c|
c.defines += %w(MRB_GC_FIXED_ARENA)
end
diff --git a/lib/mruby/build.rb b/lib/mruby/build.rb
index 59b5cd583..e553eb437 100644
--- a/lib/mruby/build.rb
+++ b/lib/mruby/build.rb
@@ -270,12 +270,14 @@ EOS
end
def define_rules
+ use_mrdb = @gems.find{|g| g.name == "mruby-bin-debugger"}
compilers.each do |compiler|
if respond_to?(:enable_gems?) && enable_gems?
compiler.defines -= %w(DISABLE_GEMS)
else
compiler.defines += %w(DISABLE_GEMS)
end
+ compiler.defines |= %w(MRB_ENABLE_DEBUG_HOOK) if use_mrdb
compiler.define_rules build_dir, File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
end
end
diff --git a/tasks/toolchains/gcc.rake b/tasks/toolchains/gcc.rake
index 34d747af5..316d2d9a1 100644
--- a/tasks/toolchains/gcc.rake
+++ b/tasks/toolchains/gcc.rake
@@ -2,7 +2,7 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
default_command = params[:default_command] || 'gcc'
compiler_flags = %w(-g -O3 -Wall -Wundef)
c_mandatory_flags = %w(-std=gnu99)
- cxx_invalid_flags = %w(-Wdeclaration-after-statement -Werror-implicit-function-declaration)
+ cxx_invalid_flags = %w(-Werror-implicit-function-declaration)
[conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler|
if compiler == conf.cxx