浏览代码

Clang support for gnu_inline attribute

Clang also supports the gnu_inline attribute and the
__GNUC_STDC_INLINE__ macro (C99 semantics). However, it reports as
GCC 4.2 compatible (__GNUC_MINOR__ / __GNUC__) and thus the current
defines do not think it can support this.

Add clang as an alternative for this support. Documentation shows that
this attribute is supported since at least Clang 8.

Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Waldemar Brodkorb 11 月之前
父节点
当前提交
0f7c0f87bc
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      include/sys/cdefs.h

+ 1 - 1
include/sys/cdefs.h

@@ -320,7 +320,7 @@
    inline semantics, unless -fgnu89-inline is used.
    inline semantics, unless -fgnu89-inline is used.
    For -std=gnu99, forcing gnu_inline attribute does not change behavior,
    For -std=gnu99, forcing gnu_inline attribute does not change behavior,
    but may silence spurious warnings (such as in GCC 4.2).  */
    but may silence spurious warnings (such as in GCC 4.2).  */
-#if !defined __cplusplus || __GNUC_PREREQ (4,3)
+#if !defined __cplusplus || __GNUC_PREREQ (4,3) || __CLANG_PREREQ(8,0)
 # if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ || defined __cplusplus
 # if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ || defined __cplusplus
 #  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
 #  define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
 #  if __GNUC_PREREQ (4,3)
 #  if __GNUC_PREREQ (4,3)