[PATCHv2 03/11] Support for type-generic libm function implementations libm

Joseph Myers joseph@codesourcery.com
Thu Aug 4 16:43:00 GMT 2016


On Wed, 3 Aug 2016, Paul E. Murphy wrote:

> +# Add special flags to control how the templated functions
> +# are built.
> +g_CPPFLAGS = -include math-type-macros.h
> +g__fCPPFLAGS = $(g_CPPFLAGS) -DM_TYPE=M_FLOAT
> +g__CPPFLAGS = $(g_CPPFLAGS) -DM_TYPE=M_DOUBLE
> +g__lCPPFLAGS = $(g_CPPFLAGS) -DM_TYPE=M_LDOUBLE

Once you've got a separate header for each type, I wonder if you actually 
need this M_FLOAT etc. enumeration, or if it would be better to -include a 
per-type header (either before -include math-type-macros.h, or a header 
which in turn #includes <math-type-macros.h>) and so avoid M_TYPE, M_FLOAT 
etc.

> +#define CFLOAT __complex__ double

I think _Complex should be preferred over __complex__ for new code 
(existing code is inconsistent).

> +   M_HUGE_VAL - Resolves to the type-specific variant of HUGE_VAL

You could just use (M_SUF (__builtin_huge_val) ()) rather than needing 
type-specific headers to define this macro.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list