add pic_warnf

This commit is contained in:
Yuichi Nishiwaki 2014-03-25 14:31:24 +09:00
parent 8d63fffe87
commit c3240b9133
2 changed files with 13 additions and 4 deletions

View File

@ -179,13 +179,17 @@ void pic_export(pic_state *, pic_sym);
noreturn void pic_abort(pic_state *, const char *);
noreturn void pic_errorf(pic_state *, const char *, ...);
void pic_warn(pic_state *, const char *);
void pic_warnf(pic_state *, const char *, ...);
/* obsoleted */
noreturn static inline void pic_error(pic_state *pic, const char *msg)
{
pic_errorf(pic, msg);
}
static inline void pic_warn(pic_state *pic, const char *msg)
{
pic_warnf(pic, msg);
}
const char *pic_errmsg(pic_state *);

View File

@ -22,11 +22,16 @@ pic_abort(pic_state *pic, const char *msg)
}
void
pic_warn(pic_state *pic, const char *msg)
pic_warnf(pic_state *pic, const char *fmt, ...)
{
UNUSED(pic);
va_list ap;
pic_value err_line;
fprintf(stderr, "warn: %s\n", msg);
va_start(ap, fmt);
err_line = pic_vformat(pic, fmt, ap);
va_end(ap);
fprintf(stderr, "warn: %s\n", pic_str_cstr(pic_str_ptr(pic_car(pic, err_line))));
}
void