Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42efcf3

Browse files
maximecbjeremyevansmatzbotko1kirs
authored
Merge upstream Ruby (#25)
* Evaluate multiple assignment left hand side before right hand side In regular assignment, Ruby evaluates the left hand side before the right hand side. For example: ```ruby foo[0] = bar ``` Calls `foo`, then `bar`, then `[]=` on the result of `foo`. Previously, multiple assignment didn't work this way. If you did: ```ruby abc.def, foo[0] = bar, baz ``` Ruby would previously call `bar`, then `baz`, then `abc`, then `def=` on the result of `abc`, then `foo`, then `[]=` on the result of `foo`. This change makes multiple assignment similar to single assignment, changing the evaluation order of the above multiple assignment code to calling `abc`, then `foo`, then `bar`, then `baz`, then `def=` on the result of `abc`, then `[]=` on the result of `foo`. Implementing this is challenging with the stack-based virtual machine. We need to keep track of all of the left hand side attribute setter receivers and setter arguments, and then keep track of the stack level while handling the assignment processing, so we can issue the appropriate topn instructions to get the receiver. Here's an example of how the multiple assignment is executed, showing the stack and instructions: ``` self # putself abc # send abc, self # putself abc, foo # send abc, foo, 0 # putobject 0 abc, foo, 0, [bar, baz] # evaluate RHS abc, foo, 0, [bar, baz], baz, bar # expandarray abc, foo, 0, [bar, baz], baz, bar, abc # topn 5 abc, foo, 0, [bar, baz], baz, abc, bar # swap abc, foo, 0, [bar, baz], baz, def= # send abc, foo, 0, [bar, baz], baz # pop abc, foo, 0, [bar, baz], baz, foo # topn 3 abc, foo, 0, [bar, baz], baz, foo, 0 # topn 3 abc, foo, 0, [bar, baz], baz, foo, 0, baz # topn 2 abc, foo, 0, [bar, baz], baz, []= # send abc, foo, 0, [bar, baz], baz # pop abc, foo, 0, [bar, baz] # pop [bar, baz], foo, 0, [bar, baz] # setn 3 [bar, baz], foo, 0 # pop [bar, baz], foo # pop [bar, baz] # pop ``` As multiple assignment must deal with splats, post args, and any level of nesting, it gets quite a bit more complex than this in non-trivial cases. To handle this, struct masgn_state is added to keep track of the overall state of the mass assignment, which stores a linked list of struct masgn_attrasgn, one for each assigned attribute. This adds a new optimization that replaces a topn 1/pop instruction combination with a single swap instruction for multiple assignment to non-aref attributes. This new approach isn't compatible with one of the optimizations previously used, in the case where the multiple assignment return value was not needed, there was no lhs splat, and one of the left hand side used an attribute setter. This removes that optimization. Removing the optimization allowed for removing the POP_ELEMENT and adjust_stack functions. This adds a benchmark to measure how much slower multiple assignment is with the correct evaluation order. This benchmark shows: * 4-9% decrease for attribute sets * 14-23% decrease for array member sets * Basically same speed for local variable sets Importantly, it shows no significant difference between the popped (where return value of the multiple assignment is not needed) and !popped (where return value of the multiple assignment is needed) cases for attribute and array member sets. This indicates the previous optimization, which was dropped in the evaluation order fix and only affected the popped case, is not important to performance. Fixes [Bug ruby#4443] * * 2021-04-22 [ci skip] * Remove reverse VM instruction This was previously only used by the multiple assignment code, but is no longer needed after the multiple assignment execution order fix. * fix raise in exception with jump add_ensure_iseq() adds ensure block to the end of jump such as next/redo/return. However, if the rescue cause are in the body, this rescue catches the exception in ensure clause. iter do next rescue R ensure raise end In this case, R should not be executed, but executed without this patch. Fixes [Bug #13930] Fixes [Bug #16618] A part of tests are written by @jeremyevans ruby#4291 * [ruby/time] Make Time friendly to Ractor ruby/time@c784e4f166 * [ruby/cgi] handle invalid encoding ruby/cgi@2b1c2e21a4 * [ruby/cgi] Add test for escapeHTML/unescapeHTML invalid encoding fix in pure ruby version Also, remove pointless assert_nothing_raised(ArgumentError) while here. ruby/cgi@c05edf5608 * [ruby/cgi] gemspec: Explicitly empty executables list The gem exposes no executables ruby/cgi@cd7106ad97 * [ruby/benchmark] Add comment about terminating newline in captions; fix test method name. ruby/benchmark@02ce298d3e * [ruby/benchmark] gemspec: Explicitly have 0 executables This gem exposes no executables. ruby/benchmark@ff1ef7ae06 * Ignore JRuby files on io-console * [ruby/io-console] Enable building the C extension on TruffleRuby. ruby/io-console@c17b8cf3a9 * [ruby/io-console] Move FFI console under lib Having the separate dir makes testing difficult and doesn't reflect the structure the gem will eventually have. We can filter these files out if necessary when building the CRuby gem. ruby/io-console@881010447c * Separate test used by test_ractor for Ractor in test_time.rb * Merge net-imap-0.2.0 * [ruby/net-imap] Set timeout for IDLE responses Fixes #14 ruby/net-imap@39d39ff9bb * [ruby/net-imap] Bump version to 0.2.1 ruby/net-imap@31f96ea884 * [ruby/uri] Upstream Java proxy property checks from JRuby These Java properties, retrieved from JRuby's "Java env" ENV_JAVA, allow JRuby users to use the same proxy properties the rest of the Java platform uses. This resolves https://bugs.ruby-lang.org/issues/11194 ruby/uri@3bd2bcc95a * [ruby/uri] Optimize URI#hostname and URI#hostname= ruby/uri@3b7ccfd835 * [ruby/uri] Add tests for URI::RFC{2396,3986}_Parser#inspect ruby/uri@d47dae2f8e * [ruby/uri] Only use UnboundMethod#bind_call if it is available This allows tests to pass on Ruby 2.4-2.6. Fixes #19 ruby/uri@67ca99ca87 * [ruby/uri] Set required_ruby_version to 2.4 in gemspec Tests pass on Ruby 2.4, but not on Ruby 2.3. ruby/uri@594418079a * [ruby/uri] remove comment about URI::escape as it is removed ruby/uri@0f0057e1b2 * [ruby/uri] Use Regexp#match? to avoid extra allocations `#=~` builds `MatchData`, requiring extra allocations as compared to `#match?`, which returns a boolean w/o having to build the `MatchData`. ruby/uri@158f58a9cc * Update bundled_gems * Suppress warnings for unsued variable * * 2021-04-23 [ci skip] * Remove unneeded comment * test/ruby/test_assignment.rb: Avoid "assigned but unused variable" * Fix wrong documentation It doesn't return `nil` but raises an exception, as explained a few lines after * * 2021-04-24 [ci skip] * Fix setting method visibility for a refinement without an origin class If a class has been refined but does not have an origin class, there is a single method entry marked with VM_METHOD_TYPE_REFINED, but it contains the original method entry. If the original method entry is present, we shouldn't skip the method when searching even when skipping refined methods. Fixes [Bug #17519] * Remove unnecessary checks for empty kw splat These two checks are surrounded by an if that ensures the call site is not a kw splat call site. * Remove part of comment that is no longer accurate In Ruby 2.7, empty keyword splats could be added back for backwards compatibility. However, that stopped in Ruby 3.0. * Add back checks for empty kw splat with tests (ruby#4405) This reverts commit a224ce8. Turns out the checks are needed to handle splatting an array with an empty ruby2 keywords hash. * [Doc] Fix a typo s/invokations/invocations/ * * 2021-04-25 [ci skip] * [Doc] Fix a typo s/evel/eval/ * [Doc] Fix a typo s/oher/other/ * [Doc] Fix a typo s/visilibity/visibility/ * [Doc] Fix a typo s/arround/around/ * [Doc] Fix a typo s/daguten/dakuten/ * [ci skip] Fix a typo s/certificiate/certificate/ * [Doc] Fix a typo s/algorthm/algorithm/ * Fix some typos by spell checker * * 2021-04-26 [ci skip] * Remove test of removed reverse VM instruction since 5512353 * spec/ruby/core/file/shared/read.rb: The behavior of FreeBSD was changed http://rubyci.s3.amazonaws.com/freebsd12/ruby-master/log/20210426T003001Z.fail.html.gz#rubyspec * disable shareable_constant_value for CI To debug CI failures on FreeBSD, disable `shareable_constant_value`. * [ruby/irb] Fix typo ture -> true [ci skip] ruby/irb@783a0569e8 * [ruby/irb] Added assert_equal_with_term ruby/irb@b690da96d8 * [ruby/irb] Added test_colorize ruby/irb@10e290fc3a * [ruby/irb] Assertions on non-tty ruby/irb@ede12890d2 * [ruby/irb] Added `colorable` keyword option Currently `IRB::Color.colorize` and `IRB::Color.colorize_code` refer `$stdin.tty?` internally. This patch adds `colorable` keyword option which overrides it. ruby/irb@402e3f1907 * [ruby/irb] Added setup and teardown to TestIRB::TestInit Not to be affected by existing rc files in all tests. ruby/irb@bf434892b4 * node.c (rb_ast_new): imemo_ast is WB-unprotected Previously imemo_ast was handled as WB-protected which caused a segfault of the following code: # shareable_constant_value: literal M0 = {} M1 = {} ... M100000 = {} My analysis is here: `shareable_constant_value: literal` creates many Hash instances during parsing, and add them to node_buffer of imemo_ast. However, the contents are missed because imemo_ast is incorrectly WB-protected. This changeset makes imemo_ast as WB-unprotected. * Revert "disable shareable_constant_value for CI" This reverts commit c647205. Maybe the root issue was fixed by 7ac078e * Document binding behavior for C call/return events for TracePoint/set_trace_func C methods do not have bindings, so binding returns the binding of the nearest C method. Fixes [Bug ruby#9009] * * 2021-04-27 [ci skip] * Fix compiler warnings in objspace_dump.c when assertions are turned on Example: ``` In file included from ../../../include/ruby/defines.h:72, from ../../../include/ruby/ruby.h:23, from ../../../gc.h:3, from ../../../ext/objspace/objspace_dump.c:15: ../../../ext/objspace/objspace_dump.c: In function ‘dump_append_ld’: ../../../ext/objspace/objspace_dump.c:95:26: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘int’ [-Wsign-compare] 95 | RUBY_ASSERT(required <= width); | ^~ ``` * Fix type-o in insns.def "redefine" -> "redefined" * Partially revert 2c7d3b3 to make imemo_ast WB-protected again. Only the test is kept. * Make imemo_ast WB-protected again by firing the write barrier of imemo_ast after nd_lit is modified. This will fix the issue of ruby#4416 more gracefully. * test/ruby/test_exception.rb: suppress "warning: statement not reached" * [ruby/pathname] gemspec: Explicitly list 0 executables This gem exposes no executables. ruby/pathname@c401d97d58 * [ruby/gdbm] Add dependency to gdbm package on mingw RubyInstaller2 supports metadata tags for installation of dependent MSYS2/MINGW libraries. The openssl gem requires the mingw-openssl package to be installed on the system, which the gem installer takes care about, when this tag is set. The feature is documented here: https://github.com/oneclick/rubyinstaller2/wiki/For-gem-developers#msys2-library-dependency Fixes oneclick/rubyinstaller2#163 ruby/gdbm@d95eed3e86 * [ruby/matrix] Use Gemfile instead of Gem::Specification#add_development_dependency. ruby/matrix@1381fde5c1 * [ruby/matrix] v0.4.0 ruby/matrix@baea4b90d4 * [ruby/matrix] v0.4.1 ruby/matrix@f7c9981907 * [ruby/matrix] Guard for < Ruby 3.0 ruby/matrix@1ef660c627 * [ruby/net-ftp] Re-apply 827e471d438fdec1ae329afb5912b8e06d534823 ruby/net-ftp@3ca80368c4 * [ruby/net-ftp] Replace Timeout.timeout with socket timeout Timeout.timeout is inefficient since it spins up a new thread for each invocation, use Socket.tcp's connect_timeout option instead when we aren't using SOCKS (we can't replace Timeout.timeout for SOCKS yet since SOCKSSocket doesn't have a connect_timeout option). ruby/net-ftp@d65910132f * [ruby/net-ftp] Close the passive connection data socket if there is an error setting up the transfer Previously, the connection leaked in this case. This uses begin/ensure and checking for an error in the ensure block. An alternative approach would be to not even perform the connection until after the RETR (or other) command has been sent. However, I'm not sure all FTP servers support that. The current behavior is: * Send (PASV/EPSV) * Connect to the host/port returned in 227/229 reply * Send (RETR/other command) Changing it to connect after the RETR could break things. FTP servers might expect that the client has already connected before sending the RETR. The alternative approach is more likely to introduce backwards compatibility issues, compared to the begin/ensure approach taken here. Fixes Ruby Bug 17027 ruby/net-ftp@6e8535f076 * [ruby/net-ftp] Reduce resource cosumption of Net::FTP::TIME_PARSER Reported by Alexandr Savca as a DoS vulnerability, but Net::FTP is a client library and the impact of the issue is low, so I have decided to fix it as a normal issue. Based on patch by nobu. ruby/net-ftp@a93af636f8 * [ruby/net-ftp] Add test cases ruby/net-ftp@865232bb2a * [ruby/net-ftp] Replace "iff" with "if and only if" iff means if and only if, but readers without that knowledge might assume this to be a spelling mistake. To me, this seems like exclusionary language that is unnecessary. Simply using "if and only if" instead should suffice. ruby/net-ftp@e920473618 * lldb: Add Freelist Index to dump_page output * lldb: dump_page_rvalue - dump a heap page containing an RVALUE rather than having to do this in a two step process: 1. heap_page obj 2. dump_page $2 (or whatever lldb variable heap_page set) we can now just dump_page_rvalue obj * lldb: highlight the slot when using dump_page_rvalue * Fix Monitor to lock per Fiber, like Mutex [Bug #17827] * * 2021-04-28 [ci skip] * test/ruby/test_fiber.rb: reduce the count of object creation to cause GC ... on Solaris. This is the same as 5478871. http://rubyci.s3.amazonaws.com/solaris10-gcc/ruby-master/log/20210427T160003Z.fail.html.gz ``` [ 7667/20965] TestFiber#test_fork_from_fiber/export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:397:in `transfer': can't alloc machine stack to fiber (1 x 139264 bytes): Not enough space (FiberError) from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:397:in `block (6 levels) in test_fork_from_fiber' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:396:in `times' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:396:in `block (5 levels) in test_fork_from_fiber' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:392:in `fork' from /export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:392:in `block (4 levels) in test_fork_from_fiber' = 0.88 s ... 1) Failure: TestFiber#test_fork_from_fiber [/export/home/users/chkbuild/cb-gcc/tmp/build/20210427T160003Z/ruby/test/ruby/test_fiber.rb:409]: [ruby-core:41456]. <0> expected but was <1>. ``` * test/net/ftp/test_ftp.rb: remove unused variable * test/net/ftp/test_ftp.rb: reduce the size of a long response "9" * 999999999 (about 1 GB) was too large for some CI servers. This commit changes the size to 999999 (about 1 MB). http://rubyci.s3.amazonaws.com/scw-9d6766/ruby-master/log/20210427T141707Z.fail.html.gz http://rubyci.s3.amazonaws.com/raspbian10-aarch64/ruby-master/log/20210427T145408Z.fail.html.gz * test/net/ftp/test_ftp.rb: Use RubyVM::JIT instead of RubyVM::MJIT * [ruby/net-smtp] Net::SMTP.start() and #start() accepts ssl_context_params keyword argument Additional params are passed to OpenSSL::SSL::SSLContext#set_params. For example, `Net::SMTP#start(ssl_context_params: { cert_store: my_store, timeout: 123 })` calls `set_params({ cert_store: my_store, timeout: 123 })`. ruby/net-smtp@4213389c21 * [ruby/net-smtp] Replace Timeout.timeout with socket timeout Timeout.timeout is inefficient since it spins up a new thread for each invocation, use Socket.tcp's connect_timeout option instead ruby/net-smtp@6ae4a59f05 * [ruby/net-smtp] Removed needless files from Gem::Specification#files ruby/net-smtp@69bba6b125 * [ruby/net-smtp] mod: bump to a new VERSION that could be checked for testings >0.2.1 ruby/net-smtp@8f2c9323e2 * [ruby/net-http] Replace Timeout.timeout in Net:HTTP#connect Use Socket.tcp's connect_timeout option instead ruby/net-http@753cae3bbc * [ruby/net-http] Decode user and password from env configured proxy If someone sets an env variable defining a http_proxy, containing a username / password with percent-encoded characters, then the resulting base64 encoded auth header will be wrong. For example, suppose a username is `Y\X` and the password is `R%S] ?X`. Properly URL encoded the proxy url would be: http://Y%5CX:R%25S%5D%20%[email protected]:8000 The resulting proxy auth header should be: `WVxYOlIlU10gP1g=`, but the getters defined by ruby StdLib `URI` return a username `Y%5CX` and password `R%25S%5D%20%3FX`, resulting in `WSU1Q1g6UiUyNVMlNUQlMjAlM0ZY`. As a result the proxy will deny the request. Please note that this is my first contribution to the ruby ecosystem, to standard lib especially and I am not a ruby developer. References: - https://gitlab.com/gitlab-org/gitlab/-/issues/289836 - https://bugs.ruby-lang.org/projects/ruby-master/repository/trunk/revisions/58461 - https://bugs.ruby-lang.org/issues/17542 ruby/net-http@e57d4f38aa * [ruby/net-http] Fix the regexp used to clean the host Introduced in ruby@c1652035644 `/s` marks the regexp as encoded with Windows-31J which makes little sense. Nurse thinks the intent was to use `/m` for a multi-line regexp. ruby/net-http@6c15342cdf * [ruby/net-http] Initialize OpenSSL early before creating TCPSocket OpenSSL make take some time to initialize, and it would be best to take that time before connecting instead of after. From joshc on Redmine. Fixes Ruby Bug ruby#9459 ruby/net-http@14e09fba24 * [ruby/net-imap] Fix typo intentionaly -> intentionally [ci skip] ruby/net-imap@4057c662e7 * [ruby/optparse] Add EditorConfig file More info here: https://editorconfig.org/ For example, `ruby/ruby` has it: https://github.com/ruby/ruby/blob/05ebaee/.editorconfig Also fix some offenses. ruby/optparse@29402e7e0e * [ruby/ostruct] Compatibility with Ruby 2.5 ruby/ostruct@ecd9fafdf8 * [ruby/ostruct] Add compatibility for to_h with block in Ruby 2.5 ruby/ostruct@da45de5068 * Guard for < Ruby 3.0 * NDEBUG is ignored since Ruby 3.0 * Removed unused macro HAVE_CONFIG_H It seems like a vestige of ext/md5. * Specify -c to emit pch with clang (ruby#4423) [Bug #17836] * * 2021-04-29 [ci skip] * test/net/smtp/test_smtp.rb: wait a moment before socket is closed On Solaris, Socket.tcp seems to fail with EINVAL if the server closes the connection immediately after accpeted. I think this is a bug of Socket.tcp, but seems difficult to fix soon. http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210429T100007Z.fail.html.gz ``` 1) Failure: Net::TestSMTP#test_eof_error_backtrace [/export/home/chkbuild/chkbuild-sunc/tmp/build/20210429T100007Z/ruby/test/net/smtp/test_smtp.rb:193]: [ruby-core:78550] [Bug ruby#13018]. [EOFError] exception expected, not #<Net::ReadTimeout: Net::ReadTimeout>. ``` * * 2021-04-30 [ci skip] * lldb: Warn when attempting to dump invalid pages * Update Time documentation * [ruby/irb] Need reline >= 0.1.6 irb 1.3.5 need reline >= 0.1.6 because irb use `Reline::IOGate.in_pasting?`. This method defined after reline 0.1.6. fix #228. ruby/irb@6b7b8fc324 * Silence GCC 11 warnings ``` ../strftime.c: In function 'rb_strftime_with_timespec': ../strftime.c:392:39: warning: comparison is always false due to limited range of data type [-Wtype-limits] 392 | if (vtm->wday < 0 || vtm->wday > 6) | ^ ../strftime.c:403:39: warning: comparison is always false due to limited range of data type [-Wtype-limits] 403 | if (vtm->wday < 0 || vtm->wday > 6) | ^ ``` * Correct documentation example on Hash#dig Fixes [Misc #17842]. The current documentation suggests that: {foo: {bar: {baz: 2}}}.dig(:foo, :bar) # => {:bar=>{:baz=>2}} when it should be: {foo: {bar: {baz: 2}}}.dig(:foo, :bar) # => {:baz=>2} * * 2021-05-01 [ci skip] * Fix example for custom warn method Regexp has a match? method. [ci skip] * Adjust struct member offset for i386 Cygwin Fixes [Bug #17606] * Get rid of misleading indentation * * 2021-05-03 [ci skip] * Workaround failures on Windows * * 2021-05-04 [ci skip] * Eagerly allocate instance variable tables along with object This allows us to allocate the right size for the object in advance, meaning that we don't have to pay the cost of ivar table extension later. The idea is that if an object type ever became "extended" at some point, then it is very likely it will become extended again. So we may as well allocate the ivar table up front. * Fix test/net/http/test_https.rb host naming for Windows * spec/ruby/library/net/http/http/fixtures/http_server.rb host naming for Windows * Suppress maybe-uninitialized warning by mingw gcc 11 * test/net/imap/test_imap.rb: wait a moment before socket is closed to try to suppress a failure on Solaris. This is the same as 19504d1 http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20210504T070007Z.fail.html.gz ``` 1) Error: IMAPTest#test_idle_done_not_during_idle: Errno::EINVAL: Invalid argument - connect(2) for [::1]:33839 /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:1214:in `__connect_nonblock' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:1214:in `connect_nonblock' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:56:in `connect_internal' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:137:in `connect' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:642:in `block in tcp' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:227:in `each' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:227:in `foreach' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/.ext/common/socket.rb:632:in `tcp' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/lib/net/imap.rb:1223:in `tcp_socket' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/lib/net/imap.rb:1180:in `initialize' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/test/net/imap/test_imap.rb:289:in `new' /export/home/chkbuild/chkbuild-sunc/tmp/build/20210504T070007Z/ruby/test/net/imap/test_imap.rb:289:in `test_idle_done_not_during_idle' ``` * Add -Werror=undef to default warnflags for core * See [Feature #17752] * For external extensions it's transformed to just warn and not error (-Wundef) like other other -Werror in warnflags. * vm_dump.c: rename HAVE_BACKTRACE to USE_BACKTRACE * HAVE_ macros should only be defined or undefined, not used for their value. * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <[email protected]> * Fix -Wundef warnings in coroutine/*/Context.h * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <[email protected]> * Fix trivial -Wundef warnings * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <[email protected]> * Add RBIMPL_RVALUE_EMBED_LEN_MAX neeeded by internal/bignum.h * It evaluated to 0 before, revealed by -Wundef * See [Feature #17752] Co-authored-by: xtkoba (Tee KOBAYASHI) <[email protected]> * Fix -Wundef warnings in core extensions * See [Feature #17752] * Fix -Wundef warnings for HAVE_RB_EXT_RACTOR_SAFE * See [Feature #17752] * Fix -Wundef warnings for patterns `#if HAVE` * See [Feature #17752] * Using this to detect them: git grep -P 'if\s+HAVE' | grep -Pv 'HAVE_LONG_LONG|/ChangeLog|HAVE_TYPEOF' * HAVE_* macros should not be defined with value 0 * See [Feature #17752] * Fix -Wundef warnings for RBIMPL_HAS_BUILTIN * See [Feature #17752] * Defining explicitly to 0 seems the best solution, see ruby#4428 * For example: ./include/ruby/internal/has/builtin.h:49:33: error: "RBIMPL_HAS_BUILTIN___builtin_assume" is not defined, evaluates to 0 [-Werror=undef] 49 | # define RBIMPL_HAS_BUILTIN(_) (RBIMPL_HAS_BUILTIN_ ## _) | ^~~~~~~~~~~~~~~~~~~ ./include/ruby/internal/assume.h:75:7: note: in expansion of macro ‘RBIMPL_HAS_BUILTIN’ 75 | #elif RBIMPL_HAS_BUILTIN(__builtin_assume) | ^~~~~~~~~~~~~~~~~~ * Correctly update array capacity after realloc Reallocating to a smaller size in the transient heap may result in no change in the actual capacity but the capacity of the array is still updated to the smaller value. This commit changes `ary_heap_realloc` to return the new capacity which can be used by the caller to correctly update the capacity. * * 2021-05-05 [ci skip] * Fix documentation for IO#unget{byte,c} Fixes [Bug #14400] * What's Here for class IO (ruby#4440) * What's Here for class IO * test/net/ftp/test_ftp.rb - fix intermittent MinGW failure Fixes intermittent error as below: [242/838] 5316=test_ftp #<Thread:0x0000020aa8733f20 D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2532 run> terminated with exception (report_on_exception is true): D:/a/ruby/ruby/src/tool/lib/minitest/unit.rb:199:in `assert': Expected #<Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.> to be nil. (MiniTest::Assertion) from D:/a/ruby/ruby/src/tool/lib/test/unit/core_assertions.rb:504:in `assert' from D:/a/ruby/ruby/src/tool/lib/minitest/unit.rb:299:in `assert_nil' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:430:in `ensure in block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:431:in `block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2539:in `block in create_ftp_server' D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `write': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET) from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `print' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:426:in `block (2 levels) in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `each' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `each_with_index' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:420:in `block in test_list_read_timeout_exceeded' from D:/a/ruby/ruby/src/test/net/ftp/test_ftp.rb:2539:in `block in create_ftp_server' * Fix compilation errors for c99 ENUM_OVER_INT is sometimes not defined. Use #ifdef instead if #if. * Fix compilation error in mingw __LITTLE_ENDIAN is not defined. * Fix compilation errors in FreeBSD __FreeBSD_version is defined in sys/param.h. * Fix compilation error in thread_win32.c USE_WIN32_MUTEX flag may not be defined. * `_MSC_VER` may not be defined * Workaround for gcc-4 bug False positive `-Wundef` in `#elif` after `#if defined`. * configure.ac: check if __builtin_expect is available or not include/ruby/internal/has/builtin.h uses HAVE_BUILTIN___BUILTIN_EXPECT for icc but previously it was not defined. This is a follow up of 8b32de2 and this will fix the following failures: http://rubyci.s3.amazonaws.com/icc-x64/ruby-master/log/20210505T030003Z.fail.html.gz ``` 1) Failure: TestMkmf::TestConvertible#test_typeof_builtin [/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/test/mkmf/test_convertible.rb:9]: convertible_int: checking for convertible type of short... -------------------- short -------------------- convertible_int: checking for convertible type of int... -------------------- int -------------------- convertible_int: checking for convertible type of long... -------------------- long -------------------- convertible_int: checking for convertible type of signed short... -------------------- failed "icc -std=gnu99 -o conftest -I. -I/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/.ext/include/x86_64-linux -I/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/include -I./test -O3 -ggdb -Wall -Wextra -Wdeprecated-declarations -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-unused-parameter -Wunused-variable -diag-disable=175,188,1684,2259,2312 -Wextra-tokens -Wundef conftest.c -L. -L/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby -Wl,-rpath,/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/lib -L/home/chkbuild/chkbuild/tmp/build/20210505T030003Z/lib -lruby-static -lz -lpthread -lrt -lrt -ldl -lcrypt -lm -lm -lc" In file included from /home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/include/ruby/defines.h(72), from /home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/include/ruby/ruby.h(23), from /home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/include/ruby.h(39), from conftest.c(1): /home/chkbuild/chkbuild/tmp/build/20210505T030003Z/ruby/include/ruby/backward/2/assume.h(34): warning #193: zero used for undefined preprocessing identifier "HAVE_BUILTIN___BUILTIN_EXPECT" #if RBIMPL_HAS_BUILTIN(__builtin_expect) ... ``` * Fix compilation on M1 Mac As PAGE_SIZE may not be a preprocessor constant, dispatch at runtime in that case. * * 2021-05-06 [ci skip] * PAGE_SIZE is used only when mmap is available * Fix PAGE_SIZE macro detection in autoconf The current fix for PAGE_SIZE macro detection in autoconf does not work correctly. I see the following output with running configure on Linux: ``` checking PAGE_SIZE is defined... no ``` Linux has PAGE_SIZE macro. This is happening because the macro exists in sys/user.h and not in the malloc headers. * Fall back to sysconf to determine page size during runtime On some platforms the PAGE_SIZE macro does not exist so we can fall back to `sysconf` to determine the page size at runtime. * Get rid of including sys/user.h on macOS LIST_HEAD in ccan/list conflicts with sys/queue.h. ``` ./ccan/list/list.h:75:9: warning: 'LIST_HEAD' macro redefined [-Wmacro-redefined] ^ /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/queue.h:465:9: note: previous definition is here ^ ``` * Check only whether PAGE_SIZE is compile-time const * Revised PAGE_MAX_SIZE case * Reuse sysconf result * [ruby/erb] Document that `<% #` doesn't work [Bug #17846] ruby/erb@b58b188 * [ruby/net-imap] Move each authenticator to its own file Also updates rdoc with SASL specifications and deprecations. Of these four, only `PLAIN` isn't deprecated! +@@Authenticators+ was changed to a class instance var +@Authenticators+. No one should have been using the class variable directly, so that should be fine. ruby/net-imap@23f241b081 * [ruby/net-imap] Update AUTH=PLAIN to be a little closer to RFC4616 * Add authzid support * must not contain NULL chars * improve rdoc ruby/net-imap@a587fc71b7 * [ruby/net-imap] Clean up authenticators rdoc Added RFC links to all SASL mechanism specifications. ruby/net-imap@53ff4b0c09 * [ruby/net-imap] move ResponseParser to lib/net/imap/response_parser Partially implements #10. ruby/net-imap@c2408aac9a * [ruby/net-imap] move response data structs to net/imap/response_data Partially implements #10. ruby/net-imap@746757b936 * [ruby/net-imap] move command data formatters to net/imap/command_data Partially implements #10. ruby/net-imap@24e929fdd2 * [ruby/net-imap] Move UTF7 & datetime formatting to net/imap/data_encoding Partially implements #10. ruby/net-imap@0d43c5e856 * [ruby/net-imap] Move flags to net/imap/flags Partially implements #10. ruby/net-imap@2a9afa83bf * [ruby/net-imap] Move send_*_data into net/imap/command_data Partially implements #10. ruby/net-imap@64d1080d63 * [ruby/net-imap] Many documentation improvements * updated obsoleted RFCs to current versions * linked most references to their RFCs * linked extension commands to their RFCs * removed unidiomatic `()` from instance method links * escaped `IMAP` in a few places * converted all response structs to explicit classes: this makes much nicer rdoc output than listing them all under "constants" * grouped flags constants into their own sections ruby/net-imap@9cd562ac84 * Move net-imap.gemspec to under the lib/net/imap directory. * Fixed the file path for net-imap.gemspec * [ruby/net-http] Do not require stringio It is not used in net/http library code since commit 15ccd0118c13 (r36473 in ruby svn trunk, 2012). require's in test suite are also cleaned up. ruby/net-http@996d18a43f * Import from ruby/strscan#19 * Use Gemfile instead of Gem::Specification#add_development_dependency. * Use pend instead of skip for test-unit. * [ruby/strscan] Fix segmentation fault of `StringScanner#charpos` when `String#byteslice` returns non string value [Bug #17756] (#20) ruby/strscan@92961cde2b * [ruby/strscan] Replace "iff" with "if and only if" (#18) iff means if and only if, but readers without that knowledge might assume this to be a spelling mistake. To me, this seems like exclusionary language that is unnecessary. Simply using "if and only if" instead should suffice. ruby/strscan@066451c11e * [ruby/timeout] Make Timeout::Error#exception with multiple arguments not ignore arguments This makes: raise(Timeout::Error.new("hello"), "world") raise a TimeoutError instance with "world" as the message instead of "hello", for consistency with other Ruby exception classes. This required some internal changes to keep the tests passing. Fixes [Bug #17812] ruby/timeout@952154dbf9 * [ruby/timeout] Avoid unnecessary object allocation Idea from nobu. ruby/timeout@aecdaa23b3 * [ruby/timeout] Only run timeout_after hook on fiber scheduler if scheduler exists ruby/timeout@4893cde0ed * Use assert_ractor for separating test processes * net-http no longer requires stringio * Allow newobj_of0 and newobj_slowpath to allocate into multiple heap slots * Store rb_classext_t next to RClass slots on the heap * lldb: teach rp about T_PAYLOAD * Fix preprocessor warning/error * Try to fix #if issue in vm.inc.erb Co-authored-by: Jeremy Evans <[email protected]> Co-authored-by: git <[email protected]> Co-authored-by: Koichi Sasada <[email protected]> Co-authored-by: Kir Shatrov <[email protected]> Co-authored-by: pavel <[email protected]> Co-authored-by: Olle Jonsson <[email protected]> Co-authored-by: Keith Bennett <[email protected]> Co-authored-by: Hiroshi SHIBATA <[email protected]> Co-authored-by: Duncan MacGregor <[email protected]> Co-authored-by: Charles Oliver Nutter <[email protected]> Co-authored-by: Shugo Maeda <[email protected]> Co-authored-by: Lukas Zapletal <[email protected]> Co-authored-by: Felix Wong <[email protected]> Co-authored-by: Steven Harman <[email protected]> Co-authored-by: Kazuhiro NISHIYAMA <[email protected]> Co-authored-by: S-H-GAMELINKS <[email protected]> Co-authored-by: Yusuke Endoh <[email protected]> Co-authored-by: romainsalles <[email protected]> Co-authored-by: Alan Wu <[email protected]> Co-authored-by: wonda-tea-coffee <[email protected]> Co-authored-by: wonda-tea-coffee <[email protected]> Co-authored-by: Ryuta Kamizono <[email protected]> Co-authored-by: Nobuyoshi Nakada <[email protected]> Co-authored-by: Peter Zhu <[email protected]> Co-authored-by: ebrohman <[email protected]> Co-authored-by: Lars Kanis <[email protected]> Co-authored-by: Marc-Andre Lafortune <[email protected]> Co-authored-by: mohamed <[email protected]> Co-authored-by: Gannon McGibbon <[email protected]> Co-authored-by: Matt Valentine-House <[email protected]> Co-authored-by: Benoit Daloze <[email protected]> Co-authored-by: Tom Freudenberg <[email protected]> Co-authored-by: Lukas Eipert <[email protected]> Co-authored-by: Jean Boussier <[email protected]> Co-authored-by: Alexander Popov <[email protected]> Co-authored-by: Takashi Kokubun <[email protected]> Co-authored-by: Burdette Lamar <[email protected]> Co-authored-by: ima1zumi <[email protected]> Co-authored-by: xtkoba <[email protected]> Co-authored-by: Nick Kelley <[email protected]> Co-authored-by: Adam Daniels <[email protected]> Co-authored-by: Aaron Patterson <[email protected]> Co-authored-by: MSP-Greg <[email protected]> Co-authored-by: xtkoba (Tee KOBAYASHI) <[email protected]> Co-authored-by: nicholas a. evans <[email protected]> Co-authored-by: Kazuki Yamaguchi <[email protected]> Co-authored-by: Kenichi Kamiya <[email protected]>
1 parent 862ddf9 commit 42efcf3

File tree

114 files changed

+4349
-3207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4349
-3207
lines changed

array.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,16 @@ ary_heap_free(VALUE ary)
354354
}
355355
}
356356

