1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

workaround MSVC error

Previous code failed to compile on MSVC. Log:
https://github.com/ruby/ruby/pull/4371/checks?check_run_id=2304484466

This is possibly due to the fact that:

1. `Data_Wrap_Struct(...)` appears in a source code
2. which expands to `rb_data_object_wrap(...)`
3. which expands to `RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)`
4. which expands to `rb_data_object_wrap_0`
5. which expands to `rb_data_object_wrap`, so far so good, but
6. this is a recursive macro expansion (see step 2).  Everybody stops expanding...
    - in step 4 for MSVC, and
    - in step 5 for GCC etc.

I have no idea why but this proposed changeset prevents MSVC from
stopping at step 4.
This commit is contained in:
卜部昌平 2021-04-12 11:37:01 +09:00
parent 6413dc27dc
commit f8e1bf283d

View file

@ -174,14 +174,14 @@ rb_cData(void)
#define rb_data_object_wrap_0 rb_data_object_wrap
#define rb_data_object_wrap_1 rb_data_object_wrap_warning
#define rb_data_object_wrap_ rb_data_object_wrap_ /* Used here vvvv */
#define rb_data_object_wrap RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)
#define rb_data_object_wrap_2 rb_data_object_wrap_ /* Used here vvvv */
#define rb_data_object_wrap RUBY_MACRO_SELECT(rb_data_object_wrap_2, RUBY_UNTYPED_DATA_WARNING)
#define rb_data_object_get_0 rb_data_object_get
#define rb_data_object_get_1 rb_data_object_get_warning
#define rb_data_object_get_ rb_data_object_get_ /* Used here vvvv */
#define rb_data_object_get RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING)
#define rb_data_object_get_2 rb_data_object_get_ /* Used here vvvv */
#define rb_data_object_get RUBY_MACRO_SELECT(rb_data_object_get_2, RUBY_UNTYPED_DATA_WARNING)
#define rb_data_object_make_0 rb_data_object_make
#define rb_data_object_make_1 rb_data_object_make_warning
#define rb_data_object_make_ rb_data_object_make_ /* Used here vvvv */
#define rb_data_object_make RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING)
#define rb_data_object_make_2 rb_data_object_make_ /* Used here vvvv */
#define rb_data_object_make RUBY_MACRO_SELECT(rb_data_object_make_2, RUBY_UNTYPED_DATA_WARNING)
#endif /* RBIMPL_RDATA_H */