[PATCH] math: Fix `unknown type name '__float128'` for clang 3.4 to 3.8.1 (bug 32694)

H.J. Lu hjl.tools@gmail.com
Sun Feb 23 03:35:49 GMT 2025


On Sat, Feb 22, 2025 at 10:56 PM koraynilay <koray.fra@gmail.com> wrote:
>
> When compiling a program that includes <bits/floatn.h> using a clang version
> between 3.4 (included) and 3.8.1 (included), clang will fail with `unknown type
> name '__float128'; did you mean '__cfloat128'?`. This changes fixes the clang
> prerequirements macro call in floatn.h to check for clang 3.9 instead of 3.4,
> since support for __float128 was actually enabled in 3.9 (see commit 50f29e0
> of the llvm-project on github)
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
> Signed-off-by: koraynilay <koray.fra@gmail.com>
> ---
>  sysdeps/x86/bits/floatn.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sysdeps/x86/bits/floatn.h b/sysdeps/x86/bits/floatn.h
> index adc7ed2e9e..4674165bd7 100644
> --- a/sysdeps/x86/bits/floatn.h
> +++ b/sysdeps/x86/bits/floatn.h
> @@ -31,7 +31,7 @@
>  #if (defined __x86_64__                                                        \
>       ? __GNUC_PREREQ (4, 3)                                            \
>       : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \
> -    || (__glibc_clang_prereq (3, 4)                                    \
> +    || (__glibc_clang_prereq (3, 9)                                    \
>         && (!defined __INTEL_LLVM_COMPILER                              \
>             || !defined SYCL_LANGUAGE_VERSION))
>  # define __HAVE_FLOAT128 1
> @@ -93,7 +93,7 @@ typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
>  /* The type _Float128 exists only since GCC 7.0.  */
>  #  if !__GNUC_PREREQ (7, 0) \
>        || (defined __cplusplus && !__GNUC_PREREQ (13, 0)) \
> -      || __glibc_clang_prereq (3, 4)
> +      || __glibc_clang_prereq (3, 9)
>  typedef __float128 _Float128;
>  #  endif
>
> --
> 2.48.1
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

I will push it for you.

Thanks.


-- 
H.J.


More information about the Libc-alpha mailing list