Commit Graph

11171 Commits

Author SHA1 Message Date
dearblue 00f5c92149 Call va_end() before return
The behavior when returning from a function without `va_end()` is
undefined.
2020-01-02 00:58:27 +09:00
Yukihiro "Matz" Matsumoto 9174b18f34 Rename mrb_num_args_error to mrb_argnum_error; ref #4863 2020-01-01 22:37:14 +09:00
Yukihiro "Matz" Matsumoto b9c78c3fcc Merge pull request #4863 from shuujii/add-mrb_num_args_error-for-wrong-number-of-arguments-error
Add `mrb_num_args_error()` for "wrong number of arguments" error
2020-01-01 22:34:22 +09:00
Yukihiro "Matz" Matsumoto 021f228f9d Merge pull request #4919 from shuujii/revert-SHARED-string-is-not-required-when-sharing-POOL-string
Revert "SHARED string is not required when sharing POOL string" (75949836)
2020-01-01 22:32:41 +09:00
KOBAYASHI Shuji 40b8490fa4 Revert "SHARED string is not required when sharing POOL string" (75949836)
Because literal pool may be released by GC.

#### Example:

  ```ruby
  s1 = eval('"abcdefghijklmnopqrstuvwxyz01"')
  GC.start
  p s1  #=> "\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\x90\x03\x00stuvwxyz01"
  ```
2020-01-01 19:16:05 +09:00
Yukihiro "Matz" Matsumoto 7247e4cf1b Merge pull request #4918 from dearblue/sync-vars
Integrate `i` and `arg_i` in `mrb_get_args()`
2020-01-01 15:31:16 +09:00
Yukihiro "Matz" Matsumoto b49bc17f48 Merge pull request #4916 from dearblue/stdint
Do not include `stdint.h` before `mruby.h`; ref #4750
2020-01-01 15:30:29 +09:00
dearblue 7ed26ead9b Integrate i and arg_i in mrb_get_args()
The behavior of these two variables is the same.
2020-01-01 15:07:16 +09:00
dearblue 20d3882469 Do not include stdint.h before mruby.h; ref #4750 2020-01-01 14:17:11 +09:00
Yukihiro "Matz" Matsumoto fd1cff7735 Fixed wrong usages of mrb_get_args in vformat.c. 2020-01-01 12:34:30 +09:00
Yukihiro "Matz" Matsumoto 943fbb2bea Allow here-doc in the middle of Hash expressions; fix #4815 2020-01-01 12:21:17 +09:00
Yukihiro "Matz" Matsumoto 28c8e29c4d Merge pull request #4915 from shuujii/silence-GCC-warning-in-time.c-on-Travis-CI
Silence GCC warning in `time.c` on Travis CI
2019-12-31 22:36:41 +09:00
KOBAYASHI Shuji b493229a23 Silence GCC warning in time.c on Travis CI
Silence the following warnings:

  ```
  /mruby/mrbgems/mruby-time/src/time.c:260:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if ((MRB_INT_MAX > MRB_TIME_MAX && i > 0 && i > MRB_TIME_MAX) ||
                                                  ^
  ```
