summaryrefslogtreecommitdiff
path: root/ext
AgeCommit message (Collapse)Author
2019-10-05ext/json/parser/parser.rl: Use "signed" char to contain negative valuesYusuke Endoh
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-05ext/json/parser/prereq.mk: Add a "automatically generated" headerYusuke Endoh
to parser.c.
2019-10-05ext/json/parser/parser.rl: Update the source code of parser.cYusuke Endoh
There have been some direct changes in parser.c which is automatically generated from parser.rl. This updates parser.rl to sync the changes: * 91793b8967e0531bd1159a8ff0cc7e50739c7620 * 79ead821dd4880725c9c6bb9645b3fad71715c5b * 80b5a0ff2a7709367178f29d4ebe1c54122b1c27
2019-10-03Revert 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-01ext/-test-/enumerator_kw/enumerator_kw.c: remove unused variableYusuke Endoh
2019-09-30Add rb_enumeratorize_with_size_kw and related macrosJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2509
2019-09-29Add three more C-API functions for handling keywordsJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2507
2019-09-30refactor 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. Notes: Merged: https://github.com/ruby/ruby/pull/2486
2019-09-29[ruby/stringio] Bump up the versionNobuyoshi Nakada
https://github.com/ruby/stringio/commit/f0e5027279
2019-09-29[ruby/stringio] Use rb_funcallv_kw when delegating argumentsNobuyoshi Nakada
https://github.com/ruby/stringio/commit/5892663e32
2019-09-29[ruby/stringio] Replaced rb_funcall2 with rb_funcallvNobuyoshi Nakada
https://github.com/ruby/stringio/commit/a37ab7c419
2019-09-29[ruby/stringio] Dropped older ruby versionsNobuyoshi Nakada
https://github.com/ruby/stringio/commit/e8065153b8
2019-09-29[ruby/stringio] Get rid of String#undump for ruby 2.4 or earlierNobuyoshi Nakada
https://github.com/ruby/stringio/commit/4dfd997e0a
2019-09-29[ruby/zlib] Fix for older ruby 2.6 or earlierNobuyoshi Nakada
https://github.com/ruby/zlib/commit/00ead8cb2c
2019-09-29[ruby/zlib] Search zlib.c as a gemNobuyoshi Nakada
https://github.com/ruby/zlib/commit/8f43b264cd
2019-09-26Fix more keyword separation issuesJeremy Evans
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 Notes: Merged: https://github.com/ruby/ruby/pull/2493
2019-09-26Honor Syslog::Logger#level overridesGeorge Claghorn
Notes: Merged: https://github.com/ruby/ruby/pull/2453
2019-09-26Fix more keyword argument separation issues in PathnameJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/2484
2019-09-26Fix keyword argument separation issues in ↵Jeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2484
2019-09-26[ruby/io-console] Defer creating VT query stringNobuyoshi Nakada
https://github.com/ruby/io-console/commit/3d69c577a4
2019-09-26[ruby/io-console] Added IO#console_modeNobuyoshi Nakada
https://github.com/ruby/io-console/commit/77ed8d5a06
2019-09-25Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans
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. Notes: Merged-By: jeremyevans <code@jeremyevans.net>
2019-09-25[DOC] fixed the return value of IO#ready? [ci skip]Nobuyoshi Nakada
IO#ready? returns true or false only, since r50262(1baa57b0033).
2019-09-25Do not use of non-standard escape character '\e'Kazuhiro NISHIYAMA
2019-09-24Changed numbered parameter prefixNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/2431
2019-09-24[ruby/io-console] Made cursor position 0-originNobuyoshi Nakada
https://github.com/ruby/io-console/commit/9377e37295
2019-09-24[ruby/io-console] Made cursor position consistent with `winsize`Nobuyoshi Nakada
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-23[ruby/io-console] Try fallback to stdout when stdinNobuyoshi Nakada
https://github.com/ruby/io-console/commit/b8017509ef
2019-09-23[ruby/io-console] Try to write DSR query to writable IONobuyoshi Nakada
https://github.com/ruby/io-console/commit/a54b6e4dd1
2019-09-21Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct typeJeremy Evans
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] Notes: Merged: https://github.com/ruby/ruby/pull/2473
2019-09-20Fix for explicit cast without RUBY_METHOD_FUNCNobuyoshi Nakada
2019-09-20Check various method defitions in C++Nobuyoshi Nakada
2019-09-20Get rid of embedding make command lineNobuyoshi Nakada
NMAKE sets MAKE to the full path name, which includes spaces by the default installation.
2019-09-20Fixed cxxanyargs/dependNobuyoshi Nakada
* Removed excess backslashes * Fixed the target name to try failure.cpp
2019-09-19Moved unmatch arity check to depend fileNobuyoshi Nakada
To substitute suffixes and VPATH for nmake.
2019-09-19Ensure that unmatched arity fails in C++Nobuyoshi Nakada
2019-09-19Revert "DEBUG: dump mkmf.log"Nobuyoshi Nakada
This reverts commit 69e209a3450bd6b281dcad1d96a34e9cab184845. The debug has finishted.
2019-09-19Removed mkmf.log dump in MakefileNobuyoshi Nakada
2019-09-19DEBUG: dump mkmf.logNobuyoshi Nakada
2019-09-19DEBUG: cxxanyargsNobuyoshi Nakada
2019-09-19DEBUG: cxxanyargsNobuyoshi Nakada
2019-09-19DEBUGNobuyoshi Nakada
2019-09-19Look up the language moduleNobuyoshi Nakada
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-19Removed unused keyword argument [ci skip]Nobuyoshi Nakada
2019-09-18[EXPERIMENTAL] MakeMakefile::CXX for C++Nobuyoshi Nakada
2019-09-17Pass keyword argument flag when rb_call_super_kw calls method_missingJeremy Evans
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. Notes: Merged: https://github.com/ruby/ruby/pull/2462
2019-09-14[ruby/io-console] Added `intr:` option to IO#rawNobuyoshi Nakada
Enters raw-mode but enable interrupts. https://github.com/ruby/io-console/commit/7cba76561a Notes: Merged: https://github.com/ruby/ruby/pull/2459
2019-09-10[ruby/io-console] Suppress yet another warning on WindowsNobuyoshi Nakada
https://github.com/ruby/io-console/commit/4e17c90788
2019-09-10[ruby/io-console] Suppress warnings on WindowsNobuyoshi Nakada
About unused variables and a function. https://github.com/ruby/io-console/commit/32baf54e7a
2019-09-10Support timeout for AddrinfoMasaki Matsushita
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 6382f5cc91ac9e36776bc854632d9a1237250da7. Test was failed on Solaris machines which don't have "http" in /etc/services. In this commit, use "ssh" instead.