mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
error.c: warning functions
* error.c: define warning functions in all combinations of * no errno, system errno, argument * without/with encoding * enabled/disabled by default git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc8f2f857c
commit
0d40bf8ffe
2 changed files with 78 additions and 0 deletions
70
error.c
70
error.c
|
@ -2388,6 +2388,52 @@ syserr_warning(VALUE mesg, int err)
|
|||
rb_write_warning_str(mesg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
rb_sys_warn(const char *fmt, ...)
|
||||
{
|
||||
if (!NIL_P(ruby_verbose)) {
|
||||
int errno_save = errno;
|
||||
with_warning_string(mesg, 0, fmt) {
|
||||
syserr_warning(mesg, errno_save);
|
||||
}
|
||||
errno = errno_save;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rb_syserr_warn(int err, const char *fmt, ...)
|
||||
{
|
||||
if (!NIL_P(ruby_verbose)) {
|
||||
with_warning_string(mesg, 0, fmt) {
|
||||
syserr_warning(mesg, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rb_sys_enc_warn(rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
if (!NIL_P(ruby_verbose)) {
|
||||
int errno_save = errno;
|
||||
with_warning_string(mesg, enc, fmt) {
|
||||
syserr_warning(mesg, errno_save);
|
||||
}
|
||||
errno = errno_save;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
rb_syserr_enc_warn(int err, rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
if (!NIL_P(ruby_verbose)) {
|
||||
with_warning_string(mesg, enc, fmt) {
|
||||
syserr_warning(mesg, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
rb_sys_warning(const char *fmt, ...)
|
||||
{
|
||||
|
@ -2400,6 +2446,18 @@ rb_sys_warning(const char *fmt, ...)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
rb_syserr_warning(int err, const char *fmt, ...)
|
||||
{
|
||||
if (RTEST(ruby_verbose)) {
|
||||
with_warning_string(mesg, 0, fmt) {
|
||||
syserr_warning(mesg, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
|
@ -2412,6 +2470,18 @@ rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...)
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...)
|
||||
{
|
||||
if (RTEST(ruby_verbose)) {
|
||||
with_warning_string(mesg, enc, fmt) {
|
||||
syserr_warning(mesg, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
rb_load_fail(VALUE path, const char *err)
|
||||
{
|
||||
|
|
|
@ -1100,9 +1100,17 @@ VALUE rb_check_backtrace(VALUE);
|
|||
NORETURN(void rb_async_bug_errno(const char *,int));
|
||||
const char *rb_builtin_type_name(int t);
|
||||
const char *rb_builtin_class_name(VALUE x);
|
||||
PRINTF_ARGS(void rb_sys_warn(const char *fmt, ...), 1, 2);
|
||||
PRINTF_ARGS(void rb_syserr_warn(int err, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_sys_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_syserr_enc_warn(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
|
||||
PRINTF_ARGS(void rb_sys_warning(const char *fmt, ...), 1, 2);
|
||||
PRINTF_ARGS(void rb_syserr_warning(int err, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
|
||||
PRINTF_ARGS(void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
|
||||
|
||||
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
|
||||
#define rb_name_err_raise_str(mesg, recv, name) \
|
||||
rb_exc_raise(rb_name_err_new(mesg, recv, name))
|
||||
|
|
Loading…
Reference in a new issue