Module Name:    src
Committed By:   christos
Date:           Wed Oct 14 15:52:41 UTC 2015

Modified Files:
        src/sys/sys: cdefs.h syslog.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/sys/cdefs.h
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/syslog.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.126 src/sys/sys/cdefs.h:1.127
--- src/sys/sys/cdefs.h:1.126	Sun Aug 30 04:46:44 2015
+++ src/sys/sys/cdefs.h	Wed Oct 14 11:52:40 2015
@@ -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
 

Index: src/sys/sys/syslog.h
diff -u src/sys/sys/syslog.h:1.36 src/sys/sys/syslog.h:1.37
--- src/sys/sys/syslog.h:1.36	Sun Jul 20 16:55:17 2014
+++ src/sys/sys/syslog.h	Wed Oct 14 11:52:40 2015
@@ -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 @@ __BEGIN_DECLS
 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
 

Reply via email to