From 8d16fe7cfdc0ddc3497a3e8ce7e92e59fe02f2f5 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Sat, 21 Nov 2020 08:38:47 +0900 Subject: [PATCH] include/nuttx/compiler.h: Use __syslog__ if available --- include/nuttx/compiler.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 9b50bc146e..f6779a7d0e 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -143,8 +143,17 @@ # define inline_function __attribute__ ((always_inline,no_instrument_function)) # define noinline_function __attribute__ ((noinline)) +/* Some versions of GCC have a separate __syslog__ format. + * http://mail-index.netbsd.org/source-changes/2015/10/14/msg069435.html + * Use it if available. Otherwise, assume __printf__ accepts %m. + */ + +# if !defined(__syslog_attribute__) +# define __syslog__ __printf__ +# endif + # define printflike(a, b) __attribute__((__format__ (__printf__, a, b))) -# define sysloglike(a, b) __attribute__((__format__ (__printf__, a, b))) +# define sysloglike(a, b) __attribute__((__format__ (__syslog__, a, b))) # define scanflike(a, b) __attribute__((__format__ (__scanf__, a, b))) /* GCC does not use storage classes to qualify addressing */