Work around conflicting declarations of math functions
diff mbox

Message ID 5640F6EF.2060202@redhat.com
State New
Headers show

Commit Message

Florian Weimer Nov. 9, 2015, 7:41 p.m. UTC
On 11/09/2015 05:24 PM, Joseph Myers wrote:
> On Mon, 9 Nov 2015, Florian Weimer wrote:
> 
>> On 11/05/2015 01:49 AM, Joseph Myers wrote:
>>> bits/math-finite.h declares -ffinite-math-only variants of various
>>> functions under conditions not matching those under which the normal
>>> versions are declared.
>>
>> Joseph,
>>
>> I may be seeing build failures related to this change, on armhfp (which
>> is, I think, ARMv7 with hardware floating point).  Specifically, this:
> 
> I think this comes from -D_Mlong_double_=double in math-CPPFLAGS, in which 
> case undefining _Mlong_double_ in test-signgam-finite-c99.c ought to allow 
> the test to build OK

I can confirm that the attached patch fixes the build issue on armhfp I
was seeing.  Thanks!

I need some help with the commit message, though.

Florian

Comments

Joseph Myers Nov. 9, 2015, 10:25 p.m. UTC | #1
On Mon, 9 Nov 2015, Florian Weimer wrote:

> On 11/09/2015 05:24 PM, Joseph Myers wrote:
> > On Mon, 9 Nov 2015, Florian Weimer wrote:
> > 
> >> On 11/05/2015 01:49 AM, Joseph Myers wrote:
> >>> bits/math-finite.h declares -ffinite-math-only variants of various
> >>> functions under conditions not matching those under which the normal
> >>> versions are declared.
> >>
> >> Joseph,
> >>
> >> I may be seeing build failures related to this change, on armhfp (which
> >> is, I think, ARMv7 with hardware floating point).  Specifically, this:
> > 
> > I think this comes from -D_Mlong_double_=double in math-CPPFLAGS, in which 
> > case undefining _Mlong_double_ in test-signgam-finite-c99.c ought to allow 
> > the test to build OK
> 
> I can confirm that the attached patch fixes the build issue on armhfp I
> was seeing.  Thanks!

This patch is OK.

> I need some help with the commit message, though.

I don't think there is a simple explanation for the commit message.  I 
suspect the -D_Mlong_double_=double could in fact be removed as *only* 
doing anything in the case where it breaks things (tests that undefine 
_LIBC) - it was added by

Mon Jul  8 13:37:40 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>

        * math/math.h (_Mfloat_, _Mlong_double_): New macros, defined iff not
        already defined to float, long double.  Use those macros for _Mdouble_
        defns when including mathcalls.h.
        * math/Makefile [$(long-double-fcts) != yes] (CPPFLAGS): Append
        -D_Mlong_double_=double.

and may have been obsoleted by

1998-11-05  Ulrich Drepper  <drepper@cygnus.com>

        * math/math.h: Unconditionally include bits/mathdef.h.  Declare
        long double functions only if __NO_LONG_DOUBLE_MATH is not
        defined.
        * sysdeps/generic/bits/mathdef.h: Define only if __USE_ISOC9X.
        Define __NO_LONG_DOUBLE_MATH.
        * sysdeps/m68k/fpu/bits/mathdef.h: Define only if __USE_ISOC9X.
        * sysdeps/i386/fpu/bits/mathdef.h: Likewise.

(after that, the long double functions shouldn't be prototyped at all when 
building libm before they get defined as aliases for the double functions) 
- but that would require further analysis to make sure.

Patch
diff mbox

Work around conflicting declarations of math functions

This restores compilation on architectures such as armhfp which
alias acos and acosl because double and long double are the same.

2015-11-09  Florian Weimer  <fweimer@redhat.com>

	* math/test-signgam-finite-c99.c (_Mlong_double_): Undefine.

diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c
index fd9cdd3..bd3bdca 100644
--- a/math/test-signgam-finite-c99.c
+++ b/math/test-signgam-finite-c99.c
@@ -18,6 +18,7 @@ 
 
 #undef _LIBC
 #undef _GNU_SOURCE
+#undef _Mlong_double_
 #define _ISOMAC
 
 #include <math.h>