[libcxx] r281766 - [libc++] Fix inline attribute for non-MSVC Windows

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 12:12:54 PDT 2016


Author: smeenai
Date: Fri Sep 16 14:12:54 2016
New Revision: 281766

URL: http://llvm.org/viewvc/llvm-project?rev=281766&view=rev
Log:
[libc++] Fix inline attribute for non-MSVC Windows

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

Differential Revision: https://reviews.llvm.org/D24678

Modified:
    libcxx/trunk/include/__config

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=281766&r1=281765&r2=281766&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Fri Sep 16 14:12:54 2016
@@ -560,9 +560,15 @@ namespace std {
 #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




More information about the cfe-commits mailing list