Граф коммитов

7371 Коммитов

Автор SHA1 Сообщение Дата
Watson 641136c4af
[flori/json] Does not check whether illegal utf-8 if string has ascii only.
## Before
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    25.000  i/100ms
Calculating -------------------------------------
                json    250.478  (± 4.8%) i/s -      1.250k in   5.002238s
```

## After
```
$ ruby bench_json_generate.rb
Warming up --------------------------------------
                json    32.000  i/100ms
Calculating -------------------------------------
                json    360.652  (± 3.6%) i/s -      1.824k in   5.064511s
```

## Test code
```
require 'json'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    :string => "x" * 100,
    :utf8 => "あ" * 100
  }
end

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.generate(obj)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/91a24ecac3
2019-10-14 19:54:48 +09:00
Sho Hashimoto d9e50fcbeb
[flori/json] Pass args all #to_json in json/add/*.
https://github.com/flori/json/commit/36a7ef6790
2019-10-14 19:54:48 +09:00
Florian Frank 7376d70cb0
[flori/json] Only attempt to resize strings not other objects
https://github.com/flori/json/commit/167ada8da7
2019-10-14 19:54:48 +09:00
Nobuyoshi Nakada 3e763883ea
Fixed overflow at onig_region_set
To get rid of a bug of `onig_region_set` which takes `int`s
instead of `OnigPosition`s, set elements of `beg` and `end`
members directly, for the time being.
2019-10-14 15:10:56 +09:00
Sutou Kouhei 95c420c4a6
Import StringScanner 1.0.3 (#2553) 2019-10-14 12:40:50 +09:00
Nobuyoshi Nakada f405564711
Suppress deprecation warnings of MD5 from Xcode 11.1 2019-10-12 18:47:06 +09:00
Nobuyoshi Nakada 710bc00379
Moved RB_METHOD_DEFINITION_DECL to intern.h
This macro is used here before defined in ruby.h.
2019-10-12 17:47:28 +09:00
Nobuyoshi Nakada 6333020fc9
atime may not updated unless strictatime is set on macOS Catalina
Cited from mount(8):

```
strictatime
        Always update the file access time when reading from a
        file. Without this option the filesystem may default to a
        less strict update mode, where some access time updates
        are skipped for performance reasons. This option could be
        ignored if it is not supported by the filesystem.
```
2019-10-12 14:58:55 +09:00
Yusuke Endoh f845e1bc99 ext/syslog/extconf.rb: add -llog for Android
Otherwise, requiring syslog results in:

    cannot locate symbol "__android_log_print" referenced by "syslog.so"
2019-10-10 23:21:24 +09:00
Nobuyoshi Nakada 9c0cd5c569
Prefer rb_gc_register_mark_object
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): prefer
  `rb_gc_register_mark_object`, which is better for constant
  objects, over `rb_gc_register_address` for global/static
  variables which can be re-assigned at runtime.  [Bug #16196]
2019-10-10 19:59:21 +09:00
Nobuyoshi Nakada 203b7fa1ae
Guard static variable first
* ext/openssl/ossl_asn1.c (Init_ossl_asn1): register the static
  variable to grab an internal object, before creating the object.
  otherwise the just-created object could get collected during the
  global variable list allocation.  [Bug #16196]
2019-10-10 16:25:28 +09:00
Kenta Murata dd0c75fdc2
Import changes from ruby/bigdecimal (#2531)
Sync to ruby/bigdecimal@92356ba71c
2019-10-08 09:06:28 +09:00
Yusuke Endoh 06a04a1aa3 ext/openssl/ossl_ssl.c: Use const declaration if LibreSSL >= 2.8.0
to suppress a warning in OpenBSD.

```
ossl_ssl.c:938:31: warning: incompatible pointer types passing 'SSL_SESSION *(SSL *, unsigned char *, int, int *)' (aka 'struct ssl_session_st *(struct ssl_st *, unsigned char *, int, int *)') to parameter of type 'SSL_SESSION *(*)(struct ssl_st *, const unsigned char *, int, int *)' (aka 'struct ssl_session_st *(*)(struct ssl_st *, const unsigned char *, int, int *)') [-Wincompatible-pointer-types]
        SSL_CTX_sess_set_get_cb(ctx, ossl_sslctx_session_get_cb);
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/openssl/ssl.h:738:20: note: passing argument to parameter 'get_session_cb' here
    SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,
                   ^
1 warning generated.
```
2019-10-05 19:08:23 +09:00
Yusuke Endoh 96452373fd ext/json/parser/prereq.mk: use `if $. == 1` instead of a hacky code 2019-10-05 18:28:19 +09:00
Yusuke Endoh 70e3fda2eb ext/json/parser/prereq.mk: keep line numbers of ext/json/parser/parser.c
Follow up of 5717e55e9a.
Adding a header with newline broke linenos.
2019-10-05 17:54:36 +09:00
Yusuke Endoh 417c64b9a8 ext/json/parser/parser.rl: Use "signed" char to contain negative values
char is not always signed.  In fact, it is unsigned in arm.

https://rubyci.org/logs/rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20191004T181708Z.log.html.gz
```
compiling parser.c
parser.rl: In function ‘unescape_unicode’:
parser.rl:50:5: warning: comparison is always false due to limited range of data type [-Wtype-limits]
     if (b < 0) return UNI_REPLACEMENT_CHAR;
     ^
```
2019-10-05 07:00:57 +09:00
Yusuke Endoh 5717e55e9a ext/json/parser/prereq.mk: Add a "automatically generated" header
to parser.c.
2019-10-05 07:00:07 +09:00
Yusuke Endoh 076d3d758b ext/json/parser/parser.rl: Update the source code of parser.c
There have been some direct changes in parser.c which is automatically
generated from parser.rl.  This updates parser.rl to sync the changes:

* 91793b8967
* 79ead821dd
* 80b5a0ff2a
2019-10-05 06:34:40 +09:00
卜部昌平 eb92159d72 Revert https://github.com/ruby/ruby/pull/2486
This reverts commits: 10d6a3aca7 8ba48c1b85 fba8627dc1 dd883de5ba
6c6a25feca 167e6b48f1 7cb96d41a5 3207979278 595b3c4fdd 1521f7cf89
c11c5e69ac cf33608203 3632a812c0 f56506be0d 86427a3219 .

The reason for the revert is that we observe ABA problem around
inline method cache.  When a cache misshits, we search for a
method entry.  And if the entry is identical to what was cached
before, we reuse the cache.  But the commits we are reverting here
introduced situations where a method entry is freed, then the
identical memory region is used for another method entry.  An
inline method cache cannot detect that ABA.

Here is a code that reproduce such situation:

```ruby
require 'prime'

class << Integer
  alias org_sqrt sqrt
  def sqrt(n)
    raise
  end

  GC.stress = true
  Prime.each(7*37){} rescue nil # <- Here we populate CC
  class << Object.new; end

  # These adjacent remove-then-alias maneuver
  # frees a method entry, then immediately
  # reuses it for another.
  remove_method :sqrt
  alias sqrt org_sqrt
end

Prime.each(7*37).to_a # <- SEGV
```
2019-10-03 12:45:24 +09:00
Yusuke Endoh a38fe1fbf0 ext/-test-/enumerator_kw/enumerator_kw.c: remove unused variable 2019-10-01 08:57:50 +09:00
Jeremy Evans 3073404e74 Add rb_enumeratorize_with_size_kw and related macros
Currently, there is not a way to create a sized enumerator in C
with a different set of arguments than provided by Ruby, and
correctly handle keyword arguments.  This function allows that.

The need for this is fairly uncommon, but it occurs at least in
Enumerator.produce, which takes arugments from Ruby but calls
rb_enumeratorize_with_size with a different set of arguments.
2019-09-30 07:06:42 -07:00
Jeremy Evans 649a64ae29 Add three more C-API functions for handling keywords
This adds rb_funcall_passing_block_kw, rb_funcallv_public_kw,
and rb_yield_splat_kw.  This functions are necessary to easily
handle cases where rb_funcall_passing_block, rb_funcallv_public,
and rb_yield_splat are currently used and a keyword argument
separation warning is raised.
2019-09-29 18:31:08 -07:00
卜部昌平 dd883de5ba refactor constify most of rb_method_entry_t
Now that we have eliminated most destructive operations over the
rb_method_entry_t / rb_callable_method_entry_t, let's make them
mostly immutabe and mark them const.

One exception is rb_export_method(), which destructively modifies
visibilities of method entries.  I have left that operation as is
because I suspect that destructiveness is the nature of that
function.
2019-09-30 10:26:38 +09:00
Nobuyoshi Nakada f6f03dcad6 [ruby/stringio] Bump up the version
https://github.com/ruby/stringio/commit/f0e5027279
2019-09-29 18:55:34 +09:00
Nobuyoshi Nakada 7fe253f47f [ruby/stringio] Use rb_funcallv_kw when delegating arguments
https://github.com/ruby/stringio/commit/5892663e32
2019-09-29 18:55:32 +09:00
Nobuyoshi Nakada 68ab4a5e35 [ruby/stringio] Replaced rb_funcall2 with rb_funcallv
https://github.com/ruby/stringio/commit/a37ab7c419
2019-09-29 18:55:30 +09:00
Nobuyoshi Nakada ef795f9abd [ruby/stringio] Dropped older ruby versions
https://github.com/ruby/stringio/commit/e8065153b8
2019-09-29 18:55:28 +09:00
Nobuyoshi Nakada 7f30783af7 [ruby/stringio] Get rid of String#undump for ruby 2.4 or earlier
https://github.com/ruby/stringio/commit/4dfd997e0a
2019-09-29 18:55:26 +09:00
Nobuyoshi Nakada 94db8cda9b [ruby/zlib] Fix for older ruby 2.6 or earlier
https://github.com/ruby/zlib/commit/00ead8cb2c
2019-09-29 18:53:11 +09:00
Nobuyoshi Nakada f10c9cb1f2 [ruby/zlib] Search zlib.c as a gem
https://github.com/ruby/zlib/commit/8f43b264cd
2019-09-29 18:47:59 +09:00
Jeremy Evans 660c7e050f Fix more keyword separation issues
This fixes instance_exec and similar methods. It also fixes
Enumerator::Yielder#yield, rb_yield_block, and a couple of cases
with Proc#{<<,>>}.

This support requires the addition of rb_yield_values_kw, similar to
rb_yield_values2, for passing the keyword flag.

Unlike earlier attempts at this, this does not modify the rb_block_call_func
type or add a separate function type.  The functions of type
rb_block_call_func are called by Ruby with a separate VM frame, and we can
get the keyword flag information from the VM frame flags, so it doesn't need
to be passed as a function argument.

These changes require the following VM functions accept a keyword flag:

* vm_yield_with_cref
* vm_yield
* vm_yield_with_block
2019-09-26 19:24:58 -07:00
George Claghorn 31339ef4f2 Honor Syslog::Logger#level overrides 2019-09-26 15:01:44 -07:00
Jeremy Evans 47d44510a3 Fix more keyword argument separation issues in Pathname 2019-09-26 08:01:53 -07:00
Jeremy Evans 3959469f24 Fix keyword argument separation issues in OpenSSL::SSL::SSLSocket#sys{read,write}_nonblock
It's unlikely anyone would actually hit these.  The methods are
private, you only hit this code path if calling these methods
before performing the SSL connection, and there is already a
verbose warning issued.
2019-09-26 08:01:53 -07:00
Nobuyoshi Nakada 5357ceb1ca
[ruby/io-console] Defer creating VT query string
https://github.com/ruby/io-console/commit/3d69c577a4
2019-09-26 09:59:27 +09:00
Nobuyoshi Nakada 9b10698705
[ruby/io-console] Added IO#console_mode
https://github.com/ruby/io-console/commit/77ed8d5a06
2019-09-26 09:59:27 +09:00
Jeremy Evans 80b5a0ff2a
Make rb_scan_args handle keywords more similar to Ruby methods (#2460)
Cfuncs that use rb_scan_args with the : entry suffer similar keyword
argument separation issues that Ruby methods suffer if the cfuncs
accept optional or variable arguments.

This makes the following changes to : handling.

* Treats as **kw, prompting keyword argument separation warnings
  if called with a positional hash.

* Do not look for an option hash if empty keywords are provided.
  For backwards compatibility, treat an empty keyword splat as a empty
  mandatory positional hash argument, but emit a a warning, as this
  behavior will be removed in Ruby 3.  The argument number check
  needs to be moved lower so it can correctly handle an empty
  positional argument being added.

* If the last argument is nil and it is necessary to treat it as an option
  hash in order to make sure all arguments are processed, continue to
  treat the last argument as the option hash. Emit a warning in this case,
  as this behavior will be removed in Ruby 3.

* If splitting the keyword hash into two hashes, issue a warning, as we
  will not be splitting hashes in Ruby 3.

* If the keyword argument is required to fill a mandatory positional
  argument, continue to do so, but emit a warning as this behavior will
  be going away in Ruby 3.

* If keyword arguments are provided and the last argument is not a hash,
  that indicates something wrong. This can happen if a cfunc is calling
  rb_scan_args multiple times, and providing arguments that were not
  passed to it from Ruby.  Callers need to switch to the new
  rb_scan_args_kw function, which allows passing of whether keywords
  were provided.

This commit fixes all warnings caused by the changes above.

It switches some function calls to *_kw versions with appropriate
kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS
is used.  If creating new arguments, RB_PASS_KEYWORDS is used if
the last argument is a hash to be treated as keywords.

In open_key_args in io.c, use rb_scan_args_kw.
In this case, the arguments provided come from another C
function, not Ruby.  The last argument may or may not be a hash,
so we can't set keyword argument mode.  However, if it is a
hash, we don't want to warn when treating it as keywords.

In Ruby files, make sure to appropriately use keyword splats
or literal keywords when calling Cfuncs that now issue keyword
argument separation warnings through rb_scan_args.  Also, make
sure not to pass nil in place of an option hash.

Work around Kernel#warn warnings due to problems in the Rubygems
override of the method.  There is an open pull request to fix
these issues in Rubygems, but part of the Rubygems tests for
their override fail on ruby-head due to rb_scan_args not
recognizing empty keyword splats, which this commit fixes.

Implementation wise, adding rb_scan_args_kw is kind of a pain,
because rb_scan_args takes a variable number of arguments.
In order to not duplicate all the code, the function internals need
to be split into two functions taking a va_list, and to avoid passing
in a ton of arguments, a single struct argument is used to handle
the variables previously local to the function.
2019-09-25 11:18:49 -07:00
Nobuyoshi Nakada 5b1fd79ad9
[DOC] fixed the return value of IO#ready? [ci skip]
IO#ready? returns true or false only, since r50262(1baa57b003).
2019-09-25 20:54:33 +09:00
Kazuhiro NISHIYAMA ca58e83400
Do not use of non-standard escape character '\e' 2019-09-25 09:48:44 +09:00
Nobuyoshi Nakada ea68bb914a Changed numbered parameter prefix 2019-09-24 21:57:54 +09:00
Nobuyoshi Nakada 10e3267c31 [ruby/io-console] Made cursor position 0-origin
https://github.com/ruby/io-console/commit/9377e37295
2019-09-24 16:20:31 +09:00
Nobuyoshi Nakada 244f7ec204 [ruby/io-console] Made cursor position consistent with `winsize`
To be consistent with `winsize`, changed the cursor position
format from `[x, y]` to `[row, column]`.

https://github.com/ruby/io-console/commit/d1f5ae9286
2019-09-24 16:20:30 +09:00
Nobuyoshi Nakada 9e4be78ea8 [ruby/io-console] Try fallback to stdout when stdin
https://github.com/ruby/io-console/commit/b8017509ef
2019-09-23 19:29:36 +09:00
Nobuyoshi Nakada 8487193b10 [ruby/io-console] Try to write DSR query to writable IO
https://github.com/ruby/io-console/commit/a54b6e4dd1
2019-09-23 19:24:43 +09:00
Jeremy Evans 2e551356a7 Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct type
This is how Kernel#{Array,String,Float,Integer,Hash,Rational} work.
BigDecimal and Complex instances are always frozen, so this should
not cause backwards compatibility issues for those.  Pathname
instances are not frozen, so potentially this could cause backwards
compatibility issues by not returning a new object.

Based on a patch from Joshua Ballanco, some minor changes by me.

Fixes [Bug #7522]
2019-09-21 16:10:37 -07:00
Nobuyoshi Nakada 740a98fe10
Fix for explicit cast without RUBY_METHOD_FUNC 2019-09-20 19:12:36 +09:00
Nobuyoshi Nakada cb1f9fe918
Check various method defitions in C++ 2019-09-20 19:12:35 +09:00
Nobuyoshi Nakada 04c53a1d03
Get rid of embedding make command line
NMAKE sets MAKE to the full path name, which includes spaces by
the default installation.
2019-09-20 17:05:52 +09:00
Nobuyoshi Nakada d56a3c0635
Fixed cxxanyargs/depend
* Removed excess backslashes
* Fixed the target name to try failure.cpp
2019-09-20 16:58:47 +09:00
Nobuyoshi Nakada e0c56b45a4
Moved unmatch arity check to depend file
To substitute suffixes and VPATH for nmake.
2019-09-19 22:09:43 +09:00
Nobuyoshi Nakada a3daf8e49a
Ensure that unmatched arity fails in C++ 2019-09-19 20:57:58 +09:00
Nobuyoshi Nakada b3ddeac33e
Revert "DEBUG: dump mkmf.log"
This reverts commit 69e209a345.

The debug has finishted.
2019-09-19 20:57:57 +09:00
Nobuyoshi Nakada df3fd50717
Removed mkmf.log dump in Makefile 2019-09-19 12:25:48 +09:00
Nobuyoshi Nakada 69e209a345
DEBUG: dump mkmf.log 2019-09-19 12:03:58 +09:00
Nobuyoshi Nakada 2d1e3bd8f1
DEBUG: cxxanyargs 2019-09-19 11:25:09 +09:00
Nobuyoshi Nakada a98181eb11
DEBUG: cxxanyargs 2019-09-19 10:46:52 +09:00
Nobuyoshi Nakada a9cdaaada4
DEBUG 2019-09-19 08:47:07 +09:00
Nobuyoshi Nakada 842f600a93
Look up the language module
Look up language module with `MakeMakefile.[]`, insted of a
accessing constant under that module directly, to get rid of
expose the constant to the toplevel inadvertently.
2019-09-19 00:03:18 +09:00
Nobuyoshi Nakada 15d5de59fb
Removed unused keyword argument [ci skip] 2019-09-19 00:03:18 +09:00
Nobuyoshi Nakada c3f03da494
[EXPERIMENTAL] MakeMakefile::CXX for C++ 2019-09-18 18:47:02 +09:00
Jeremy Evans 9b35dc3864 Pass keyword argument flag when rb_call_super_kw calls method_missing
This makes method_missing take a flag for whether keyword arguments
were passed.

Adds tests both for rb_call_super_kw usage as well as general usage
of super calling method_missing in Ruby methods.
2019-09-17 16:22:44 -07:00
Nobuyoshi Nakada 6d2dcf9632 [ruby/io-console] Added `intr:` option to IO#raw
Enters raw-mode but enable interrupts.

https://github.com/ruby/io-console/commit/7cba76561a
2019-09-14 23:27:53 +09:00
Nobuyoshi Nakada 83ef58f264 [ruby/io-console] Suppress yet another warning on Windows
https://github.com/ruby/io-console/commit/4e17c90788
2019-09-10 17:29:11 +09:00
Nobuyoshi Nakada b5ab918d0c [ruby/io-console] Suppress warnings on Windows
About unused variables and a function.

https://github.com/ruby/io-console/commit/32baf54e7a
2019-09-10 17:29:09 +09:00
Masaki Matsushita 0e9d56f5e7 Support timeout for Addrinfo
Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as
a keyword argument. If getaddrinfo_a(3) is available, the timeout will be
applied for name resolution. Otherwise, it will be ignored.

Socket.tcp accepts :resolv_timeout to use this feature.

This commit is retry of 6382f5cc91.
Test was failed on Solaris machines which don't have "http" in
/etc/services. In this commit, use "ssh" instead.
2019-09-10 10:10:59 +09:00
Nobuyoshi Nakada 3678c37119 [ruby/io-console] Added IO#check_winsize_changed on Windows
https://github.com/ruby/io-console/commit/ee648fa8bb
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada 74790e2dc4 [ruby/io-console] Added scroll methods
https://github.com/ruby/io-console/commit/83e70de8ab
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada c1412bd6d9 [ruby/io-console] Added line/screen erase methods
https://github.com/ruby/io-console/commit/e6344108a1
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada 9844a349bf [ruby/io-console] Added IO#goto_column
https://github.com/ruby/io-console/commit/143a9d5764
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada e8be056af9 [ruby/io-console] Added relative cursor move methods
https://github.com/ruby/io-console/commit/21d340e4a2
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada 3d9c7c2835 [ruby/io-console] Added IO#goto and IO#cursor= for VT
https://github.com/ruby/io-console/commit/7f2b1b473d
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada 53ed4fb376 [ruby/io-console] Added IO#cursor for VT
https://github.com/ruby/io-console/commit/41a6a6cace
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada 803dc9e1e4 [ruby/io-console] Added console_vt_response
A function to query console info.

https://github.com/ruby/io-console/commit/db75a07fa3
2019-09-10 08:18:03 +09:00
Nobuyoshi Nakada f4aa06c0ff [ruby/io-console] Drop fat gem support
https://github.com/ruby/io-console/commit/972ceb081d
2019-09-10 08:18:03 +09:00
卜部昌平 89c5d5a64e add minimaist C++ check
This is a test extension so we basically want test failures rather
than a configure breakage but if there is no C++ compiler, we need
no test at all because there will be no chance for the tested
header file to be used later.

This makes it possible to build the ruby binary without any C++
compiler installed in a build environment.
2019-09-09 21:27:40 +09:00
卜部昌平 042c436cd9 static member variables must explictly be initialized
These variables then get their room for storage.

See also https://github.com/ruby/ruby/runs/214042030
2019-09-09 21:27:40 +09:00
卜部昌平 92a8726994 Revert "save committers' weekend from CI failures"
This reverts commit 53d21087da.
2019-09-09 21:27:40 +09:00
Masaki Matsushita c4efbf663e Revert "Support timeout for Addrinfo"
This reverts commit 6382f5cc91.
test failed on Solaris.
2019-09-09 20:34:51 +09:00
Masaki Matsushita 6382f5cc91 Support timeout for Addrinfo
Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as
a keyword argument. If getaddrinfo_a(3) is available, the timeout will be
applied for name resolution. Otherwise, it will be ignored.

Socket.tcp accepts :resolv_timeout to use this feature.
2019-09-09 14:34:05 +09:00
Yusuke Endoh 99c9431ea1 Rename NODE_ARRAY to NODE_LIST to reflect its actual use cases
and NODE_ZARRAY to NODE_ZLIST.

NODE_ARRAY is used not only by an Array literal, but also the contents
of Hash literals, method call arguments, dynamic string literals, etc.
In addition, the structure of NODE_ARRAY is a linked list, not an array.

This is very confusing, so I believe `NODE_LIST` is a better name.
2019-09-07 13:56:29 +09:00
Kazuhiro NISHIYAMA f223ab47e6
[DOC] Update output of Ripper.sexp [ci skip] 2019-09-07 13:50:05 +09:00
卜部昌平 53d21087da save committers' weekend from CI failures
Kill the failing tests.
2019-09-06 18:20:11 +09:00
卜部昌平 1851dc269c avoid name mangling
Otherwise the dynamic linker cannot find this function.
See also https://ci.appveyor.com/project/ruby/ruby/builds/27224231/job/4pg6lxlsnsjotu2l
2019-09-06 16:52:20 +09:00
卜部昌平 2aa4fb57d1 nullptr is a C++11ism.
Should use numeric 0 for maximum portability.
See also https://travis-ci.org/ruby/ruby/jobs/581543798
2019-09-06 16:42:45 +09:00
卜部昌平 7516c48b27 fix Visual Studio compilation error
See also https://github.com/ruby/ruby/runs/213964487
2019-09-06 16:33:30 +09:00
卜部昌平 04f570e266 add test for cxxanyargs.hpp 2019-09-06 15:50:58 +09:00
卜部昌平 3df37259d8 drop-in type check for rb_define_singleton_method
We can check the function pointer passed to
rb_define_singleton_method like how we do so in rb_define_method.
Doing so revealed many arity mismatches.
2019-08-29 18:34:09 +09:00
卜部昌平 7b6fde4258 drop-in type check for rb_define_module_function
We can check the function pointer passed to rb_define_module_function
like how we do so in rb_define_method.  The difference is that this
changeset reveales lots of atiry mismatches.
2019-08-29 18:34:09 +09:00
卜部昌平 48e346a088 fix arity of bug_start
This is just a trivial mistake introduced in
0f36e8fc03.
2019-08-29 18:34:09 +09:00
Nobuyoshi Nakada 2ed68d0ff9
Revert "Add pipeline operator [Feature #15799]"
This reverts commits:
* d365fd5a02
* d780c36624
* aa7211836b
* 043f010c28
* bb4dd7c6af05c7821d572e2592ea3d0cc748d81f
* 043f010c28
* f169043d81

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/94645
2019-08-29 15:27:59 +09:00
卜部昌平 6dd60cf114 st_foreach now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
st_foreach.  I strongly believe that this commit should have had come
with b0af0592fd, which added extra
parameter to st_foreach callbacks.
2019-08-27 15:52:26 +09:00
卜部昌平 af5e256640 rb_catch now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
rb_catch, and fixes some bugs revealed by that.
2019-08-27 15:52:26 +09:00
卜部昌平 703783324c rb_ensure now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
rb_ensure, which also revealed many arity / type mismatches.
2019-08-27 15:52:26 +09:00
卜部昌平 5c7c2d9951 rb_rescue / rb_rescue2 now free from ANYARGS
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit deletes ANYARGS from
rb_rescue / rb_rescue2, which revealed many arity / type mismatches.
2019-08-27 15:52:26 +09:00
卜部昌平 3cae73133c rb_iterate now takes rb_block_call_func_t
After 5e86b005c0, I now think ANYARGS is
dangerous and should be extinct.  This commit makes rb_iterate free
from ANYARGS.
2019-08-27 15:52:26 +09:00
Yusuke Endoh 571ffcd609 ext/psych/yaml/api.c: Suppress a "variable set but not used" warning
```
compiling ../.././ext/psych/yaml/api.c
../.././ext/psych/yaml/api.c: In function 'yaml_document_delete':
../.././ext/psych/yaml/api.c:1122:7: warning: variable 'context' set but not used [-Wunused-but-set-variable]
     } context;
       ^~~~~~~
```
https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu1604/ruby-master/log/20190824T093004Z.log.html.gz
2019-08-24 20:31:16 +09:00
Nobuyoshi Nakada 2e28b3678f [ruby/stringio] Fixed a typo
b249631c43 (commitcomment-34804150)

https://github.com/ruby/stringio/commit/998d6257fb
2019-08-23 20:52:53 +09:00
Nobuyoshi Nakada a5b809e994
Check metadata a bit more 2019-08-23 13:00:17 +09:00
Nobuyoshi Nakada 650cd24555
Hoisted out get_digest_obj_metadata 2019-08-23 12:27:48 +09:00
Nobuyoshi Nakada a963851100
Hoisted out rb_id_metadata 2019-08-22 00:19:56 +09:00
Nobuyoshi Nakada 74c6662af5
Hoisted out rb_digest_namespace 2019-08-22 00:19:55 +09:00
Nobuyoshi Nakada 3df9f3cc13
Separated initializing IDs 2019-08-21 16:20:31 +09:00
Nobuyoshi Nakada 619f82bb6b
Hoisted out unixsocket_len, triming NUL chars from sun_path 2019-08-16 17:44:45 +09:00
Nobuyoshi Nakada cad41bb6d3
[ruby/stringio] Supported BOM
https://github.com/ruby/stringio/commit/b249631c43
2019-08-14 11:20:58 +09:00
Nobuyoshi Nakada 22e942deb2
[ruby/stringio] Supported `mode:` option
https://github.com/ruby/stringio/commit/53def32ba0
2019-08-14 11:20:58 +09:00
Nobuyoshi Nakada 8b44307894
[ruby/stringio] Allow bignum mode
https://github.com/ruby/stringio/commit/d28927b561
2019-08-14 11:20:58 +09:00
Nobuyoshi Nakada e54d349a01
[ruby/stringio] Added support for older versions
https://github.com/ruby/stringio/commit/c4a13d41cd
https://github.com/ruby/stringio/commit/359c9f395c
2019-08-14 11:20:58 +09:00
Nobuyoshi Nakada c8f9e9a2a0
[ruby/stringio] stringio: encoding support
https://github.com/ruby/stringio/commit/7b20075ab0
2019-08-14 11:20:57 +09:00
Nobuyoshi Nakada 3fc10eff1e
date_parse.c: trim off
* ext/date/date_parse.c (date_zone_to_diff): trim off by zone name
  length.
2019-08-12 20:41:11 +09:00
Nobuyoshi Nakada d96feee37c
date_parse.c: avoid copying
* ext/date/date_parse.c (date_zone_to_diff): get rid of copying
  the whole argument string.
2019-08-12 20:41:11 +09:00
Nobuyoshi Nakada ffdef3674a
Warn instance variable `E`
It is not dumped, as it is a short alias for `:encoding`.
2019-08-10 13:18:41 +09:00
Yusuke Endoh 8877dbe400 ext/ripper/lib/ripper/lexer.rb: Consistently use `Array#push`
instead of <<.  All the other callsites use `push`.
2019-08-07 03:13:17 +09:00
Yusuke Endoh ef8c5161b4 ext/ripper/lib/ripper/lexer.rb: fix a wrong delegation
The target method name is a typo.
2019-08-07 03:12:49 +09:00
Jeremy Evans 2b6441196e Remove documentation of %m in Syslog
Fixes [Bug #6726]
2019-08-05 16:10:25 -07:00
Yusuke Endoh 58a478bce4 ext/psych/yaml/loader.c: Cast the difference of pointers to int
instead of casting a pointer to int.
Follow up of 39622232c7.
2019-08-05 14:38:59 +09:00
Hiroshi SHIBATA 39622232c7
Suppress warnings of bundled libyaml. 2019-08-04 20:12:43 +09:00
David Carlier 2d189a6721
yaml few build warning fixes
Closes: https://github.com/ruby/ruby/pull/2283
2019-08-04 09:46:46 +09:00
Dmitry Petrashko b6cfacc85d
Remove dependency on `openssl/conf_api.h`
None of the functions defined in this header are actually used in Ruby.
Fixes build against boringssl that does not have this file.
Closes: https://github.com/ruby/ruby/pull/2210
2019-08-04 09:25:32 +09:00
Yusuke Endoh b8e351a1b9 ext/-test-/bug-14834/bug-14384.c: fallback for MAYBE_UNUSED
__unused__ is unavailable on Sun C.
https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190801T112505Z.fail.html.gz
2019-08-01 21:09:59 +09:00
卜部昌平 fd0e3bd249 fix VC 2013 compile error
It seems the compiler does not support VLAs.
See also: https://ci.appveyor.com/project/ruby/ruby/builds/26392589/job/px6nuiuw4e78weg1
2019-08-01 16:19:49 +09:00
卜部昌平 5d33f78716 fix tracepoint + backtrace SEGV
PC modification in gc_event_hook_body was careless.  There are (so
to say) abnormal iseqs stored in the cfp.  We have to check sanity
before we touch the PC.

This has not been fixed because there was no way to (ab)use the
setup from pure-Ruby.  However by using our official C APIs it is
possible to touch such frame(s), resulting in SEGV.

Fixes [Bug #14834].
2019-08-01 16:00:59 +09:00
git e315f3a134 * expand tabs. 2019-07-31 10:22:47 +09:00
Koichi Sasada 72825c35b0 Use 1 byte hint for ar_table [Feature #15602]
On ar_table, Do not keep a full-length hash value (FLHV, 8 bytes)
but keep a 1 byte hint from a FLHV (lowest byte of FLHV).
An ar_table only contains at least 8 entries, so hints consumes
8 bytes at most. We can store hints in RHash::ar_hint.

On 32bit CPU, we use 4 entries ar_table.

The advantages:
* We don't need to keep FLHV so ar_table only consumes
  16 bytes (VALUEs of key and value) * 8 entries = 128 bytes.
* We don't need to scan ar_table, but only need to check hints
  in many cases. Especially we don't need to access ar_table
  if there is no match entries (in many cases).
  It will increase memory cache locality.

The disadvantages:
* This technique can increase `#eql?` time because hints can
  conflicts (in theory, it conflicts once in 256 times).
  It can introduce incompatibility if there is a object x where
  x.eql? returns true even if hash values are different.
  I believe we don't need to care such irregular case.
* We need to re-calculate FLHV if we need to switch from ar_table
  to st_table (e.g. exceeds 8 entries).
  It also can introduce incompatibility, on mutating key objects.
  I believe we don't need to care such irregular case too.

Add new debug counters to measure the performance:
* artable_hint_hit - hint is matched and eql?#=>true
* artable_hint_miss - hint is not matched but eql?#=>false
* artable_hint_notfound - lookup counts
2019-07-31 09:52:03 +09:00
Nobuyoshi Nakada 077c28887a
[ruby/io-console] Do not use add_development_dependency
https://github.com/ruby/io-console/commit/bc77f46391
2019-07-25 08:16:57 +09:00
Nobuyoshi Nakada 414d6cf1d3 [ruby/psych] Get rid of C90 feature
For ruby 2.6 and earlier.

https://travis-ci.org/ruby/psych/jobs/562435717#L245-L248

```
../../../../ext/psych/psych_parser.c: In function ‘make_exception’:
../../../../ext/psych/psych_parser.c:87:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     VALUE ePsychSyntaxError = rb_const_get(mPsych, rb_intern("SyntaxError"));
     ^
```

https://github.com/ruby/psych/commit/aa457443b8
2019-07-25 07:52:19 +09:00
Jean Boussier 6ca7dc69ef [ruby/psych] Deduplicate hash keys if they're strings
https://github.com/ruby/psych/commit/0414982ffd
2019-07-25 07:52:16 +09:00
Hiroshi SHIBATA 50076903ab
[ruby/psych] Drop to support fat gem support.
ref. https://github.com/ruby/bigdecimal/pull/149

https://github.com/ruby/psych/commit/25ae263252
2019-07-25 07:50:37 +09:00
Hiroshi SHIBATA 938032a790
[ruby/psych] Do not use add_development_dependency.
https://github.com/ruby/psych/commit/939754237f
2019-07-25 07:47:07 +09:00
Jeremy Evans 9095ff53cf [ruby/date] Describe what is meant by valid in the Date.valid_date? rdoc
https://github.com/ruby/date/commit/8eca79d1f0
2019-07-22 17:36:20 +09:00
Nobuyoshi Nakada 8deabcd328
Constified afamily functions 2019-07-16 18:42:56 +09:00
Nobuyoshi Nakada 75fb0a9afa
Allow mday in Date.iso8601 to be omitted
[Bug #12285]
2019-07-16 09:41:23 +09:00
Koichi Sasada 223854ebe8 catch up e8ddbc0239. 2019-07-15 09:58:26 +09:00
Yusuke Endoh deb5e58230 ext/stringio/stringio.c (strio_read): "binray" is always zero here
Remove unused conditional expression to suppress Coverity Scan warnings.
2019-07-15 00:20:32 +09:00
Yusuke Endoh 80da68db1e Add a /* fall through */ comment 2019-07-14 23:36:23 +09:00
Tanaka Akira 4900a10689 socket: use frozen string buffer when releasing GVL
Thanks for the patch by normalperson (Eric Wong) [Bug #14204].
2019-07-14 20:46:51 +09:00
Nobuyoshi Nakada 715955ff27
Include ruby/assert.h in ruby/ruby.h so that assertions can be there 2019-07-14 17:58:03 +09:00
Nobuyoshi Nakada 32f0135144
Split RUBY_ASSERT and so on under include/ruby 2019-07-14 17:45:21 +09:00
Tanaka Akira 4d9504fe13 Delegates 3 arguments for Pathname.glob.
Thanks for the patch by pocke (Masataka Kuwabara) [Feature #14405].
2019-07-14 17:42:58 +09:00
Nobuyoshi Nakada dcb8c41a1e
Added depend files 2019-07-14 01:31:29 +09:00
Nobuyoshi Nakada 331eccf3fe
Removed useless `freeze`s from gemspec files 2019-07-13 07:25:54 +09:00
Nobuyoshi Nakada fd9f26df00
Drop fossil rubygems support 2019-07-13 07:25:54 +09:00
Nobuyoshi Nakada 143581cf4e
Removed stub lines from gemspec files 2019-07-13 07:25:51 +09:00
Nobuyoshi Nakada 1ee17782e1
Removed binary line 2019-07-13 06:09:33 +09:00
Nobuyoshi Nakada 8745fa2ff0
Default to true when no exception flag [Bug #15987] 2019-07-11 21:05:25 +09:00
Nobuyoshi Nakada f74e23af32
Fixed argument in the fallback function [Bug #15987] 2019-07-11 20:21:50 +09:00
Nobuyoshi Nakada c2723e59c2
Removed wrong argument in the fallback function [Bug #15987] 2019-07-11 20:20:02 +09:00
Nobuyoshi Nakada 3e7d002118
Check exception flag as a bool [Bug #15987] 2019-07-11 20:04:29 +09:00
Nobuyoshi Nakada 1d2ec4b216
Added Etc::VERSION 2019-07-10 12:33:29 +09:00
Nobuyoshi Nakada 612b7b6224
Removed unused files 2019-07-10 12:32:35 +09:00
Nobuyoshi Nakada cc936402eb
C90 for old versions 2019-07-10 03:02:01 +09:00