]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Mark our logger function as sysloglike because we enjoy using %m in the format.
authorRoy Marples <roy@marples.name>
Mon, 26 Oct 2015 10:25:00 +0000 (10:25 +0000)
committerRoy Marples <roy@marples.name>
Mon, 26 Oct 2015 10:25:00 +0000 (10:25 +0000)
If there is no compiler support for it, fallback to printflike.
Correct some whitespace while here.

common.h

index 606034199ce29a2f1f26af99cc992eccc6fcf6dd..ebf529d42c9739b698d3ccee0c8a737833023ef7 100644 (file)
--- a/common.h
+++ b/common.h
 
 #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
 #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)