<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/include, branch ruby_2_7</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Fix clang -Wcompound-token-split-by-macro warning in ruby.h</title>
<updated>2021-11-24T08:49:38+00:00</updated>
<author>
<name>Dimitry Andric</name>
<email>dimitry@andric.com</email>
</author>
<published>2021-05-15T18:58:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=06aafeb4b3a855966262da4855a5ba43d672d5e4'/>
<id>06aafeb4b3a855966262da4855a5ba43d672d5e4</id>
<content type='text'>
Building certain ruby gem native extensions (such as thrift), with clang
12.0.0 or later fails, because they have -Werror in their CFLAGS,
resulting in complaints about the expansion of the `rb_intern()` macro:

```
current directory: /wrkdirs/usr/ports/devel/rubygem-thrift/work/stage/usr/local/lib/ruby/gems/2.7/gems/thrift-0.14.0/ext
make "DESTDIR="
compiling binary_protocol_accelerated.c
binary_protocol_accelerated.c:404:68: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                      ^
binary_protocol_accelerated.c:404:68: note: '{' token is here
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1832:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
```

Part of the `rb_intern()` macro expands to `(RUBY_CONST_ID_CACHE((ID),
(str)))`, and in turn `RUBY_CONST_ID_CACHE()` expands to a brace
enclosed compound statement. The intended effect is to get a gcc
statement expression, which is normally delimited by `({ ... })`.

