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 */