[PATCH] D24678: [libc++] Fix inline attribute for non-MSVC Windows

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 11:30:47 PDT 2016


smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added a subscriber: cfe-commits.

gcc and clang in gcc compatibility mode do not accept __forceinline. Use
the gcc attribute for them instead.

https://reviews.llvm.org/D24678

Files:
  include/__config

Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -560,9 +560,15 @@
 #define _LIBCPP_TYPE_VIS_ONLY
 #define _LIBCPP_FUNC_VIS_ONLY
 #define _LIBCPP_ENUM_VIS
-#define _LIBCPP_INLINE_VISIBILITY __forceinline
-#define _LIBCPP_ALWAYS_INLINE     __forceinline
-#define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
+#if defined(_LIBCPP_MSVC)
+# define _LIBCPP_INLINE_VISIBILITY __forceinline
+# define _LIBCPP_ALWAYS_INLINE     __forceinline
+# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __forceinline
+#else
+# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
+# define _LIBCPP_ALWAYS_INLINE     __attribute__ ((__always_inline__))
+# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__ ((__always_inline__))
+#endif
 #endif // _WIN32
 
 #ifndef _LIBCPP_HIDDEN


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24678.71680.patch
Type: text/x-patch
Size: 890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160916/ec3a521b/attachment.bin>


More information about the cfe-commits mailing list