This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 2/5] powerpc: Add redirection for finitef128, isinf128, and isnanf128
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>, libc-alpha at sourceware dot org
- Cc:
- Date: Tue, 19 Sep 2017 10:27:54 -0300
- Subject: Re: [PATCH v3 2/5] powerpc: Add redirection for finitef128, isinf128, and isnanf128
- Authentication-results: sourceware.org; auth=none
- References: <20170912123435.6592-1-gabriel@inconstante.eti.br> <20170912123435.6592-3-gabriel@inconstante.eti.br>
"Gabriel F. T. Gomes" <gabriel@inconstante.eti.br> writes:
> On powerpc64le, compiler support for float128 is not enabled by default
> on gcc. To enable it, the flag -mfloat128 must be passed as a command
> line option to the compiler. This means that only the few files that
> actively have -mfloat128 passed as an argument get compiler support for
> float128, whereas all other files don't.
>
> When -mfloat128 becomes enabled by default on powerpc [1], all the files
> that do not currently have compiler support for float128 enabled during
> their compilation, will start to have it. This will lead to build
> errors in s_finite.c, s_isinf.c, and s_isnan.c.
>
> The errors are due to the unintended macro expansion of __finitef128 to
> __redirect_finitef128 in math/bits/mathcalls-helper-functions.h. In
AFAIU, the expansion of __finitef128 to __redirect_finitef128 in
math/bits/mathcalls-helper-functions.h is expected. The problem happens when
the same thing doesn't happen in include/math.h too.
In that case, I suggest to rewrite this part as:
The errors are due to the macro expansion of __finitef128 to
__redirect_finitef128 in math/bits/mathcalls-helper-functions.h without
expanding it in include/math.h too.
> diff --git a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
> index a5ec36b72f..0382bfb95c 100644
> --- a/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
> +++ b/sysdeps/powerpc/powerpc64/fpu/multiarch/s_finite.c
> @@ -17,8 +17,15 @@
> <http://www.gnu.org/licenses/>. */
>
> #define __finite __redirect___finite
> +
> +/* The following definitions, although not related to the 'double'
> + version of 'finite', are required to compensate for the unintended
> + macro expansion of __finitef to __redirect___finitef, etc. in
> + math/bits/mathcalls-helper-functions.h. */
Likewise.
I suggest the following change:
/* The following definitions, although not related to the 'double'
version of 'finite', are required to guarantee the macro expansion
of __finitef to __redirect___finitef, etc. in
math/bits/mathcalls-helper-functions.h and include/math.h. */
> #define __finitef __redirect___finitef
> #define __finitel __redirect___finitel
> +#define __finitef128 __redirect___finitef128
> +
> #include <math.h>
> #include <math_ldbl_opt.h>
> #include <shlib-compat.h>
Don't you have to undefine this macro later in this file?
--
Tulio Magno