mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
a891caff7a
The libm template machinery includes a macro declare_mgen_alias_2, to define two function aliases rather than one. This macro is only used in one place, to define ldexp and scalbn, and only has one nondefault definition, for double in the case where long double has the same format. That definition is because declare_mgen_alias for double, in that case, defines <internal-func>l as an alias of <internal-func>, so cannot be called twice for aliases of the same function. Now, I suspect the <internal-func>l aliases are generally not needed (with maybe a few exceptions such as __clog10l, which is an exported function). But even in the presence of them, there is no need for a special declare_mgen_alias_2 macro for this case. This patch eliminates the need for such a macro by defining __wrap_scalbn<suffix> as an alias of __ldexp<suffix>, and then using that when defining the scalbn public aliases. This is similar to how such internal aliases are created for functions with multiple symbol versions, for example. Tested for x86_64, and with build-many-glibcs.py. (There *are* some cases where installed stripped shared libraries change - not in the generated code but because such changes to static symbols on input to ld, even nonexported symbols that don't affect the code or dynamic symbols, can affect the particular representation in the output of string tables, hash tables etc.) * sysdeps/generic/math-type-macros.h [!declare_mgen_alias_2] (declare_mgen_alias_2): Remove. * sysdeps/generic/math-type-macros-double.h [NO_LONG_DOUBLE && !declare_mgen_alias_2] (declare_mgen_alias_2): Likewise. * math/s_ldexp_template.c (M_SUF (__wrap_scalbn)): Define strong alias. (ldexp): Define with declare_mgen_alias. (scalbn): Likewise.
35 lines
1012 B
C
35 lines
1012 B
C
/* @(#)s_ldexp.c 5.1 93/09/24 */
|
|
/*
|
|
* ====================================================
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
*
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software is freely granted, provided that this notice
|
|
* is preserved.
|
|
* ====================================================
|
|
*/
|
|
|
|
#if defined(LIBM_SCCS) && !defined(lint)
|
|
static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
|
|
#endif
|
|
|
|
#include <math.h>
|
|
#include <math_private.h>
|
|
#include <errno.h>
|
|
|
|
FLOAT
|
|
M_SUF (__ldexp) (FLOAT value, int exp)
|
|
{
|
|
if(!isfinite(value)||value==0) return value + value;
|
|
value = M_SCALBN(value,exp);
|
|
if(!isfinite(value)||value==0) __set_errno (ERANGE);
|
|
return value;
|
|
}
|
|
|
|
declare_mgen_alias (__ldexp, ldexp)
|
|
strong_alias (M_SUF (__ldexp), M_SUF (__wrap_scalbn))
|
|
declare_mgen_alias (__wrap_scalbn, scalbn)
|
|
|
|
/* Note, versioning issues are punted to ldbl-opt in this case. */
|