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 rb_io_descriptor() API to fix deprecated message #11

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

Watson1978
Copy link
Contributor

Since Ruby 3.4, it marks as deprecated that it use fptr->fd directly.
Ref. ruby/ruby@b4d73e9

$ gem install capng_c --verbose
...(snip)...

capng.c: In function 'rb_capng_get_caps_file':
capng.c:511:3: warning: 'fd' is deprecated: rb_io_descriptor [-Wdeprecated-declarations]
  511 |   fd = fptr->fd;
      |   ^~
In file included from ./capng.h:19,
                 from capng.c:14:
/home/watson/.rbenv/versions/3.4.1/include/ruby-3.4.0/ruby/io.h:154:9: note: declared here
  154 |     int fd;
      |         ^~
capng.c: In function 'rb_capng_apply_caps_file':
capng.c:541:3: warning: 'fd' is deprecated: rb_io_descriptor [-Wdeprecated-declarations]
  541 |   fd = fptr->fd;
      |   ^~
/home/watson/.rbenv/versions/3.4.1/include/ruby-3.4.0/ruby/io.h:154:9: note: declared here
  154 |     int fd;
      |         ^~
At top level:

...(snip)...

So, this patch will use rb_io_descriptor() instead of fptr->fd if available.

Since Ruby 3.4, it marks as deprecated that it use `fptr->fd` directly.
Ref. ruby/ruby@b4d73e9

```sh
$ gem install capng_c --verbose
...(snip)...

capng.c: In function 'rb_capng_get_caps_file':
capng.c:511:3: warning: 'fd' is deprecated: rb_io_descriptor [-Wdeprecated-declarations]
  511 |   fd = fptr->fd;
      |   ^~
In file included from ./capng.h:19,
                 from capng.c:14:
/home/watson/.rbenv/versions/3.4.1/include/ruby-3.4.0/ruby/io.h:154:9: note: declared here
  154 |     int fd;
      |         ^~
capng.c: In function 'rb_capng_apply_caps_file':
capng.c:541:3: warning: 'fd' is deprecated: rb_io_descriptor [-Wdeprecated-declarations]
  541 |   fd = fptr->fd;
      |   ^~
/home/watson/.rbenv/versions/3.4.1/include/ruby-3.4.0/ruby/io.h:154:9: note: declared here
  154 |     int fd;
      |         ^~
At top level:

...(snip)...
```

So, this patch will use `rb_io_descriptor()` instead of `fptr->fd` if available.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Copy link
Member

@ashie ashie left a comment

Choose a reason for hiding this comment

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

LGTM

@ashie ashie merged commit ba5010f into fluent-plugins-nursery:main Jan 14, 2025
15 checks passed
@ashie
Copy link
Member

ashie commented Jan 14, 2025

Thanks!

@Watson1978 Watson1978 deleted the rb_io_descriptor branch January 14, 2025 01:42
@ashie ashie mentioned this pull request Jan 14, 2025
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