[cfe-commits] [PATCH] [libcxx][locale] disable inlining of variadic functions in GCC

Saleem Abdulrasool compnerd at compnerd.org
Tue Dec 25 08:52:14 PST 2012


GCC (at least of 4.7.2) does not support inlining of variadic functions.  In the
case that we are building with GCC, fall back to defining the variadic function
as static and let other compilers which are able to inline variadic functions
continue to do so.


http://llvm-reviews.chandlerc.com/D241

Files:
  include/locale

Index: include/locale
===================================================================
--- include/locale
+++ include/locale
@@ -354,7 +354,11 @@
 #endif
 }
 
+#if !defined(__clang__) && defined(__GNUC__)
+static
+#else
 _LIBCPP_ALWAYS_INLINE inline
+#endif
 int __sprintf_l(char *__s, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);
@@ -368,7 +372,11 @@
   return __res;
 }
 
+#if !defined(__clang__) && defined(__GNUC__)
+static
+#else
 _LIBCPP_ALWAYS_INLINE inline
+#endif
 int __snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);
@@ -382,7 +390,11 @@
   return __res;
 }
 
+#if !defined(__clang__) && defined(__GNUC__)
+static
+#else
 _LIBCPP_ALWAYS_INLINE inline
+#endif
 int __asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
   va_list __va;
   va_start(__va, __format);
@@ -396,7 +408,11 @@
   return __res;
 }
 
+#if !defined(__clang__) && defined(__GNUC__)
+static
+#else
 _LIBCPP_ALWAYS_INLINE inline
+#endif
 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.1.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121225/3bc88445/attachment.bin>


More information about the cfe-commits mailing list