<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/include/ruby/ruby.h, branch v2_7_8</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>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>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>
<entry>
<title>Limit strict RUBY_METHOD_FUNC in C++</title>
<updated>2019-10-23T11:18:32+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-10-23T11:13:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1d91feaf13e0ffe04b2dabc6e77e4101b6d0bb07'/>
<id>1d91feaf13e0ffe04b2dabc6e77e4101b6d0bb07</id>
<content type='text'>
Limit strict function signature check with RUBY_METHOD_FUNC in C++
to bundled libraries only.  [Bug #16271]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Limit strict function signature check with RUBY_METHOD_FUNC in C++
to bundled libraries only.  [Bug #16271]
</pre>
</div>
</content>
</entry>
<entry>
<title>Also moved fallback definition of __has_attribute</title>
<updated>2019-10-12T13:09:49+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-10-12T13:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7ebf9da78830cd13895a38809b0c6f1fc6797620'/>
<id>7ebf9da78830cd13895a38809b0c6f1fc6797620</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Moved RB_METHOD_DEFINITION_DECL to intern.h</title>
<updated>2019-10-12T08:47:28+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2019-10-12T08:21:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=710bc003791b90adf3970e137c69f283c88234cd'/>
<id>710bc003791b90adf3970e137c69f283c88234cd</id>
<content type='text'>
This macro is used here before defined in ruby.h.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This macro is used here before defined in ruby.h.
</pre>
</div>
</content>
</entry>
<entry>
<title>Note RB_PASS_EMPTY_KEYWORDS and RB_SCAN_ARGS_EMPTY_KEYWORDS will be removed</title>
<updated>2019-10-07T20:51:21+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-10-07T20:16:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c0eae130b1d9fde5716c2340141d78ebc48c82a5'/>
<id>c0eae130b1d9fde5716c2340141d78ebc48c82a5</id>
<content type='text'>
There is no need for these in Ruby 3.0, and the plan is to
remove them.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no need for these in Ruby 3.0, and the plan is to
remove them.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add three more C-API functions for handling keywords</title>
<updated>2019-09-30T01:31:08+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-09-30T00:47:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=649a64ae29318501472f74798a12eb60871ab990'/>
<id>649a64ae29318501472f74798a12eb60871ab990</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
</feed>