2019-12-31 21:52:20 +09:00
Yukihiro "Matz" Matsumoto 83e502b847 Merge pull request #4914 from dearblue/fix-4869
Fix builds for modern mingw; fix #4869
2019-12-31 09:42:47 +09:00
dearblue 93d0e5d9fb Fix builds for modern mingw; fix #4869
What I intended to fix in #4869 was a patch for an old MinGW.
Recent MinGWs have their own `mkstemp()` function.
I knew this after checking the patch #4903.
2019-12-31 00:11:40 +09:00
Yukihiro "Matz" Matsumoto 5e519cdbb5 Merge pull request #4913 from shuujii/use-rake-instead-of-minirake-in-.gitlab-ci.yml
Use `rake` instead of `minirake` in `.gitlab-ci.yml`
2019-12-30 22:24:08 +09:00
KOBAYASHI Shuji b96fa664b0 Use rake instead of minirake in .gitlab-ci.yml
There was an error in the `.gitlab-ci.yml` generation script, so it was also
fixed.
2019-12-30 17:46:22 +09:00
Yukihiro "Matz" Matsumoto 4327f36940 Merge pull request #4912 from shuujii/avoid-unneeded-directory-creation-during-rake--T-etc
Avoid unneeded directory creation during `rake -T`, etc.
2019-12-29 21:08:49 +09:00
KOBAYASHI Shuji b97ebf2aeb Avoid unneeded directory creation during rake -T, etc. 2019-12-29 17:46:55 +09:00
Yukihiro "Matz" Matsumoto e9de5a7a5c Merge pull request #4911 from shuujii/use-Rake.verbose-instead-of-verbose-and-pp_show
Use `Rake.verbose` instead of `$verbose` and `$pp_show` in build scripts
2019-12-28 17:43:54 +09:00
KOBAYASHI Shuji bb98fd78c3 Use Rake.verbose instead of $verbose and $pp_show in build scripts
The incompatibility that the commands of `FileUtils` origin output verbose
by default due to the changes in d8a5163b and 26e6e75b is also fixed.
2019-12-28 17:03:37 +09:00
Yukihiro "Matz" Matsumoto d2f34a8455 Merge pull request #4910 from shuujii/use-Rake-DSL-instead-of-commands-of-FileUtils
Use Rake DSL instead of commands of `FileUtils`
2019-12-27 18:35:19 +09:00
KOBAYASHI Shuji 26e6e75ba6 Use Rake DSL instead of commands of FileUtils
- Respect `--verbose(-v)` and `--dry-run(-n)` options.
- Silence warnings to keyword arguments on Ruby 2.7.
2019-12-27 16:49:32 +09:00
Yukihiro "Matz" Matsumoto 03244b52a0 Revert "Enable sanitizer in travis test"; ref #4864
`gcc` sanitizer does not work on some environment (namely my localhost).
Although it works on Travis, it is not convenient that tests fail on the
local host. We keep sanitizer tests on the local (using `clang`).

