aboutsummaryrefslogtreecommitdiffstats
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* ext/syslog/extconf.rb: add -llog for AndroidYusuke Endoh2019-10-101-0/+2
| | | | | | Otherwise, requiring syslog results in: cannot locate symbol "__android_log_print" referenced by "syslog.so"
* Prefer rb_gc_register_mark_objectNobuyoshi Nakada2019-10-101-1/+1
| | | | | | | * 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]
* Guard static variable firstNobuyoshi Nakada2019-10-101-1/+1
| | | | | | | * 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]
* Import changes from ruby/bigdecimal (#2531)Kenta Murata2019-10-089-77/+50
| | | Sync to ruby/bigdecimal@92356ba71c6bd325b0ab618c634a7aecf8cdc767
* ext/openssl/ossl_ssl.c: Use const declaration if LibreSSL >= 2.8.0Yusuke Endoh2019-10-051-1/+1
| | | | | | | | | | | | | | 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. ```
* ext/json/parser/prereq.mk: use `if $. == 1` instead of a hacky codeYusuke Endoh2019-10-051-1/+1
|
* ext/json/parser/prereq.mk: keep line numbers of ext/json/parser/parser.cYusuke Endoh2019-10-052-2/+1
| | | | | Follow up of 5717e55e9a7790c938afa694a9bf558c0e54bb83. Adding a header with newline broke linenos.
* ext/json/parser/parser.rl: Use "signed" char to contain negative valuesYusuke Endoh2019-10-052-4/+4
| | | | | | | | | | | | | 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; ^ ```
* ext/json/parser/prereq.mk: Add a "automatically generated" headerYusuke Endoh2019-10-052-1/+3
| | | | to parser.c.
* ext/json/parser/parser.rl: Update the source code of parser.cYusuke Endoh2019-10-051-1/+8
| | | | | | | | | 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
* Revert https://github.com/ruby/ruby/pull/2486卜部昌平2019-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* ext/-test-/enumerator_kw/enumerator_kw.c: remove unused variableYusuke Endoh2019-10-011-1/+1
|
* Add rb_enumeratorize_with_size_kw and related macrosJeremy Evans2019-09-303-0/+36
| | | | | | | | | | 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.
* Add three more C-API functions for handling keywordsJeremy Evans2019-09-291-2/+30
| | | | | | | | 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.
* refactor constify most of rb_method_entry_t卜部昌平2019-09-301-1/+1
| | | | | | | | | | | 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.
* [ruby/stringio] Bump up the versionNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/f0e5027279
* [ruby/stringio] Use rb_funcallv_kw when delegating argumentsNobuyoshi Nakada2019-09-291-2/+7
| | | | https://github.com/ruby/stringio/commit/5892663e32
* [ruby/stringio] Replaced rb_funcall2 with rb_funcallvNobuyoshi Nakada2019-09-291-4/+4
| | | | https://github.com/ruby/stringio/commit/a37ab7c419
* [ruby/stringio] Dropped older ruby versionsNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/e8065153b8
* [ruby/stringio] Get rid of String#undump for ruby 2.4 or earlierNobuyoshi Nakada2019-09-291-1/+1
| | | | https://github.com/ruby/stringio/commit/4dfd997e0a
* [ruby/zlib] Fix for older ruby 2.6 or earlierNobuyoshi Nakada2019-09-291-0/+9
| | | | https://github.com/ruby/zlib/commit/00ead8cb2c
* [ruby/zlib] Search zlib.c as a gemNobuyoshi Nakada2019-09-291-4/+11
| | | | https://github.com/ruby/zlib/commit/8f43b264cd
* Fix more keyword separation issuesJeremy Evans2019-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Honor Syslog::Logger#level overridesGeorge Claghorn2019-09-261-2/+2
|
* Fix more keyword argument separation issues in PathnameJeremy Evans2019-09-261-5/+5
|
* Fix keyword argument separation issues in ↵Jeremy Evans2019-09-261-4/+13
| | | | | | | | | 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.
* [ruby/io-console] Defer creating VT query stringNobuyoshi Nakada2019-09-261-9/+23
| | | | https://github.com/ruby/io-console/commit/3d69c577a4
* [ruby/io-console] Added IO#console_modeNobuyoshi Nakada2019-09-261-0/+122
| | | | https://github.com/ruby/io-console/commit/77ed8d5a06
* Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans2019-09-256-13/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [DOC] fixed the return value of IO#ready? [ci skip]Nobuyoshi Nakada2019-09-251-2/+1
| | | | IO#ready? returns true or false only, since r50262(1baa57b0033).
* Do not use of non-standard escape character '\e'Kazuhiro NISHIYAMA2019-09-251-1/+1
|
* Changed numbered parameter prefixNobuyoshi Nakada2019-09-241-3/+0
|
* [ruby/io-console] Made cursor position 0-originNobuyoshi Nakada2019-09-241-2/+7
| | | | https://github.com/ruby/io-console/commit/9377e37295
* [ruby/io-console] Made cursor position consistent with `winsize`Nobuyoshi Nakada2019-09-241-11/+9
| | | | | | | To be consistent with `winsize`, changed the cursor position format from `[x, y]` to `[row, column]`. https://github.com/ruby/io-console/commit/d1f5ae9286
* [ruby/io-console] Try fallback to stdout when stdinNobuyoshi Nakada2019-09-231-0/+4
| | | | https://github.com/ruby/io-console/commit/b8017509ef
* [ruby/io-console] Try to write DSR query to writable IONobuyoshi Nakada2019-09-231-2/+21
| | | | https://github.com/ruby/io-console/commit/a54b6e4dd1
* Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct typeJeremy Evans2019-09-212-0/+5
| | | | | | | | | | | | 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]
* Fix for explicit cast without RUBY_METHOD_FUNCNobuyoshi Nakada2019-09-201-0/+7
|
* Check various method defitions in C++Nobuyoshi Nakada2019-09-201-0/+44
|
* Get rid of embedding make command lineNobuyoshi Nakada2019-09-201-2/+3
| | | | | NMAKE sets MAKE to the full path name, which includes spaces by the default installation.
* Fixed cxxanyargs/dependNobuyoshi Nakada2019-09-201-4/+4
| | | | | * Removed excess backslashes * Fixed the target name to try failure.cpp
* Moved unmatch arity check to depend fileNobuyoshi Nakada2019-09-192-12/+9
| | | | To substitute suffixes and VPATH for nmake.
* Ensure that unmatched arity fails in C++Nobuyoshi Nakada2019-09-192-1/+27
|
* Revert "DEBUG: dump mkmf.log"Nobuyoshi Nakada2019-09-191-8/+0
| | | | | | This reverts commit 69e209a3450bd6b281dcad1d96a34e9cab184845. The debug has finishted.
* Removed mkmf.log dump in MakefileNobuyoshi Nakada2019-09-192-8/+5
|
* DEBUG: dump mkmf.logNobuyoshi Nakada2019-09-191-0/+6
|
* DEBUG: cxxanyargsNobuyoshi Nakada2019-09-191-0/+3
|
* DEBUG: cxxanyargsNobuyoshi Nakada2019-09-192-1/+2
|
* DEBUGNobuyoshi Nakada2019-09-191-0/+1
|
* Look up the language moduleNobuyoshi Nakada2019-09-191-1/+1
| | | | | | 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.