357-
static void
357+
static size_t
358358
ary_heap_realloc(VALUE ary, size_t new_capa)
359359
{
360+
size_t alloc_capa = new_capa;
360361
size_t old_capa = ARY_HEAP_CAPA(ary);
361362

362363
if (RARRAY_TRANSIENT_P(ary)) {
363364
if (new_capa <= old_capa) {
364365
/* do nothing */
366+
alloc_capa = old_capa;
365367
}
366368
else {
367369
VALUE *new_ptr = rb_transient_heap_alloc(ary, sizeof(VALUE) * new_capa);
@@ -379,6 +381,8 @@ ary_heap_realloc(VALUE ary, size_t new_capa)
379381
SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, new_capa, old_capa);
380382
}
381383
ary_verify(ary);
384+
385+
return alloc_capa;
382386
}
383387

384388
#if USE_TRANSIENT_HEAP
@@ -443,6 +447,7 @@ ary_resize_capa(VALUE ary, long capacity)
443447
assert(!ARY_SHARED_P(ary));
444448

445449
if (capacity > RARRAY_EMBED_LEN_MAX) {
450+
size_t new_capa = capacity;
446451
if (ARY_EMBED_P(ary)) {
447452
long len = ARY_EMBED_LEN(ary);
448453
VALUE *ptr = ary_heap_alloc(ary, capacity);
@@ -453,9 +458,9 @@ ary_resize_capa(VALUE ary, long capacity)
453458
ARY_SET_HEAP_LEN(ary, len);
454459
}
455460
else {
456-
ary_heap_realloc(ary, capacity);
461+
new_capa = ary_heap_realloc(ary, capacity);
457462
}
458-
ARY_SET_CAPA(ary, capacity);
463+
ARY_SET_CAPA(ary, new_capa);
459464
}
460465
else {
461466
if (!ARY_EMBED_P(ary)) {
@@ -2267,8 +2272,8 @@ rb_ary_resize(VALUE ary, long len)
22672272
}
22682273
else {
22692274
if (olen > len + ARY_DEFAULT_SIZE) {
2270-
ary_heap_realloc(ary, len);
2271-
ARY_SET_CAPA(ary, len);
2275+
size_t new_capa = ary_heap_realloc(ary, len);
2276+
ARY_SET_CAPA(ary, new_capa);
22722277
}
22732278
ARY_SET_HEAP_LEN(ary, len);
22742279
}

benchmark/ivar_extend.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
prelude: |
2+
class Embedded
3+
def initialize
4+
@a = 1
5+
@b = 1
6+
@c = 1
7+
end
8+
end
9+
10+
class Extended
11+
def initialize
12+
@a = 1
13+
@b = 1
14+
@c = 1
15+
@d = 1
16+
@e = 1
17+
@f = 1
18+
end
19+
end
20+
benchmark:
21+
embedded: Embedded.new
22+
extended: Extended.new
23+
loop_count: 20_000_000

builtin.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include "iseq.h"
44
#include "builtin.h"
55

6-
#if CROSS_COMPILING
6+
#ifdef CROSS_COMPILING
77

88
#define INCLUDED_BY_BUILTIN_C 1
99
#include "mini_builtin.c"

builtin.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PUREFUNC(static inline VALUE rb_vm_lvar(rb_execution_context_t *ec, int index));
6565
static inline VALUE
6666
rb_vm_lvar(rb_execution_context_t *ec, int index)
6767
{
68-
#if VM_CORE_H_EC_DEFINED
68+
#if defined(VM_CORE_H_EC_DEFINED) && VM_CORE_H_EC_DEFINED
6969
return ec->cfp->ep[index];
7070
#else
7171
return rb_vm_lvar_exposed(ec, index);

class.c

+14-1
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,21 @@ rb_class_detach_module_subclasses(VALUE klass)
173173
static VALUE
174174
class_alloc(VALUE flags, VALUE klass)
175175
{
176-
NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0));
176+
size_t payload_size = 0;
177+
178+
#if USE_RVARGC
179+
payload_size = sizeof(rb_classext_t);
180+
#endif
181+
182+
RVARGC_NEWOBJ_OF(obj, struct RClass, klass, (flags & T_MASK) | FL_PROMOTED1 /* start from age == 2 */ | (RGENGC_WB_PROTECTED_CLASS ? FL_WB_PROTECTED : 0), payload_size);
183+
184+
#if USE_RVARGC
185+
obj->ptr = (rb_classext_t *)rb_rvargc_payload_data_ptr((VALUE)obj + rb_slot_size());
186+
RB_OBJ_WRITTEN(obj, Qundef, (VALUE)obj + rb_slot_size());
187+
#else
177188
obj->ptr = ZALLOC(rb_classext_t);
189+
#endif
190+
178191
/* ZALLOC
179192
RCLASS_IV_TBL(obj) = 0;
180193
RCLASS_CONST_TBL(obj) = 0;

configure.ac

+31
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,18 @@ AS_CASE(["$GCC:${warnflags+set}:${extra_warnflags:+set}:"],
662662
])
663663
])
664664
done
665+
AS_IF([test "$particular_werror_flags" = "yes"], [
666+
wflag=-Werror=undef
667+
], [
668+
wflag=-Wundef
669+
])
670+
RUBY_TRY_CFLAGS($wflag, [
671+
RUBY_APPEND_OPTIONS(warnflags, $wflag)
672+
], [], [
673+
@%:@if !defined(RUBY_CONFIG_TEST_NEVER_DEFINED_SYMBOL)
674+
@%:@elif RUBY_CONFIG_TEST_NEVER_DEFINED_SYMBOL
675+
@%:@endif
676+
])
665677
AS_CASE([" $warnflags "],[*" -Wno-missing-field-initializers "*], [wflag="-Wall -Wextra"],
666678
[wflag=-Wall])
667679
RUBY_TRY_CFLAGS($wflag, [warnflags="$wflag${warnflags+ $warnflags}"])
@@ -2115,6 +2127,7 @@ AS_IF([test x$rb_cv_builtin___builtin_choose_expr = xyes], [
21152127
])
21162128
RUBY_CHECK_BUILTIN_FUNC(__builtin_types_compatible_p, [__builtin_types_compatible_p(int, int)])
21172129
RUBY_CHECK_BUILTIN_FUNC(__builtin_trap, [__builtin_trap()])
2130+
RUBY_CHECK_BUILTIN_FUNC(__builtin_expect, [__builtin_expect(0, 0)])
21182131

21192132
AS_IF([test "$ac_cv_func_qsort_r" != no], [
21202133
AC_CACHE_CHECK(whether qsort_r is GNU version, rb_cv_gnu_qsort_r,
@@ -2722,6 +2735,24 @@ main(int argc, char *argv[])
27222735
rb_cv_fork_with_pthread=yes)])
27232736
test x$rb_cv_fork_with_pthread = xyes || AC_DEFINE(CANNOT_FORK_WITH_PTHREAD)
27242737
])
2738+
2739+
AS_CASE([$target_os],
2740+
[darwin*], [ac_cv_header_sys_user_h=yes], dnl LIST_HEAD conflicts with sys/queue.h
2741+
[AC_CHECK_HEADERS([sys/user.h])]
2742+
)
2743+
AS_IF([test "x$ac_cv_func_mmap:$ac_cv_header_sys_user_h" = xyes:yes], [
2744+
AC_CACHE_CHECK([whether PAGE_SIZE is compile-time const], rb_cv_const_page_size,
2745+
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2746+
@%:@include <sys/user.h>
2747+
typedef char conftest_page[PAGE_SIZE];
2748+
]], [[]])],
2749+
[rb_cv_const_page_size=yes],
2750+
[rb_cv_const_page_size=no])])
2751+
])
2752+
AS_IF([test "x$rb_cv_const_page_size" = xyes],
2753+
[AC_DEFINE(HAVE_CONST_PAGE_SIZE, 1)],
2754+
[AC_DEFINE(HAVE_CONST_PAGE_SIZE, 0)]
2755+
)
27252756
}
27262757

27272758
: "runtime section" && {

coroutine/copy/Context.h

+3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323

2424
#define COROUTINE __attribute__((noreturn)) void
2525

26+
#ifdef HAVE_STDINT_H
27+
#include <stdint.h>
2628
#if INTPTR_MAX <= INT32_MAX
2729
#define COROUTINE_LIMITED_ADDRESS_SPACE
2830
#endif
31+
#endif
2932

3033
// This stack copying implementation which uses a private stack for each coroutine, including the main one.
3134
#define COROUTINE_PRIVATE_STACK

coroutine/ucontext/Context.h

+3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616

1717
#define COROUTINE __attribute__((noreturn)) void
1818

19+
#ifdef HAVE_STDINT_H
20+
#include <stdint.h>
1921
#if INTPTR_MAX <= INT32_MAX
2022
#define COROUTINE_LIMITED_ADDRESS_SPACE
2123
#endif
24+
#endif
2225

2326
struct coroutine_context
2427
{

dir.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
# define dirent direct
5151
# define NAMLEN(dirent) (dirent)->d_namlen
5252
# define HAVE_DIRENT_NAMLEN 1
53-
# if HAVE_SYS_NDIR_H
53+
# ifdef HAVE_SYS_NDIR_H
5454
# include <sys/ndir.h>
5555
# endif
56-
# if HAVE_SYS_DIR_H
56+
# ifdef HAVE_SYS_DIR_H
5757
# include <sys/dir.h>
5858
# endif
59-
# if HAVE_NDIR_H
59+
# ifdef HAVE_NDIR_H
6060
# include <ndir.h>
6161
# endif
6262
# ifdef _WIN32
@@ -216,7 +216,7 @@ typedef enum {
216216
#else
217217
#define FNM_SYSCASE 0
218218
#endif
219-
#if _WIN32
219+
#ifdef _WIN32
220220
#define FNM_SHORTNAME 0x20
221221
#else
222222
#define FNM_SHORTNAME 0

doc/time/in.rdoc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- <tt>in: zone</tt>: a timezone _zone_, which may be:
2+
- A string offset from UTC.
3+
- A single letter offset from UTC, in the range <tt>'A'..'Z'</tt>,
4+
<tt>'J'</tt> (the so-called military timezone) excluded.
5+
- An integer number of seconds.
6+
- A timezone object;
7+
see {Timezone Argument}[#class-Time-label-Timezone+Argument] for details.

doc/time/mon-min.rdoc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- +month+: a month value, which may be:
2+
- An integer month in the range <tt>1..12</tt>.
3+
- A 3-character string that matches regular expression
4+
<tt>/jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec/i</tt>.
5+
- +day+: an integer day in the range <tt>1..31</tt>
6+
(less than 31 for some months).
7+
- +hour+: an integer hour in the range <tt>0..23</tt>.
8+
- +min+: an integer minute in the range <tt>0..59</tt>.

doc/time/msec.rdoc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- +msec+ is the number of milliseconds (Integer, Float, or Rational)
2+
in the range <tt>0..1000</tt>.

doc/time/nsec.rdoc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- +nsec+ is the number of nanoseconds (Integer, Float, or Rational)
2+
in the range <tt>0..1000000000</tt>.

doc/time/sec.rdoc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- +sec+ is the number of seconds (Integer, Float, or Rational)
2+
in the range <tt>0..60</tt>.

doc/time/sec_i.rdoc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- +isec_i+ is the integer number of seconds in the range <tt>0..60</tt>.

doc/time/usec.rdoc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- +usec+ is the number of microseconds (Integer, Float, or Rational)
2+
in the range <tt>0..1000000</tt>.

doc/time/year.rdoc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- +year+: an integer year.

error.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ rb_warning_s_warn(int argc, VALUE *argv, VALUE mod)
293293
* Example:
294294
* module MyWarningFilter
295295
* def warn(message, category: nil, **kwargs)
296-
* if /some warning I want to ignore/.matches?(message)
296+
* if /some warning I want to ignore/.match?(message)
297297
* # ignore
298298
* else
299299
* super

eval_intern.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ LONG WINAPI rb_w32_stack_overflow_handler(struct _EXCEPTION_POINTERS *);
144144

145145
#define EC_REPUSH_TAG() (void)(_ec->tag = &_tag)
146146

147-
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || __clang__
147+
#if defined __GNUC__ && __GNUC__ == 4 && (__GNUC_MINOR__ >= 6 && __GNUC_MINOR__ <= 8) || defined __clang__
148148
/* This macro prevents GCC 4.6--4.8 from emitting maybe-uninitialized warnings.
149149
* This macro also prevents Clang from dumping core in EC_EXEC_TAG().
150150
* (I confirmed Clang 4.0.1 and 5.0.0.)

ext/bigdecimal/missing.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern "C" {
4545
# if __has_builtin(__builtin_unreachable)
4646
# define UNREACHABLE __builtin_unreachable()
4747

48-
# elif HAVE___ASSUME
48+
# elif defined(HAVE___ASSUME)
4949
# define UNREACHABLE __assume(0)
5050

5151
# else

ext/cgi/escape/escape.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ cgiesc_unescape(int argc, VALUE *argv, VALUE self)
388388
void
389389
Init_escape(void)
390390
{
391-
#if HAVE_RB_EXT_RACTOR_SAFE
391+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
392392
rb_ext_ractor_safe(true);
393393
#endif
394394

ext/digest/bubblebabble/extconf.rb

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# frozen_string_literal: false
22
require 'mkmf'
33

4-
$defs << "-DHAVE_CONFIG_H"
5-
64
create_makefile('digest/bubblebabble')

ext/digest/md5/extconf.rb

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
require "mkmf"
77
require File.expand_path("../../digest_conf", __FILE__)
88

9-
$defs << "-DHAVE_CONFIG_H"
10-
119
$objs = [ "md5init.#{$OBJEXT}" ]
1210

1311
digest_conf("md5")

ext/digest/rmd160/extconf.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
require "mkmf"
77
require File.expand_path("../../digest_conf", __FILE__)
88

9-
$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
9+
if try_static_assert("RUBY_API_VERSION_MAJOR < 3", "ruby/version.h")
10+
$defs << "-DNDEBUG"
11+
end
1012

1113
$objs = [ "rmd160init.#{$OBJEXT}" ]
1214

ext/digest/sha1/extconf.rb

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
require "mkmf"
77
require File.expand_path("../../digest_conf", __FILE__)
88

9-
$defs << "-DHAVE_CONFIG_H"
10-
119
$objs = [ "sha1init.#{$OBJEXT}" ]
1210

1311
digest_conf("sha1")

ext/digest/sha2/extconf.rb

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
require "mkmf"
77
require File.expand_path("../../digest_conf", __FILE__)
88

9-
$defs << "-DHAVE_CONFIG_H"
10-
119
$objs = [ "sha2init.#{$OBJEXT}" ]
1210

1311
unless digest_conf("sha2")

ext/monitor/monitor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ monitor_synchronize(VALUE monitor)
203203
void
204204
Init_monitor(void)
205205
{
206-
#if HAVE_RB_EXT_RACTOR_SAFE
206+
#ifdef HAVE_RB_EXT_RACTOR_SAFE
207207
rb_ext_ractor_safe(true);
208208
#endif
209209

ext/nkf/nkf-utf8/nkf.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#define X0201_DEFAULT TRUE
1717
#endif
1818

19-
#if DEFAULT_NEWLINE == 0x0D0A
20-
#elif DEFAULT_NEWLINE == 0x0D
19+
#if defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D0A
20+
#elif defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D
2121
#else
2222
#define DEFAULT_NEWLINE 0x0A
2323
#endif

ext/objspace/objspace.c

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ total_i(VALUE v, void *ptr)
6666
case T_IMEMO:
6767
case T_ICLASS:
6868
case T_NODE:
69+
case T_PAYLOAD:
6970
case T_ZOMBIE:
7071
return;
7172
default:
@@ -224,6 +225,7 @@ type2sym(enum ruby_value_type i)
224225
CASE_TYPE(T_ICLASS);
225226
CASE_TYPE(T_MOVED);
226227
CASE_TYPE(T_ZOMBIE);
228+
CASE_TYPE(T_PAYLOAD);
227229
#undef CASE_TYPE
228230
default: rb_bug("type2sym: unknown type (%d)", i);
229231
}

ext/openssl/ossl_pkey_ec.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ static VALUE ossl_ec_point_mul(int argc, VALUE *argv, VALUE self)
14691469
if (EC_POINT_mul(group, point_result, bn_g, point_self, bn, ossl_bn_ctx) != 1)
14701470
ossl_raise(eEC_POINT, NULL);
14711471
} else {
1472-
#if OPENSSL_VERSION_MAJOR+0 >= 3 || defined(LIBRESSL_VERSION_NUMBER)
1472+
#if (defined(OPENSSL_VERSION_MAJOR) && OPENSSL_VERSION_MAJOR >= 3) || defined(LIBRESSL_VERSION_NUMBER)
14731473
rb_raise(rb_eNotImpError, "calling #mul with arrays is not" \
14741474
"supported by this OpenSSL version");
14751475
#else

ext/psych/yaml/yaml_private.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include RUBY_EXTCONF_H
33
#endif
44

5-
#if HAVE_CONFIG_H
5+
#ifdef HAVE_CONFIG_H
66
#include "config.h"
77
#endif
88

0 commit comments

Comments
 (0)