The following functions are turned into macros and no longer can be
used as expressions in core.
- rb_sys_fail
- rb_sys_fail_str
- rb_sys_fail_path
This commit is contained in:
Nobuyoshi Nakada 2023-05-12 10:48:35 +09:00
Родитель a1b01e7701
Коммит e3385f8783
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7CD2805BFA3770C6
2 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -3312,12 +3312,14 @@ rb_syserr_fail_str(int e, VALUE mesg)
rb_exc_raise(rb_syserr_new_str(e, mesg));
}
#undef rb_sys_fail
void
rb_sys_fail(const char *mesg)
{
rb_exc_raise(make_errno_exc(mesg));
}
#undef rb_sys_fail_str
void
rb_sys_fail_str(VALUE mesg)
{

Просмотреть файл

@ -29,15 +29,31 @@
#define rb_raise_static(e, m) \
rb_raise_cstr_i((e), rb_str_new_static((m), rb_strlen_lit(m)))
#ifdef RUBY_FUNCTION_NAME_STRING
# define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
# define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
# define rb_syserr_new_path(err, path) rb_syserr_new_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
#else
# define rb_sys_fail_path(path) rb_sys_fail_str(path)
# define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
# define rb_syserr_new_path(err, path) rb_syserr_new_str((err), (path))
#endif
#define rb_sys_fail(mesg) \
do { \
int errno_to_fail = errno; \
rb_syserr_fail(errno_to_fail, (mesg)); \
} while (0)
#define rb_sys_fail_str(mesg) \
do { \
int errno_to_fail = errno; \
rb_syserr_fail_str(errno_to_fail, (mesg)); \
} while (0)
#define rb_sys_fail_path(path) \
do { \
int errno_to_fail = errno; \
rb_syserr_fail_path(errno_to_fail, (path)); \
} while (0)
/* error.c */
extern long rb_backtrace_length_limit;
extern VALUE rb_eEAGAIN;