summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml74
-rw-r--r--appveyor.yml55
-rw-r--r--mrbgems/mruby-random/src/random.c28
-rw-r--r--src/etc.c7
-rw-r--r--src/gc.c1
-rw-r--r--src/object.c1
-rw-r--r--src/string.c1
7 files changed, 99 insertions, 68 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 81deb4515..335c0cdf6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,51 +5,59 @@ on: [push, pull_request]
jobs:
Ubuntu-1604:
runs-on: ubuntu-16.04
+ env:
+ MRUBY_CONFIG: travis_config.rb
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt install ruby gperf
- - name: build and test
- run: rake -m -j4 all test
- env:
- MRUBY_CONFIG: travis_config.rb
+ - name: build
+ run: rake -m
+ - name: test
+ run: rake test
Ubuntu-1804-gcc:
runs-on: ubuntu-18.04
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ CC: gcc
+ CXX: g++
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt install ruby gperf gcc g++
- - name: build and test
- run: rake -m -j4 all test
- env:
- MRUBY_CONFIG: travis_config.rb
- CC: gcc
- CXX: g++
+ - name: build
+ run: rake -m
+ - name: test
+ run: rake test
Ubuntu-1804-clang:
runs-on: ubuntu-18.04
+ env:
+ MRUBY_CONFIG: travis_config.rb
+ CC: clang
+ CXX: clang++
steps:
- uses: actions/checkout@v1
- name: apt
run: sudo apt install ruby gperf
- - name: build and test
- run: rake -m -j4 all test
- env:
- MRUBY_CONFIG: travis_config.rb
- CC: clang
- CXX: clang++
+ - name: build
+ run: rake -m
+ - name: test
+ run: rake test
macOS:
runs-on: macos-latest
+ env:
+ MRUBY_CONFIG: travis_config.rb
steps:
- uses: actions/checkout@v1
- name: brew
run: brew install ruby gperf
- - name: build and test
- run: rake -m -j4 all test
- env:
- MRUBY_CONFIG: travis_config.rb
+ - name: build
+ run: rake -m
+ - name: test
+ run: rake test
Windows-MinGW:
runs-on: windows-latest
@@ -57,8 +65,8 @@ jobs:
- uses: actions/checkout@v1
- name: chocolatey
run: choco install -y ruby gperf
- - name: build and test
- run: rake -E '$stdout.sync=true' -j4 test
+ - name: build
+ run: rake -E 'STDOUT.sync=true' test
env:
MRUBY_CONFIG: travis_config.rb
CFLAGS: -g -O1 -Wall -Wundef
@@ -82,25 +90,13 @@ jobs:
- name: Set ENV
run: |
echo '::set-env name=PATH::C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin'
- - name: build and test
+ - name: build
shell: cmd
- run: C:\tools\cygwin\bin\ruby.exe /usr/bin/rake -m -j4 -E 'STDOUT.sync=true' test
+ run: C:\tools\cygwin\bin\ruby.exe /usr/bin/rake -E 'STDOUT.sync=true' -m
env:
MRUBY_CONFIG: travis_config.rb
-
- Windows-VC:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v1
- - name: chocolatey
- run: choco install -y ruby gperf
- - name: build and test
+ - name: test
shell: cmd
- run: |
- call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
- rake -E "STDOUT.sync=true" -m -j4 test
+ run: C:\tools\cygwin\bin\ruby.exe /usr/bin/rake -E 'STDOUT.sync=true' test
env:
- MRUBY_CONFIG: appveyor_config.rb
- # TODO(take-cheeze): Re-enable /O2
- CFLAGS: "/c /nologo /W3 /we4013 /Zi /MD /D_CRT_SECURE_NO_WARNINGS"
- CXXFLAGS: "/c /nologo /W3 /Zi /MD /EHs /D_CRT_SECURE_NO_WARNINGS"
+ MRUBY_CONFIG: travis_config.rb
diff --git a/appveyor.yml b/appveyor.yml
index e135383e1..93c40dbb1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,39 +1,44 @@
version: "{build}"
-os: Visual Studio 2017
-
shallow_clone: true
environment:
matrix:
- # Visual Studio 2017 64bit
- - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
-
- # Visual Studio 2017 32bit
- - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
- machine: x86
-
- # Visual Studio 2015 64bit
- - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
- machine: amd64
-
- # Visual Studio 2015 32bit
- - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
+ - job_name: Visual Studio 2019 64bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat
+ appveyor_build_worker_image: Visual Studio 2019
+
+ - job_name: Visual Studio 2019 32bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
+ appveyor_build_worker_image: Visual Studio 2019
+
+ - job_name: Visual Studio 2017 64bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
+ appveyor_build_worker_image: Visual Studio 2017
+
+ - job_name: Visual Studio 2017 32bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat
+ appveyor_build_worker_image: Visual Studio 2017
+
+ - job_name: Visual Studio 2015 64bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
+ appveyor_build_worker_image: Visual Studio 2015
+ machine: x86_amd64
+
+ - job_name: Visual Studio 2015 32bit
+ visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
+ appveyor_build_worker_image: Visual Studio 2015
machine: x86
- # Visual Studio 2013 64bit
- - visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
- machine: amd64
-
-
init:
- call "%visualcpp%" %machine%
- # For using Rubyinstaller's Ruby 2.4 64bit
- - set PATH=C:\Ruby24-x64\bin;%PATH%
+ # For using Rubyins4aller's Ruby 2.6 64bit
+ # 2.6 is the highest supported Ruby version across all historical
+ # Visual Studio AppVeyor images. Ruby 2.7 is only on the 2019 image.
+ - set PATH=C:\Ruby26-x64\bin;%PATH%
- ruby --version
-
build_script:
- set MRUBY_CONFIG=appveyor_config.rb
- - rake -m
- - rake -E $stdout.sync=true test
+ - rake -E "$stdout.sync=true" -m -j4
+ - rake test
diff --git a/mrbgems/mruby-random/src/random.c b/mrbgems/mruby-random/src/random.c
index 515c0707a..10c81b946 100644
--- a/mrbgems/mruby-random/src/random.c
+++ b/mrbgems/mruby-random/src/random.c
@@ -218,6 +218,34 @@ mrb_ary_shuffle_bang(mrb_state *mrb, mrb_value ary)
mrb_value r = mrb_nil_value();
rand_state *random;
+ /*
+ * MSC compiler bug generating invalid instructions with optimization
+ * enabled. MSC errantly uses a hardcoded value with optimizations on
+ * when using a fixed value from a union.
+ * Creating a temp volatile variable and reassigning back to the original
+ * value tricks the compiler to not perform this optimization;
+ */
+#if defined _MSC_VER && _MSC_VER >= 1923
+ /* C++ will not cast away volatile easily, so we cannot do something like
+ * volatile mrb_value rr = r; r = (mrb_value)rr; with C++.
+ * That cast does work with C.
+ * We also have to trick the compiler to not optimize away the const_cast entirely
+ * by creating and manipulating an intermediate volatile pointer.
+ */
+ volatile mrb_value *v_r;
+ volatile mrb_int ii;
+ mrb_value *p_r;
+ v_r = &r;
+ ii = 2;
+ v_r = v_r + 2;
+#if defined __cplusplus
+ p_r = const_cast<mrb_value*>(v_r - ii);
+#else
+ p_r = (mrb_value*)v_r - ii;
+#endif
+ r = *p_r;
+#endif
+
if (RARRAY_LEN(ary) > 1) {
mrb_get_args(mrb, "|o", &r);
diff --git a/src/etc.c b/src/etc.c
index 785f49357..74b9ab03b 100644
--- a/src/etc.c
+++ b/src/etc.c
@@ -107,10 +107,11 @@ mrb_obj_id(mrb_value obj)
return MakeID(0); /* not define */
case MRB_TT_FALSE:
if (mrb_nil_p(obj))
- return MakeID(1);
- return MakeID(0);
+ return MakeID(4);
+ else
+ return MakeID(0);
case MRB_TT_TRUE:
- return MakeID(1);
+ return MakeID(2);
case MRB_TT_SYMBOL:
return MakeID(mrb_symbol(obj));
case MRB_TT_FIXNUM:
diff --git a/src/gc.c b/src/gc.c
index 6c83911d5..e1892080f 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -225,7 +225,6 @@ mrb_realloc(mrb_state *mrb, void *p, size_t len)
p2 = mrb_realloc_simple(mrb, p, len);
if (len == 0) return p2;
if (p2 == NULL) {
- mrb_free(mrb, p);
mrb->gc.out_of_memory = TRUE;
mrb_raise_nomemory(mrb);
}
diff --git a/src/object.c b/src/object.c
index db9dfb568..7257f402d 100644
--- a/src/object.c
+++ b/src/object.c
@@ -338,6 +338,7 @@ mrb_convert_type(mrb_state *mrb, mrb_value val, enum mrb_vtype type, const char
if (mrb_type(val) == type) return val;
v = convert_type(mrb, val, tname, method, TRUE);
if (mrb_type(v) != type) {
+ if (type == MRB_TT_STRING) return mrb_any_to_s(mrb, val);
mrb_raisef(mrb, E_TYPE_ERROR, "%v cannot be converted to %s by #%s", val, tname, method);
}
return v;
diff --git a/src/string.c b/src/string.c
index f1ffbe43d..78c41c5f3 100644
--- a/src/string.c
+++ b/src/string.c
@@ -1121,6 +1121,7 @@ mrb_str_to_str(mrb_state *mrb, mrb_value str)
return mrb_sym_str(mrb, mrb_symbol(str));
case MRB_TT_FIXNUM:
return mrb_fixnum_to_str(mrb, str, 10);
+ case MRB_TT_SCLASS:
case MRB_TT_CLASS:
case MRB_TT_MODULE:
return mrb_mod_to_s(mrb, str);