From 2f61fba72b359fc169374cccb5040aab771d09a1 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 10 Jul 2014 19:31:29 -0700 Subject: [PATCH] The err family allow null format strings. Also remove declarations for the _* variants that were never implemented in bionic (or glibc). Change-Id: I4ea1f17bbb377e70632c10dd218f47110cabc27b --- libc/include/err.h | 49 ++++++++++++---------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/libc/include/err.h b/libc/include/err.h index aad1f5964..ca62c9ec7 100644 --- a/libc/include/err.h +++ b/libc/include/err.h @@ -33,50 +33,25 @@ */ #ifndef _ERR_H_ -#define _ERR_H_ +#define _ERR_H_ #include #include __BEGIN_DECLS -__noreturn void err(int, const char *, ...) - __printflike(2, 3); -__noreturn void verr(int, const char *, __va_list) - __printflike(2, 0); -__noreturn void errx(int, const char *, ...) - __printflike(2, 3); -__noreturn void verrx(int, const char *, __va_list) - __printflike(2, 0); -void warn(const char *, ...) - __printflike(1, 2); -void vwarn(const char *, __va_list) - __printflike(1, 0); -void warnx(const char *, ...) - __printflike(1, 2); -void vwarnx(const char *, __va_list) - __printflike(1, 0); +/* printf's format string isn't nullable; the err family's one is, + * so we can't use __errlike here. */ +#define __errlike(x, y) __attribute__((__format__(printf, x, y))) -/* - * The _* versions are for use in library functions so user-defined - * versions of err*,warn* do not get used. - */ -__noreturn void _err(int, const char *, ...) - __printflike(2, 3); -__noreturn void _verr(int, const char *, __va_list) - __printflike(2, 0); -__noreturn void _errx(int, const char *, ...) - __printflike(2, 3); -__noreturn void _verrx(int, const char *, __va_list) - __printflike(2, 0); -void _warn(const char *, ...) - __printflike(1, 2); -void _vwarn(const char *, __va_list) - __printflike(1, 0); -void _warnx(const char *, ...) - __printflike(1, 2); -void _vwarnx(const char *, __va_list) - __printflike(1, 0); +__noreturn void err(int, const char *, ...) __errlike(2, 3); +__noreturn void verr(int, const char *, __va_list) __errlike(2, 0); +__noreturn void errx(int, const char *, ...) __errlike(2, 3); +__noreturn void verrx(int, const char *, __va_list) __errlike(2, 0); +void warn(const char *, ...) __errlike(1, 2); +void vwarn(const char *, __va_list) __errlike(1, 0); +void warnx(const char *, ...) __errlike(1, 2); +void vwarnx(const char *, __va_list) __errlike(1, 0); __END_DECLS