This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 7/9] Refactor math-finite.h and introduce mathcalls-redir.h
Joseph Myers <joseph@codesourcery.com> writes:
> On Wed, 6 Jun 2018, Tulio Magno Quites Machado Filho wrote:
>
>> On a new enough compiler, redirecting the same function twice can cause
>> -Werror=pragmas errors. This issue may appear when redirecting an ISO C
>> floating point function to a different ABI at the same time that finite
>> redirections are expected.
>
> Does this issue already appear with -mlong-double-64? If so, it should
> definitely be separated out from this patch series and have a bug filed in
> Bugzilla as usual for anything fixing a bug that was user-visible in a
> release.
Yes, I can reproduce it in our tests if I replace -mlong-double-128 with
-mlong-double-64.
However, this is not user-visible because this warning is ignored in system
headers.
Do you still think a bug report is necessary?
> The approach taken in this patch involves a lot of duplication of both
> function prototypes and the feature-test-macro conditions on when those
> functions are declared (duplicating them for functions not included in
> math-finite.h, when previously only those in math-finite.h had such
> duplication). Such duplication is, from experience, fragile and a bad
> idea; the conditions and declarations are too likely to get out of sync.
Agreed.
> Instead, I'd suggest merging bits/math-finite.h into bits/mathcalls.h as
> much as possible - have macros such as __MATHCALL_FINITE that are called
> in bits/mathcalls.h to declare the functions with __*_finite variants, and
> with __MATHCALL_FINITE defined the same as __MATHCALL when the finite
> function variants aren't in use. That way you have just a single
> redirection for each function. (You'll need a sysdeps bits/ header for an
> architecture, i.e. ia64, to declare it doesn't support the _finite
> functions at all.)
It doesn't work well this way because we have prototypes with extra attributes,
e.g:
__MATHDECL_1 (int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y))
__attribute__ ((__const__));
So, if I do not define __MATHDECL_1 in bits/math-finite.h, this code would end
up as an invalid code:
__attribute__ ((__const__));
I managed to remove bits/math-redir.h and modified both math.h and
bits/math-finite.h to reuse bits/mathcalls.h. I had to keep using
__MATH_DECLARE_FINITE and __MATH_DECLARE_NON_FINITE.
Would this be acceptable?
--
Tulio Magno