diff options
Diffstat (limited to 'libc/misc/error/err.c')
-rw-r--r-- | libc/misc/error/err.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/libc/misc/error/err.c b/libc/misc/error/err.c index 0d0637148..113c2d94f 100644 --- a/libc/misc/error/err.c +++ b/libc/misc/error/err.c @@ -49,62 +49,70 @@ static void vwarn_work(const char *format, va_list args, int showerr) __STDIO_AUTO_THREADUNLOCK(stderr); } -extern void warn(const char *format, ...) +void attribute_hidden __vwarn(const char *format, va_list args) +{ + vwarn_work(format, args, 1); +} +strong_alias(__vwarn,vwarn) + +void warn(const char *format, ...) { va_list args; va_start(args, format); - vwarn(format, args); + __vwarn(format, args); va_end(args); } -extern void vwarn(const char *format, va_list args) +void attribute_hidden __vwarnx(const char *format, va_list args) { - vwarn_work(format, args, 1); + vwarn_work(format, args, 0); } +strong_alias(__vwarnx,vwarnx) -extern void warnx(const char *format, ...) +void warnx(const char *format, ...) { va_list args; va_start(args, format); - vwarnx(format, args); + __vwarnx(format, args); va_end(args); } -extern void vwarnx(const char *format, va_list args) +void attribute_hidden __verr(int status, const char *format, va_list args) { - vwarn_work(format, args, 0); + __vwarn(format, args); + exit(status); } +strong_alias(__verr,verr) -extern void err(int status, const char *format, ...) +void attribute_noreturn err(int status, const char *format, ...) { va_list args; va_start(args, format); - verr(status, format, args); + __verr(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } -extern void verr(int status, const char *format, va_list args) +void attribute_hidden __verrx(int status, const char *format, va_list args) { - vwarn(format, args); + __vwarnx(format, args); exit(status); } +strong_alias(__verrx,verrx) -extern void errx(int status, const char *format, ...) +void attribute_noreturn errx(int status, const char *format, ...) { va_list args; va_start(args, format); - verrx(status, format, args); + __verrx(status, format, args); /* This should get optimized away. We'll leave it now for safety. */ - va_end(args); -} - -extern void verrx(int status, const char *format, va_list args) -{ - vwarnx(format, args); - exit(status); + /* The loop is added only to keep gcc happy. */ + while(1) + va_end(args); } |