Skip to content

Commit

Permalink
consume __printflike
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Aug 12, 2024
1 parent b08e8fe commit e272c53
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/exec_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,6 @@ int check_interrupt_interval_ms(struct exec_context *ctx);
int vtrap(struct exec_context *ctx, enum trapid id, const char *fmt,
va_list ap);
int trap_with_id(struct exec_context *ctx, enum trapid id, const char *fmt,
...) __attribute__((__format__(__printf__, 3, 4)));
...) __printflike(3, 4);

__END_EXTERN_C
2 changes: 1 addition & 1 deletion lib/host_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int host_func_getptr(struct exec_context *ctx, struct meminst *mem,
int host_func_getptr2(struct exec_context *ctx, struct meminst *mem,
uint32_t ptr, uint32_t size, void **pp, bool *movedp);
int host_func_trap(struct exec_context *ctx, const char *fmt, ...)
__attribute__((__format__(__printf__, 2, 3)));
__printflike(2, 3);
struct restart_info;
int schedule_call_from_hostfunc(struct exec_context *ctx,
struct restart_info *restart,
Expand Down
6 changes: 2 additions & 4 deletions lib/nbio.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ bool is_again(int error);
* the code (namely xlog and repl) needs to deal with non-blocking fds.
*/
int nbio_vfprintf(FILE *fp, const char *fmt, va_list ap);
int nbio_fprintf(FILE *fp, const char *fmt, ...)
__attribute__((__format__(__printf__, 2, 3)));
int nbio_printf(const char *fmt, ...)
__attribute__((__format__(__printf__, 1, 2)));
int nbio_fprintf(FILE *fp, const char *fmt, ...) __printflike(2, 3);
int nbio_printf(const char *fmt, ...) __printflike(1, 2);
ssize_t nbio_getline(char **linep, size_t *linecapp, FILE *fp);

__END_EXTERN_C
3 changes: 1 addition & 2 deletions lib/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ __BEGIN_EXTERN_C
*/

void vreport(struct report *r, const char *fmt, va_list ap);
void report_error(struct report *r, const char *fmt, ...)
__attribute__((__format__(__printf__, 2, 3)));
void report_error(struct report *r, const char *fmt, ...) __printflike(2, 3);
void report_init(struct report *r);
void report_clear(struct report *r);
const char *report_getmessage(const struct report *r);
Expand Down
2 changes: 1 addition & 1 deletion lib/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int pop_ctrlframe(uint32_t pc, bool is_else, struct ctrlframe *cframe,
void mark_unreachable(struct validation_context *ctx);
const struct resulttype *label_types(const struct ctrlframe *cframe);
int validation_failure(struct validation_context *ctx, const char *fmt, ...)
__attribute__((__format__(__printf__, 2, 3)));
__printflike(2, 3);
struct resulttype *returntype(struct validation_context *ctx);
void validation_context_init(struct validation_context *ctx);
void validation_context_reuse(struct validation_context *ctx);
Expand Down
12 changes: 4 additions & 8 deletions lib/xlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@

__BEGIN_EXTERN_C

void xlog_printf(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
void xlog_printf(const char *, ...) __printflike(1, 2);

void xlog_printf_raw(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
void xlog_printf_raw(const char *, ...) __printflike(1, 2);

void xlog__trace(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
void xlog_error(const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
void xlog__trace(const char *, ...) __printflike(1, 2);
void xlog_error(const char *, ...) __printflike(1, 2);

#if defined(TOYWASM_ENABLE_TRACING)
extern int xlog_tracing;
Expand Down

0 comments on commit e272c53

Please sign in to comment.