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

Check if rb_syserr_fail_str is available #81

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/io/console/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ io_get_write_io_fallback(VALUE io)
#define rb_io_get_write_io io_get_write_io_fallback
#endif

#ifndef DHAVE_RB_SYSERR_FAIL_STR
Copy link
Member

@eregon eregon Dec 2, 2024

Choose a reason for hiding this comment

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

Is this correct?
Running on CRuby 3.2.2, have_func("rb_syserr_fail_str(0, Qnil)") defines HAVE_RB_SYSERR_FAIL_STR, not DHAVE_RB_SYSERR_FAIL_STR

# define rb_syserr_fail_str(e, mesg) rb_exc_raise(rb_syserr_new_str(e, mesg))
#endif

#define sys_fail(io) do { \
int err = errno; \
rb_syserr_fail_str(err, rb_io_path(io)); \
Expand Down
4 changes: 4 additions & 0 deletions ext/io/console/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# See https://bugs.ruby-lang.org/issues/20345
MakeMakefile::RbConfig ||= ::RbConfig

have_func("rb_syserr_fail_str(0, Qnil)") or
Copy link
Member

Choose a reason for hiding this comment

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

FWIW I think have_func("rb_syserr_fail_str") should be enough, both eventually error with on TruffleRuby 24.1.1:

conftest.c:15: undefined reference to `rb_syserr_fail_str'

for me on Linux, and both are yes on CRuby 3.2.2.

have_func("rb_syserr_new_str(0, Qnil)") or
abort

have_func("rb_io_path")
have_func("rb_io_descriptor")
have_func("rb_io_get_write_io")
Expand Down