Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TypedData_Wrap_Struct() macro to suppress deprecated messages #359

Merged
merged 1 commit into from
Sep 1, 2024

Conversation

Watson1978
Copy link
Contributor

When compile ox gem with Ruby 3.4-dev, it show the following deprecated messages:

../../../../ext/ox/builder.c:356:29: warning: 'rb_data_object_wrap_warning' is deprecated: by TypedData [-Wdeprecated-declarations]
  356 |         volatile VALUE rb = Data_Wrap_Struct(builder_class, NULL, builder_free, b);
      |                             ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:199:5: note: expanded from macro 'Data_Wrap_Struct'
  199 |     rb_data_object_wrap(                          \
      |     ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:363:31: note: expanded from macro 'rb_data_object_wrap'
  363 | #define rb_data_object_wrap   RUBY_MACRO_SELECT(rb_data_object_wrap_2, RUBY_UNTYPED_DATA_WARNING)
      |                               ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:50:35: note: expanded from macro 'RUBY_MACRO_SELECT'
   50 | #define RUBY_MACRO_SELECT(x, y)   RBIMPL_MACRO_SELECT(x, y)
      |                                   ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:49:35: note: expanded from macro 'RBIMPL_MACRO_SELECT'
   49 | #define RBIMPL_MACRO_SELECT(x, y) x ## y
      |                                   ^
<scratch space>:119:1: note: expanded from here
  119 | rb_data_object_wrap_1
      | ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:361:31: note: expanded from macro 'rb_data_object_wrap_1'
  361 | #define rb_data_object_wrap_1 rb_data_object_wrap_warning
      |                               ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:277:1: note: 'rb_data_object_wrap_warning' has been explicitly marked deprecated here
  277 | RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
      | ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:47:5: note: expanded from macro 'RBIMPL_ATTRSET_UNTYPED_DATA_FUNC'
   47 |     RBIMPL_ATTR_DEPRECATED(("by TypedData"))
      |     ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
   36 | # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
      |                                                     ^

This patch will suppress the deprecated messages.

When compile ox gem with Ruby 3.4-dev, it show the following deprecated messages:

```
../../../../ext/ox/builder.c:356:29: warning: 'rb_data_object_wrap_warning' is deprecated: by TypedData [-Wdeprecated-declarations]
  356 |         volatile VALUE rb = Data_Wrap_Struct(builder_class, NULL, builder_free, b);
      |                             ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:199:5: note: expanded from macro 'Data_Wrap_Struct'
  199 |     rb_data_object_wrap(                          \
      |     ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:363:31: note: expanded from macro 'rb_data_object_wrap'
  363 | #define rb_data_object_wrap   RUBY_MACRO_SELECT(rb_data_object_wrap_2, RUBY_UNTYPED_DATA_WARNING)
      |                               ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:50:35: note: expanded from macro 'RUBY_MACRO_SELECT'
   50 | #define RUBY_MACRO_SELECT(x, y)   RBIMPL_MACRO_SELECT(x, y)
      |                                   ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:49:35: note: expanded from macro 'RBIMPL_MACRO_SELECT'
   49 | #define RBIMPL_MACRO_SELECT(x, y) x ## y
      |                                   ^
<scratch space>:119:1: note: expanded from here
  119 | rb_data_object_wrap_1
      | ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:361:31: note: expanded from macro 'rb_data_object_wrap_1'
  361 | #define rb_data_object_wrap_1 rb_data_object_wrap_warning
      |                               ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:277:1: note: 'rb_data_object_wrap_warning' has been explicitly marked deprecated here
  277 | RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
      | ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/core/rdata.h:47:5: note: expanded from macro 'RBIMPL_ATTRSET_UNTYPED_DATA_FUNC'
   47 |     RBIMPL_ATTR_DEPRECATED(("by TypedData"))
      |     ^
/Users/watson/.rbenv/versions/3.4-dev/include/ruby-3.4.0+0/ruby/internal/attr/deprecated.h:36:53: note: expanded from macro 'RBIMPL_ATTR_DEPRECATED'
   36 | # define RBIMPL_ATTR_DEPRECATED(msg) __attribute__((__deprecated__ msg))
      |                                                     ^
```

This patch will suppress the deprecated messages.
@ohler55 ohler55 merged commit 049ecbf into ohler55:develop Sep 1, 2024
19 checks passed
@ohler55
Copy link
Owner

ohler55 commented Sep 1, 2024

Thank you.

@Watson1978 Watson1978 deleted the TypedData_Wrap_Struct branch September 1, 2024 19:28
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