This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 6/9] float128: Add strtof128, wcstof128, and related functions.


On Fri, 2 Jun 2017, Gabriel F. T. Gomes wrote:

> diff --git a/stdlib/tst-strtod.h b/stdlib/tst-strtod.h
> index bf5f901..956209c 100644
> --- a/stdlib/tst-strtod.h
> +++ b/stdlib/tst-strtod.h
> @@ -21,11 +21,36 @@
>  
>  #define FSTRLENMAX 128
>  
> +#include <bits/floatn.h>
> +
> +#if !__GNUC_PREREQ (7, 0)
> +# define F128 __f128 ()
> +#endif

Why the !__GNUC_PREREQ (7, 0) conditional?  I don't see anything to define 
F128 in the case of GCC 7 or later.  I'd expect this definition to be used 
unconditionally (to localize the __GNUC_PREREQ (7, 0) conditionals to 
bits/floatn.h as much as possible).

> +/* Test strfromf128 and strtof128 on all platforms that provide them,
> +   whether or not the type _Float128 is ABI-distinct from long double.  */
> +#if __HAVE_FLOAT128
> +# define _GEN_f128(mfunc, ...) mfunc (__VA_ARGS__)
> +# define _DO_f128(mfunc,...) (mfunc ## f128) (__VA_ARGS__)
> +# ifndef CHAR
> +#  define CHAR char
> +# endif

Whatever the purpose for which you are adding the definition of CHAR, I 
can't think it should depend on __HAVE_FLOAT128.

> +#define _GEN(mfunc, type, ...) _GENx (_GEN_ ## type, mfunc, type, __VA_ARGS__)
> +#define _GENx(mmfunc, mfunc, type, ...) mmfunc (mfunc, type, __VA_ARGS__)
> +#define _DO(mfunc, type, ...) _DOx (_DO_ ## type, mfunc, ##__VA_ARGS__)
> +#define _DOx(mmfunc, mfunc, ...) mmfunc (mfunc, ##__VA_ARGS__)

Do you really need quite so many macros to make code conditional on 
availability of _Float128?  Can't there simply be a macro IF_FLOAT128(...) 
that expands to either nothing or its arguments depending on whether 
_Float128 is supported?

> @@ -426,6 +429,12 @@ extern long double wcstold (const wchar_t *__restrict __nptr,
>  			    wchar_t **__restrict __endptr) __THROW;
>  #endif /* C99 */
>  
> +/* Likewise for `_Float128' when support is enabled.  */
> +#if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
> +extern _Float128 wcstof128 (const wchar_t *__restrict __nptr,
> +			    wchar_t **__restrict __endptr) __THROW;
> +#endif

This should have __HAVE_FLOAT128 && defined __USE_GNU as the conditional.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]