[cfe-commits] [PATCH] [libcxx][locale] disable inlining of variadic functions in GCC
Saleem Abdulrasool
compnerd at compnerd.org
Thu Dec 27 14:58:08 PST 2012
_LIBCPP_ALWAYS_INLINE is now being dropped on both clang and GCC (on the latter only if GCC is <= 4.7.2 ... which means that we will need to update it if newer versions dont support it).
Im unsure if doing something similar for clang would be a good idea or not (though, I feel that if we are doing it for GCC, we should also do it for clang).
Im unsure of the behaviour of other compilers (MSVC?), so I decided to not unconditionally drop the _LIBCPP_ALWAYS_INLINE as per rsmith's suggestion. However, if you feel strongly about it, I can always update the patch.
Hi Bigcheese,
http://llvm-reviews.chandlerc.com/D241
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D241?vs=587&id=601#toc
Files:
include/__config
include/locale
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -19,6 +19,14 @@
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
+#if defined(__GNUC__)
+#define __GNUC_VERSION(_major, _minor, _patch) \
+ ((_major << 16) + (_minor << 8) + (_patch << 0))
+
+#define __GNUC_VERSION_CODE \
+ __GNUC_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#endif
+
#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1
Index: include/locale
===================================================================
--- include/locale
+++ include/locale
@@ -354,7 +354,10 @@
#endif
}
-_LIBCPP_ALWAYS_INLINE inline
+#if !defined(__GNUC__) || (__GNUC_VERSION_CODE > __GNUC_VERSION(4, 7, 2))
+_LIBCPP_ALWAYS_INLINE
+#endif
+inline
int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
@@ -368,7 +371,10 @@
return __res;
}
-_LIBCPP_ALWAYS_INLINE inline
+#if !defined(__GNUC__) || (__GNUC_VERSION_CODE > __GNUC_VERSION(4, 7, 2))
+_LIBCPP_ALWAYS_INLINE
+#endif
+inline
int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
@@ -382,7 +388,10 @@
return __res;
}
-_LIBCPP_ALWAYS_INLINE inline
+#if !defined(__GNUC__) || (__GNUC_VERSION_CODE > __GNUC_VERSION(4, 7, 2))
+_LIBCPP_ALWAYS_INLINE
+#endif
+inline
int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
@@ -396,7 +405,10 @@
return __res;
}
-_LIBCPP_ALWAYS_INLINE inline
+#if !defined(__GNUC__) || (__GNUC_VERSION_CODE > __GNUC_VERSION(4, 7, 2))
+_LIBCPP_ALWAYS_INLINE
+#endif
+inline
int __sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D241.2.patch
Type: text/x-patch
Size: 1956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121227/47438852/attachment.bin>
More information about the cfe-commits
mailing list