Skip to content

get rid of #pragma GCC diagnostic ignored "-Wundef"#4371

Merged
shyouhei merged 3 commits intoruby:masterfrom
shyouhei:Wundef
Apr 13, 2021
Merged

get rid of #pragma GCC diagnostic ignored "-Wundef"#4371
shyouhei merged 3 commits intoruby:masterfrom
shyouhei:Wundef

Conversation

@shyouhei
Copy link
Member

@shyouhei shyouhei commented Apr 9, 2021

https://bugs.ruby-lang.org/issues/17752

Use of TOKEN_PASTE was a bad idea at the first place. Just use ## everywhere. Nobody practically lacks token pasting.

shyouhei added 2 commits April 9, 2021 18:01
Use of TOKEN_PASTE was a bad idea at the first place.  Just use ##
everywhere.  Nobody practically lacks token pasting.
@shyouhei
Copy link
Member Author

shyouhei commented Apr 9, 2021

Let me see if this breaks portability...

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.
@shyouhei shyouhei requested a review from eregon April 12, 2021 04:03
Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the investigation and fix!

@shyouhei shyouhei merged commit f8e1bf2 into ruby:master Apr 13, 2021
@shyouhei shyouhei deleted the Wundef branch April 13, 2021 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants