You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/12/06 15:03:22 UTC
[incubator-nuttx] 03/18: include/nuttx/compiler.h: Use __syslog__
if available
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 8d16fe7cfdc0ddc3497a3e8ce7e92e59fe02f2f5
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Sat Nov 21 08:38:47 2020 +0900
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 9b50bc14..f6779a7 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 */