This reverts commit 9cde967321.
2019-12-27 11:16:37 +09:00
Yukihiro "Matz" Matsumoto d15e56dab0 Prohibit assignment to numbered parameters.
It is stricter than CRuby but confusing anyway.
2019-12-27 11:05:56 +09:00
Yukihiro "Matz" Matsumoto ff16331754 Allow non numbered-parameter identifier like _1 outside of blocks.
But it causes warnings as CRuby does; fix #4892 fix #489
2019-12-27 11:05:56 +09:00
Yukihiro "Matz" Matsumoto d8a5163b24 Support -v flag of rake; close #4887
The patch was originally written by @take-cheese. I have fixed the
conflict caused by `minirake` deletion - @matz.
2019-12-27 11:05:56 +09:00
Yukihiro "Matz" Matsumoto ed8491cde6 Numbered parameters: usually linked list uses cdr for links. 2019-12-27 11:05:56 +09:00
Yukihiro "Matz" Matsumoto 7e6355975e Prohibit numbered parameters as method arguments; fix #4892
As of CRuby2.7 it is only warned. `mruby` prohibits explicitly to
implement the future Ruby3 behavior.
2019-12-27 11:05:56 +09:00
KOBAYASHI Shuji 716102fff3 Enable MRB_GC_STRESS test on CI
The `debug` build target (`MRB_GC_STRESS` is enabled) on CI have been
compiled but not tested so far. However, I think testing with
`MRB_GC_STRESS` is effective (in fact, I found #4907 bug).

Therefore, I integrated `debug` and `full-debug` build targets to enable
`MRB_GC_STRESS` testing. Testing with `MRB_GC_STRESS` takes a little time,
but compiling takes more time, so CI execution time does not increase due to
decrease of build target.
2019-12-27 11:05:56 +09:00
Yukihiro "Matz" Matsumoto ef6805f599 Merge pull request #4864 from take-cheeze/enable_sanitizer_travis
Enable sanitizer in travis test
2019-12-27 10:58:24 +09:00
Yukihiro "Matz" Matsumoto d6b898685f Merge pull request #4907 from shuujii/fix-poteltially-use-of-wrong-method-cache
Fix potentially use of wrong method cache
2019-12-25 23:23:00 +09:00
KOBAYASHI Shuji 0b2d54f4f1 Fix potentially use of wrong method cache
#### Example (with `MRB_METHOD_CACHE`)

  ```ruby
  GC.start
  c = Class.new
  p c            #=> #<Class:0x7fd6a180e790>
  c.new          #=> cache `c.new`
  c = nil
  GC.start       #=> `c` is GCed
  r = Range.dup
  p r            #=> #<Class:0x7fd6a180e790>
                 #   [same pointer as `c`]
  r.new(2, 3)    #=> ArgumentError: 'initialize':
                 #   wrong number of arguments (2 for 0)
                 #   [`c.new` is called instead of `r.new`]
  ```

#### Cause

  An entry of method cache is identified by class pointer and method
  id. However, reusing memory after GC may create a class with the same
  pointer as the cached class.

#### Treatment

  Cleared method caches of the class when the class is GCed.
2019-12-25 21:31:10 +09:00
Yukihiro "Matz" Matsumoto d4cbe6271c Merge pull request #4906 from shuujii/refine-the-assertion-failure-message-in-mrdb-print-tests
Refine the assertion failure message in mrdb print tests
2019-12-25 10:58:04 +09:00
KOBAYASHI Shuji f92867a59e Refine the assertion failure message in mrdb print tests
#### Before this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected true to be false.
  ```

#### After this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected "$2 = undefined method 'bar' (NoMethodError)\n" to be start_with? "$2 = (eval):2: undefined method".
  ```
2019-12-24 23:20:20 +09:00
Yukihiro "Matz" Matsumoto d062528653 Merge pull request #4905 from kishima/cygwin_compile
Add double quotes for cygwin filenames #4904
2019-12-24 14:23:24 +09:00
kishima b63f1912df add double quotes for cygwin filenames #4904 2019-12-23 23:36:59 +09:00
Yukihiro "Matz" Matsumoto 18248cfd00 Merge pull request #4901 from take-cheeze/gnu_cxx
Use GNU extension in C++ for cygwin
2019-12-23 21:32:26 +09:00
Yukihiro "Matz" Matsumoto 0f89a91607 Merge pull request #4902 from take-cheeze/native_crlf
Handle CR LF newline natively in lexer
2019-12-23 21:31:51 +09:00
take-cheeze bb0aec1d94 Use binary mode in mrbc source code reading 2019-12-23 21:01:42 +09:00
take-cheeze 10e9f193ca Handle CR LF newline natively in lexer 2019-12-23 21:01:11 +09:00
take-cheeze 38fdca82c6 Use GNU extension in C++ for cygwin 2019-12-23 20:58:43 +09:00
Yukihiro "Matz" Matsumoto 49301ed785 Merge pull request #4900 from shuujii/parallelize-compilation-only-on-Travis-CI
Parallelize compilation only on Travis CI
2019-12-23 20:37:25 +09:00
KOBAYASHI Shuji 212d12f269 Parallelize compilation only on Travis CI
Parallel execution of tests makes log difficult to see due to mixing.
2019-12-23 20:04:11 +09:00
Yukihiro "Matz" Matsumoto a562a9aa93 Merge pull request #4899 from dearblue/build-git
Use `git checkout` instead of `git reset`
2019-12-22 22:31:33 +09:00
dearblue f08d9b288d Use git checkout instead of git reset
With this change, if the checkout fails, it will stop with an error.

The purpose is to avoid deleting working branch history when
developing gem.
2019-12-22 15:09:29 +09:00
dearblue dc15c2838f Display directory with git command 2019-12-22 14:26:00 +09:00
Yukihiro "Matz" Matsumoto 0bd3a67dea Merge pull request #4898 from shuujii/refine-.travis.yml
Refine `.travis.yml`
2019-12-22 13:13:49 +09:00
Yukihiro "Matz" Matsumoto 572958ece3 Merge pull request #4896 from shuujii/fix-undefined-method-Pathname
Fix "undefined method `Pathname'"; fix #4895
2019-12-22 13:12:59 +09:00
Yukihiro "Matz" Matsumoto fa90bcb9ab Merge pull request #4897 from shuujii/use-exec-instead-of-system-in-minirake-for-exit-status
Use `exec` instead of `system` in `minirake` for exit status
2019-12-22 13:11:23 +09:00