[PATCHv2 03/11] Support for type-generic libm function implementations libm
Joseph Myers
joseph@codesourcery.com
Tue Aug 2 21:53:00 GMT 2016
On Fri, 1 Jul 2016, Paul E. Murphy wrote:
> +#if M_LIBM_NEED_COMPAT (carg)
> + declare_mgen_libm_compat (__carg, carg)
> #endif
This sort of thing is not conventionally indented.
> diff --git a/sysdeps/generic/math-type-macros.h b/sysdeps/generic/math-type-macros.h
> new file mode 100644
> index 0000000..3befde1
> --- /dev/null
> +++ b/sysdeps/generic/math-type-macros.h
How would you envisage additional types being handled? Overriding the
header with a variant that duplicates its contents but with extra types
being handled doesn't seem like a good idea. Maybe there should actually
be a header per type, which then includes the generic type-independent
header, or something like that? I think more rationale is needed for the
design relating to this header, anyway.
> +#if M_TYPE == M_FLOAT
> +# define M_PFX FLT
> +# define M_LIT(c) c ## f
> +/* Use the double version instead. */
> +# define M_MLIT(c) c
> +# define M_SUF(c) c ## f
> +# define M_FUNC(c) c ## f
> +# define FLOAT float
> +# define CFLOAT __complex__ float
> +# define M_HUGE_VAL HUGE_VALF
Somewhere there needs to be a comment explaining the semantics of every
one of these macros. Especially, I can't tell what the difference of
intent between M_SUF and M_FUNC is (which places should use one, which
should use the other). In one place you call M_SUF (__atan2), in another
you define M_ATAN2 to M_FUNC (__ieee754_atan2) - why the difference
between M_SUF and M_FUNC there?
> +#ifndef M_DECL_FUNC
> +# define M_DECL_FUNC(f) M_FUNC(f)
> +#endif
Missing space before '(' in macro call.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list