However, clang 12.0.0 and later have a warning enabled by default, about
pasting together the `(` and `{` tokens via different macros (see
&lt;https://github.com/llvm/llvm-project/commit/0e00a95b4fad5e72851de012d3a0b2c2d01f8685&gt;).

To work around this warning:
* Add `RUBY_CONST_ID_CACHE_NB()` (i.e. no-brace) which contains the code
  itself, without any braces
* `RUBY_CONST_ID_CACHE()` which uses `RUBY_CONST_ID_CACHE_NB()`, but
   puts braces around it (so no existing code using this macro breaks)
* Finally, change `rb_intern()` so the `__extension__` directly creates
  a gcc statement expression, using the `RUBY_CONST_ID_CACHE_NB()` macro
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Building certain ruby gem native extensions (such as thrift), with clang
12.0.0 or later fails, because they have -Werror in their CFLAGS,
resulting in complaints about the expansion of the `rb_intern()` macro:

```
current directory: /wrkdirs/usr/ports/devel/rubygem-thrift/work/stage/usr/local/lib/ruby/gems/2.7/gems/thrift-0.14.0/ext
make "DESTDIR="
compiling binary_protocol_accelerated.c
binary_protocol_accelerated.c:404:68: error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro]
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                      ^
binary_protocol_accelerated.c:404:68: note: '{' token is here
  VALUE thrift_binary_protocol_class = rb_const_get(thrift_module, rb_intern("BinaryProtocol"));
                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1847:24: note: expanded from macro 'rb_intern'
        __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/ruby-2.7/ruby/ruby.h:1832:5: note: expanded from macro 'RUBY_CONST_ID_CACHE'
    {                                                   \
    ^
```

Part of the `rb_intern()` macro expands to `(RUBY_CONST_ID_CACHE((ID),
(str)))`, and in turn `RUBY_CONST_ID_CACHE()` expands to a brace
enclosed compound statement. The intended effect is to get a gcc
statement expression, which is normally delimited by `({ ... })`.

However, clang 12.0.0 and later have a warning enabled by default, about
pasting together the `(` and `{` tokens via different macros (see
&lt;https://github.com/llvm/llvm-project/commit/0e00a95b4fad5e72851de012d3a0b2c2d01f8685&gt;).

To work around this warning:
* Add `RUBY_CONST_ID_CACHE_NB()` (i.e. no-brace) which contains the code
  itself, without any braces
* `RUBY_CONST_ID_CACHE()` which uses `RUBY_CONST_ID_CACHE_NB()`, but
   puts braces around it (so no existing code using this macro breaks)
* Finally, change `rb_intern()` so the `__extension__` directly creates
  a gcc statement expression, using the `RUBY_CONST_ID_CACHE_NB()` macro
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) 511b55bcefc81c036294dc9a544d14bd342acd3b: [Backport #17215]</title>
<updated>2021-03-20T05:23:45+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2021-03-20T05:23:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6ef46f71c743507a0e2ae0eef14dce0539b0ff52'/>
<id>6ef46f71c743507a0e2ae0eef14dce0539b0ff52</id>
<content type='text'>
	Enable arm64 optimizations that exist for power/x86 (#3393)

	* Enable unaligned accesses on arm64

	64-bit Arm platforms support unaligned accesses.

	Running the string benchmarks this change improves performance
	by an average of 1.04x, min .96x, max 1.21x, median 1.01x

	* arm64 enable gc optimizations

	Similar to x86 and powerpc optimizations.

	|       |compare-ruby|built-ruby|
	|:------|-----------:|---------:|
	|hash1  |       0.225|     0.237|
	|       |           -|     1.05x|
	|hash2  |       0.110|     0.110|
	|       |       1.00x|         -|

	* vm_exec.c: improve performance for arm64

	|                               |compare-ruby|built-ruby|
	|:------------------------------|-----------:|---------:|
	|vm_array                       |     26.501M|   27.959M|
	|                               |           -|     1.06x|
	|vm_attr_ivar                   |     21.606M|   31.429M|
	|                               |           -|     1.45x|
	|vm_attr_ivar_set               |     21.178M|   26.113M|
	|                               |           -|     1.23x|
	|vm_backtrace                   |       6.621|     6.668|
	|                               |           -|     1.01x|
	|vm_bigarray                    |     26.205M|   29.958M|
	|                               |           -|     1.14x|
	|vm_bighash                     |    504.155k|  479.306k|
	|                               |       1.05x|         -|
	|vm_block                       |     16.692M|   21.315M|
	|                               |           -|     1.28x|
	|block_handler_type_iseq        |       5.083|     7.004|
	|                               |           -|     1.38x|
	---
	 gc.c                           | 13 +++++++++++++
	 gc.h                           |  2 ++
	 include/ruby/internal/config.h |  2 ++
	 regint.h                       |  2 +-
	 siphash.c                      |  2 +-
	 st.c                           |  2 +-
	 vm_exec.c                      |  8 ++++++++
	 7 files changed, 28 insertions(+), 3 deletions(-)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Enable arm64 optimizations that exist for power/x86 (#3393)

	* Enable unaligned accesses on arm64

	64-bit Arm platforms support unaligned accesses.

	Running the string benchmarks this change improves performance
	by an average of 1.04x, min .96x, max 1.21x, median 1.01x

	* arm64 enable gc optimizations

	Similar to x86 and powerpc optimizations.

	|       |compare-ruby|built-ruby|
	|:------|-----------:|---------:|
	|hash1  |       0.225|     0.237|
	|       |           -|     1.05x|
	|hash2  |       0.110|     0.110|
	|       |       1.00x|         -|

	* vm_exec.c: improve performance for arm64

	|                               |compare-ruby|built-ruby|
	|:------------------------------|-----------:|---------:|
	|vm_array                       |     26.501M|   27.959M|
	|                               |           -|     1.06x|
	|vm_attr_ivar                   |     21.606M|   31.429M|
	|                               |           -|     1.45x|
	|vm_attr_ivar_set               |     21.178M|   26.113M|
	|                               |           -|     1.23x|
	|vm_backtrace                   |       6.621|     6.668|
	|                               |           -|     1.01x|
	|vm_bigarray                    |     26.205M|   29.958M|
	|                               |           -|     1.14x|
	|vm_bighash                     |    504.155k|  479.306k|
	|                               |       1.05x|         -|
	|vm_block                       |     16.692M|   21.315M|
	|                               |           -|     1.28x|
	|block_handler_type_iseq        |       5.083|     7.004|
	|                               |           -|     1.38x|
	---
	 gc.c                           | 13 +++++++++++++
	 gc.h                           |  2 ++
	 include/ruby/internal/config.h |  2 ++
	 regint.h                       |  2 +-
	 siphash.c                      |  2 +-
	 st.c                           |  2 +-
	 vm_exec.c                      |  8 ++++++++
	 7 files changed, 28 insertions(+), 3 deletions(-)
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "statement experssion is a GCCism" to pass ICC CI.</title>
<updated>2020-09-20T11:23:12+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2020-09-20T11:23:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1b39a995b559677bf4bf2d0ac3a1c924928a936f'/>
<id>1b39a995b559677bf4bf2d0ac3a1c924928a936f</id>
<content type='text'>
This reverts commit a6b50f379d4b71acac73ac6b22cbe2d2c5b50b3f.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit a6b50f379d4b71acac73ac6b22cbe2d2c5b50b3f.
</pre>
</div>
</content>
</entry>
<entry>
<title>Reword keyword arguments warning messages to convey these are deprecation warnings</title>
<updated>2019-12-23T21:47:33+00:00</updated>
<author>
<name>Marc-Andre Lafortune</name>
<email>github@marc-andre.ca</email>
</author>
<published>2019-12-23T07:34:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=819b604037c317d2b53a1aaca67aef25da2d5ec9'/>
<id>819b604037c317d2b53a1aaca67aef25da2d5ec9</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>vm_args.c: rephrase the warning message of keyword argument separation</title>
<updated>2019-12-20T10:41:15+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2019-12-20T10:41:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f7aee584987e24768670e96b1455ed1193f91ef2'/>
<id>f7aee584987e24768670e96b1455ed1193f91ef2</id>
<content type='text'>
(old)
test.rb:4: warning: The last argument is used as the keyword parameter
test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?

(new)
test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call
test.rb:1: warning: The called method `foo' is defined here
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
(old)
test.rb:4: warning: The last argument is used as the keyword parameter
test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?

(new)
test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call
test.rb:1: warning: The called method `foo' is defined here
</pre>
</div>
</content>
</entry>
<entry>
<title>Fixed misspellings</title>
<updated>2019-12-20T00:32:42+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-12-20T00:19:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=db166290088fb7d39d01f68b9860253893d4f1a7'/>
<id>db166290088fb7d39d01f68b9860253893d4f1a7</id>
<content type='text'>
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
</pre>
</div>
</content>
</entry>
<entry>
<title>forward declare struct timespec</title>
<updated>2019-12-10T02:43:55+00:00</updated>
<author>
<name>卜部昌平</name>
<email>shyouhei@ruby-lang.org</email>
</author>
<published>2019-12-10T02:42:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ec931ee9e13b939f6693032564ee9beeec5a4a1f'/>
<id>ec931ee9e13b939f6693032564ee9beeec5a4a1f</id>
<content type='text'>
... like we do so for struct timeval at several hundreds of lines above.
Depending on OS/Compiler, this can be the first place for the struct to
appear.  To make sure the struct is global, we need a forward
declaration at this point.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
... like we do so for struct timeval at several hundreds of lines above.
Depending on OS/Compiler, this can be the first place for the struct to
appear.  To make sure the struct is global, we need a forward
declaration at this point.
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate rb_eval_cmd, add rb_eval_cmd_kw</title>
<updated>2019-11-17T23:00:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-25T22:49:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c257303ae78d0e307a80dbe5ccd405abc6e8d44d'/>
<id>c257303ae78d0e307a80dbe5ccd405abc6e8d44d</id>
<content type='text'>
rb_eval_cmd takes a safe level, and now that $SAFE is deprecated,
it should be deprecated as well.

Replace with rb_eval_cmd_kw, which takes a keyword flag.  Switch
the two callers to this function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rb_eval_cmd takes a safe level, and now that $SAFE is deprecated,
it should be deprecated as well.

Replace with rb_eval_cmd_kw, which takes a keyword flag.  Switch
the two callers to this function.
</pre>
</div>
</content>
</entry>
<entry>
<title>Deprecate taint/trust and related methods, and make the methods no-ops</title>
<updated>2019-11-17T23:00:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-25T03:59:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ffd0820ab317542f8780aac475da590a4bdbc7a8'/>
<id>ffd0820ab317542f8780aac475da590a4bdbc7a8</id>
<content type='text'>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes the related tests, and puts the related specs behind
version guards.  This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
</pre>
</div>
</content>
</entry>
<entry>
<title>Warn on access/modify of $SAFE, and remove effects of modifying $SAFE</title>
<updated>2019-11-17T23:00:25+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-21T02:06:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c5c05460ac20abcbc0ed686eb4acf06da7a39a79'/>
<id>c5c05460ac20abcbc0ed686eb4acf06da7a39a79</id>
<content type='text'>
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
</pre>
</div>
</content>
</entry>
</feed>
