This is the mail archive of the libc-alpha@sources.redhat.com 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] long double IEEE double -> quad switch (take 2)


On Fri, Jul 16, 2004 at 06:40:45PM -0700, Ulrich Drepper wrote:
> I few things I found so far:
> 
> 
> ~ I don't like the <math.h> change.  Why is it necessary to add this
> nexttoward business here?

nexttoward{f,,l} is the only libm function where the fool -> foo redirection
doesn't work and also foof and foo need to be redirected.
Particularly nexttowardf -> __nldbl_nexttowardf,
nexttoward -> nextafter, nexttowardl -> nextafter.
It is in math.h because there is no macro I could test in #if inside
bits/mathcalls.h to see if this is the double, float or long double
inclusion.  Well, the function could be declared 3 times in
bits/mathcalls.h, but that is IMHO worse than doing it in math.h.
bits/mathcalls.h could have:
...
# if defined __USE_ISOC99
#  ifndef __NLDBL_COMPAT
__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
#  else
extern float __NLDBL_REDIR2 (nexttowardf, (float __x, long double __y),
			     __nldbl_nexttowardf)
  __attribute__ ((const__)) __THROW;
extern double __NLDBL_REDIR2 (nexttoward, (double __x, long double __y),
			      nextafter)
  __attribute__ ((const__)) __THROW;
extern long double __NLDBL_REDIR2 (nexttowardl,
				   (long double __x, long double __y),
				   nextafter)
  __attribute__ ((const__)) __THROW;
#  endif
# endif
...

> ~ I think include/math.h should include math_ldbl_opt.h.  If necessary
> create an empty version of the file.  This will remove a whole bunch of
> the #includes you added (and in the new code).

Ok.

> +++ libc/sysdeps/ieee754/ldbl-opt/nldbl-obstack_vprintf.c
> 2004-07-06 15:38:13.000000000 -0400
> @@ -0,0 +1,8 @@
> +#include "nldbl-compat.h"
> +
> +int
> +attribute_hidden
> +obstack_vprintf (struct obstack *obstack, const char *fmt, va_list ap)
> +{
> +  return __nldbl_obstack_vprintf (obstack, fmt, ap);
> +}
> 
> Why is the function hidden?  Couldn't this create some problems with gcc
> which wants to perform some optimizations?

This code ends up in /usr/lib*/libnldbl_nonshared.a.
This library is linked in when linking program or shared library which
assumes double is the same type as long double and the redirections
in headers couldn't be used for some reason (e.g. non-GCC).
The wrappers certainly must not be reexported.

>  At least at a comment (and
> copyright).  Copyrights are missing from some more new files with real
> code in ldbl-opt/.

I thought files like the above are too trivial to need one, but I can add
copyrights, np.

> ~ sysdeps/ieee754/ldbl-opt/Makefile: I wonder if LONG_DOUBLE_OPTIONAL
> shouldn't be unconditionally be defined for all files instead of adding
> it for each of the source files.  It's so easy to forget about adding
> the line to the Makefile and the Makefile gets to ugly.

Ok.

> ~ changes like those to libio/swscanf.c probably mean a few
> libc_hidden_proto/def can be removed.

You mean defining
long_double_symbol(lib, old, new) even for !LONG_DOUBLE_OPTIONAL
(to strong_alias) or something else?

	Jakub


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