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

Howard Hinnant hhinnant at apple.com
Thu Dec 27 10:11:58 PST 2012


This patch only impacts code under:

#ifdef __linux__

I am requesting that someone who runs libc++ on Linux review this patch.

Thanks,
Howard

On Dec 25, 2012, at 11:52 AM, Saleem Abdulrasool <compnerd at compnerd.org> wrote:

> 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);
> <D241.1.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list