- Make sure to specify `-std=gnu99` for C compiler flag.
- Make sure to specify `-Wzero-length-array` for C/C++ compiler flag (Clang).
- Extract similar codes.
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a) with this change.
------------+-------------------+-------------------+--------
BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO
------------+-------------------+-------------------+--------
mruby | 593416 bytes | 593208 bytes | -0.04%
libmruby.a | 769048 bytes | 767264 bytes | -0.23%
------------+-------------------+-------------------+--------
BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613,
so I put it back.
- `size_t` is more commonly used.
- `len` argument of `mrb_str_new()` is `size_t`.
NOTE:
The test for `%l` is temporarily disabled because adding a new type to
`mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual
Studio 2017 in AppVeyor.
work with internationalized versions of Visual Studio. It will capture
the returned string in the local codepage encoding and make ruby exits
with an invalid UTF8 error message.
Also "Version" might be translated and not appear in the output.
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)
ref #3267#3470
By this commit, mruby do not use C++ ABI mode unless
you specify explicitly. It compiles C files by C
compilers, with C++ exception enabled when it sees
C++ files in your configured mrbgems.
I haven't tried visualcpp, so please submit an issue
if you see any problem with C++ gems on Windows.
Gitlab testing is introduced, using GitLab CI, to test many different configurations:
- 32/64 bit architecture
- float/double
- 16/32/64 bit int size
- none/NaN/word boxing
- ASCII/UTF8
using various compilers:
- gcc-4.7
- gcc-4.8
- gcc-4.9
- gcc-5
- gcc-6
- clang-3.5
- clang-3.6
- clang-3.7
- clang-3.8
- clang-3.9
Example usage:
MRuby::Gem::Specification.new('mruby-onig-regexp') do |spec|
# ...
if spec.search_package('onigmo')
# Use onigmo.h when onigmo.pc exist.
spec.cc.defines += ["HAVE_ONIGMO_H"]
elsif spec.search_package('oniguruma')
# Use oniguruma.h when oniguruma.pc exist.
spec.cc.defines += ["HAVE_ONIGURUMA_H"]
else
# Use bundled Onigmo otherwise.
# ...
end
end