include/nuttx/compiler.h: Use __syslog__ if available

This commit is contained in:
YAMAMOTO Takashi 2020-11-21 08:38:47 +09:00 committed by Xiang Xiao
parent ed1a2584f0
commit 8d16fe7cfd

View File

@ -143,8 +143,17 @@
# define inline_function __attribute__ ((always_inline,no_instrument_function)) # define inline_function __attribute__ ((always_inline,no_instrument_function))
# define noinline_function __attribute__ ((noinline)) # 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 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))) # define scanflike(a, b) __attribute__((__format__ (__scanf__, a, b)))
/* GCC does not use storage classes to qualify addressing */ /* GCC does not use storage classes to qualify addressing */