From: Roy Marples Date: Mon, 26 Oct 2015 10:25:00 +0000 (+0000) Subject: Mark our logger function as sysloglike because we enjoy using %m in the format. X-Git-Tag: v6.9.4~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=820e1c7be7b419b4294e6d47d9004eca59525961;p=thirdparty%2Fdhcpcd.git Mark our logger function as sysloglike because we enjoy using %m in the format. If there is no compiler support for it, fallback to printflike. Correct some whitespace while here. --- diff --git a/common.h b/common.h index 60603419..ebf529d4 100644 --- a/common.h +++ b/common.h @@ -114,20 +114,23 @@ #if __GNUC__ > 2 || defined(__INTEL_COMPILER) # ifndef __packed -# define __packed __attribute__((__packed__)) +# define __packed __attribute__((__packed__)) # endif -# ifndef __printflike -# define __printflike(a, b) __attribute__((format(printf, a, b))) +# ifndef __sysloglike +# ifndef __syslog_attribute_ +# define __syslog__ __printf__ +# endif +# define __sysloglike(a, b) __attribute__((format(__syslog__, a, b))) # endif # ifndef __unused -# define __unused __attribute__((__unused__)) +# define __unused __attribute__((__unused__)) # endif #else # ifndef __packed # define __packed # endif -# ifndef __printflike -# define __printflike +# ifndef __sysloglike +# define __sysloglike # endif # ifndef __unused # define __unused @@ -135,7 +138,7 @@ #endif #ifndef __arraycount -#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) +# define __arraycount(__x) (sizeof(__x) / sizeof(__x[0])) #endif /* We don't really need this as our supported systems define __restrict @@ -166,7 +169,7 @@ int get_monotonic(struct timespec *); #if USE_LOGFILE void logger_open(struct dhcpcd_ctx *); #define logger_mask(ctx, lvl) setlogmask((lvl)) -void logger(struct dhcpcd_ctx *, int, const char *, ...) __printflike(3, 4); +void logger(struct dhcpcd_ctx *, int, const char *, ...) __sysloglike(3, 4); void logger_close(struct dhcpcd_ctx *); #else #define logger_open(ctx) openlog(PACKAGE, LOG_PERROR | LOG_PID, LOG_DAEMON)