Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys introduce a __syslog__ format, and __sysloglike() ma...



details:   https://anonhg.NetBSD.org/src/rev/8897c469d718
branches:  trunk
changeset: 341009:8897c469d718
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Oct 14 15:52:40 2015 +0000

description:
introduce a __syslog__ format, and __sysloglike() macros. If __syslog__
is not available, this fails back to __printf__

diffstat:

 sys/sys/cdefs.h  |   8 +++++++-
 sys/sys/syslog.h |  18 +++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (73 lines):

diff -r b4d26a0477f7 -r 8897c469d718 sys/sys/cdefs.h
--- a/sys/sys/cdefs.h   Wed Oct 14 15:50:48 2015 +0000
+++ b/sys/sys/cdefs.h   Wed Oct 14 15:52:40 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.126 2015/08/30 08:46:44 mlelstv Exp $      */
+/*     $NetBSD: cdefs.h,v 1.127 2015/10/14 15:52:40 christos Exp $     */
 
 /* * Copyright (c) 1991, 1993
  *     The Regents of the University of California.  All rights reserved.
@@ -478,12 +478,18 @@
 #if __GNUC_PREREQ__(2, 7)
 #define __printflike(fmtarg, firstvararg)      \
            __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
+#ifndef __syslog_attribute__
+#define __syslog__ __printf__
+#endif
+#define __sysloglike(fmtarg, firstvararg)      \
+           __attribute__((__format__ (__syslog__, fmtarg, firstvararg)))
 #define __scanflike(fmtarg, firstvararg)       \
            __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
 #define __format_arg(fmtarg)    __attribute__((__format_arg__ (fmtarg)))
 #else
 #define __printflike(fmtarg, firstvararg)      /* nothing */
 #define __scanflike(fmtarg, firstvararg)       /* nothing */
+#define __sysloglike(fmtarg, firstvararg)      /* nothing */
 #define __format_arg(fmtarg)                   /* nothing */
 #endif
 
diff -r b4d26a0477f7 -r 8897c469d718 sys/sys/syslog.h
--- a/sys/sys/syslog.h  Wed Oct 14 15:50:48 2015 +0000
+++ b/sys/sys/syslog.h  Wed Oct 14 15:52:40 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syslog.h,v 1.36 2014/07/20 20:55:17 dholland Exp $     */
+/*     $NetBSD: syslog.h,v 1.37 2015/10/14 15:52:40 christos Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -201,27 +201,27 @@
 void   closelog(void);
 void   openlog(const char *, int, int);
 int    setlogmask(int);
-void   syslog(int, const char *, ...) __printflike(2, 3);
+void   syslog(int, const char *, ...) __sysloglike(2, 3);
 #if defined(_NETBSD_SOURCE)
-void   vsyslog(int, const char *, __va_list) __printflike(2, 0);
+void   vsyslog(int, const char *, __va_list) __sysloglike(2, 0);
 #ifndef __LIBC12_SOURCE__
 void   closelog_r(struct syslog_data *) __RENAME(__closelog_r60);
 void   openlog_r(const char *, int, int, struct syslog_data *)
     __RENAME(__openlog_r60);
 int    setlogmask_r(int, struct syslog_data *) __RENAME(__setlogmask_r60);
 void   syslog_r(int, struct syslog_data *, const char *, ...)
-    __RENAME(__syslog_r60) __printflike(3, 4);
+    __RENAME(__syslog_r60) __sysloglike(3, 4);
 void   vsyslog_r(int, struct syslog_data *, const char *, __va_list)
-    __RENAME(__vsyslog_r60) __printflike(3, 0);
+    __RENAME(__vsyslog_r60) __sysloglike(3, 0);
 void   syslogp_r(int, struct syslog_data *, const char *, const char *,
-    const char *, ...) __RENAME(__syslogp_r60) __printflike(5, 6);
+    const char *, ...) __RENAME(__syslogp_r60) __sysloglike(5, 6);
 void   vsyslogp_r(int, struct syslog_data *, const char *, const char *,
-    const char *, __va_list) __RENAME(__vsyslogp_r60) __printflike(5, 0);
+    const char *, __va_list) __RENAME(__vsyslogp_r60) __sysloglike(5, 0);
 #endif
 void   syslogp(int, const char *, const char *, const char *, ...)
-    __printflike(4, 5);
+    __sysloglike(4, 5);
 void   vsyslogp(int, const char *, const char *, const char *, __va_list)
-    __printflike(4, 0);
+    __sysloglike(4, 0);
 #endif
 __END_DECLS
 



Home | Main Index | Thread Index | Old Index