Avoid implicit declarations in long double complex functions

Message ID CAAH4kHY-nKNs3=--Xm=+n7=Br-Dw5JmvXY4KeNdi8320GdCBxw@mail.gmail.com
State New
Headers show
Series
  • Avoid implicit declarations in long double complex functions
Related show

Commit Message

Craig Howland via newlib June 13, 2019, 12:14 a.m.
Hi y'all, I came across some compilation errors that the following patch
fixed. Most long double complex math functions use long double real
functions that are only defined #ifdef _LDBL_EQ_DBL, so I extended that to
the functions that use them.
---
From b7e340cf8583491463c9a29df936bd11d747029a Mon Sep 17 00:00:00 2001
From: Dionna Glaze <dionnaglaze@google.com>

Date: Wed, 12 Jun 2019 17:06:22 -0700
Subject: [PATCH 1/1] Define long double complex functions only if their
 dependencies exist

Signed-off-by: Dionna Glaze <dionnaglaze@google.com>

---
 newlib/libm/complex/cacoshl.c      | 2 ++
 newlib/libm/complex/cacosl.c       | 2 ++
 newlib/libm/complex/casinhl.c      | 2 ++
 newlib/libm/complex/casinl.c       | 2 ++
 newlib/libm/complex/catanhl.c      | 2 ++
 newlib/libm/complex/catanl.c       | 2 ++
 newlib/libm/complex/ccoshl.c       | 2 ++
 newlib/libm/complex/ccosl.c        | 2 ++
 newlib/libm/complex/cephes_subrl.c | 2 ++
 newlib/libm/complex/cexpl.c        | 2 ++
 newlib/libm/complex/clogl.c        | 2 ++
 newlib/libm/complex/cpowl.c        | 2 ++
 newlib/libm/complex/cprojl.c       | 2 ++
 newlib/libm/complex/csinhl.c       | 2 ++
 newlib/libm/complex/csinl.c        | 2 ++
 newlib/libm/complex/csqrtl.c       | 2 ++
 newlib/libm/complex/ctanhl.c       | 2 ++
 newlib/libm/complex/ctanl.c        | 2 ++
 18 files changed, 36 insertions(+)

-- 
2.22.0.rc2.383.gf4fbbf30c2-goog

-- 
-Dionna Glaze, PhD (she/her)

Comments

Corinna Vinschen June 13, 2019, 11:05 a.m. | #1
Hi Dionna,

On Jun 12 17:14, Dionna Amalie Glaze via newlib wrote:
> Hi y'all, I came across some compilation errors that the following patch

> fixed. Most long double complex math functions use long double real

> functions that are only defined #ifdef _LDBL_EQ_DBL, so I extended that to

> the functions that use them.


Your patch doesn't apply, Pretty much all hunks have fuzz, and
git am returns with "error: corrupt patch at line 241"

Can you check, please?  If that's a MUA isssue, you could attach
the patch as plain text.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Craig Howland via newlib June 13, 2019, 10:41 p.m. | #2
I reapplied the patch on a fresh clone here.


On Thu, Jun 13, 2019 at 4:05 AM Corinna Vinschen <vinschen@redhat.com> wrote:
>

> Hi Dionna,

>

> On Jun 12 17:14, Dionna Amalie Glaze via newlib wrote:

> > Hi y'all, I came across some compilation errors that the following patch

> > fixed. Most long double complex math functions use long double real

> > functions that are only defined #ifdef _LDBL_EQ_DBL, so I extended that to

> > the functions that use them.

>

> Your patch doesn't apply, Pretty much all hunks have fuzz, and

> git am returns with "error: corrupt patch at line 241"

>

> Can you check, please?  If that's a MUA isssue, you could attach

> the patch as plain text.

>

>

> Thanks,

> Corinna

>

> --

> Corinna Vinschen

> Cygwin Maintainer

> Red Hat




-- 
-Dionna Glaze, PhD (she/her)
Craig Howland via newlib June 13, 2019, 11:20 p.m. | #3
I've been informed that this has bad interactions with libc++, since
it will provide different implementations of cosl etc such that the
complex math functions will then work. The layering of these
interactions is really unfortunate. I'll need to table this patch
until we come up with a good solution.

On Thu, Jun 13, 2019 at 3:41 PM Dionna Amalie Glaze
<dionnaglaze@google.com> wrote:
>

> I reapplied the patch on a fresh clone here.

>

>

> On Thu, Jun 13, 2019 at 4:05 AM Corinna Vinschen <vinschen@redhat.com> wrote:

> >

> > Hi Dionna,

> >

> > On Jun 12 17:14, Dionna Amalie Glaze via newlib wrote:

> > > Hi y'all, I came across some compilation errors that the following patch

> > > fixed. Most long double complex math functions use long double real

> > > functions that are only defined #ifdef _LDBL_EQ_DBL, so I extended that to

> > > the functions that use them.

> >

> > Your patch doesn't apply, Pretty much all hunks have fuzz, and

> > git am returns with "error: corrupt patch at line 241"

> >

> > Can you check, please?  If that's a MUA isssue, you could attach

> > the patch as plain text.

> >

> >

> > Thanks,

> > Corinna

> >

> > --

> > Corinna Vinschen

> > Cygwin Maintainer

> > Red Hat

>

>

>

> --

> -Dionna Glaze, PhD (she/her)




-- 
-Dionna Glaze, PhD (she/her)

Patch

diff --git a/newlib/libm/complex/cacoshl.c b/newlib/libm/complex/cacoshl.c
index 4e4e006b9..bd0282504 100644
--- a/newlib/libm/complex/cacoshl.c
+++ b/newlib/libm/complex/cacoshl.c
@@ -31,6 +31,7 @@ 

 #include <complex.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 cacoshl(long double complex z)
 {
@@ -43,3 +44,4 @@  cacoshl(long double complex z)
 #endif
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/cacosl.c b/newlib/libm/complex/cacosl.c
index 6a05c8cb7..c66c22f66 100644
--- a/newlib/libm/complex/cacosl.c
+++ b/newlib/libm/complex/cacosl.c
@@ -33,6 +33,7 @@ 
 #include <math.h>
 #include "cephes_subrl.h"

+#ifdef _LDBL_EQ_DBL
 long double complex
 cacosl(long double complex z)
 {
@@ -43,3 +44,4 @@  cacosl(long double complex z)
  return w;
 }

+#endif
diff --git a/newlib/libm/complex/casinhl.c b/newlib/libm/complex/casinhl.c
index 2864791ea..f7b51caae 100644
--- a/newlib/libm/complex/casinhl.c
+++ b/newlib/libm/complex/casinhl.c
@@ -31,6 +31,7 @@ 

 #include <complex.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 casinhl(long double complex z)
 {
@@ -39,3 +40,4 @@  casinhl(long double complex z)
  w = -1.0L * I * casinl(z * I);
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/casinl.c b/newlib/libm/complex/casinl.c
index 488488974..653dcc879 100644
--- a/newlib/libm/complex/casinl.c
+++ b/newlib/libm/complex/casinl.c
@@ -36,6 +36,7 @@ 
 __weak_alias(casinl, _casinl)
 #endif

+#ifdef _LDBL_EQ_DBL
 long double complex
 casinl(long double complex z)
 {
@@ -118,3 +119,4 @@  return;
  return w;
 }

+#endif
diff --git a/newlib/libm/complex/catanhl.c b/newlib/libm/complex/catanhl.c
index 8975fe85e..471e49927 100644
--- a/newlib/libm/complex/catanhl.c
+++ b/newlib/libm/complex/catanhl.c
@@ -31,6 +31,7 @@ 

 #include <complex.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 catanhl(long double complex z)
 {
@@ -39,3 +40,4 @@  catanhl(long double complex z)
  w = -1.0L * I * catanl(z * I);
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/catanl.c b/newlib/libm/complex/catanl.c
index ee2a25930..358e2aade 100644
--- a/newlib/libm/complex/catanl.c
+++ b/newlib/libm/complex/catanl.c
@@ -37,6 +37,7 @@ 
 __weak_alias(catanl, _catanl)
 #endif

+#ifdef _LDBL_EQ_DBL
 long double complex
 catanl(long double complex z)
 {
@@ -75,3 +76,4 @@  ovrf:
  return w;
 }

+#endif
diff --git a/newlib/libm/complex/ccoshl.c b/newlib/libm/complex/ccoshl.c
index f59fadf7a..3235911e5 100644
--- a/newlib/libm/complex/ccoshl.c
+++ b/newlib/libm/complex/ccoshl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 ccoshl(long double complex z)
 {
@@ -43,3 +44,4 @@  ccoshl(long double complex z)
  w = coshl(x) * cosl(y) + (sinhl(x) * sinl(y)) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/ccosl.c b/newlib/libm/complex/ccosl.c
index c310f4024..43d61df65 100644
--- a/newlib/libm/complex/ccosl.c
+++ b/newlib/libm/complex/ccosl.c
@@ -33,6 +33,7 @@ 
 #include <math.h>
 #include "cephes_subrl.h"

+#ifdef _LDBL_EQ_DBL
 long double complex
 ccosl(long double complex z)
 {
@@ -43,3 +44,4 @@  ccosl(long double complex z)
  w = cosl(creall(z)) * ch - (sinl(creall(z)) * sh) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/cephes_subrl.c
b/newlib/libm/complex/cephes_subrl.c
index 8af11df76..d97b61380 100644
--- a/newlib/libm/complex/cephes_subrl.c
+++ b/newlib/libm/complex/cephes_subrl.c
@@ -35,6 +35,7 @@ 

 /* calculate cosh and sinh */

+#ifdef _LDBL_EQ_DBL
 void
 _cchshl(long double x, long double *c, long double *s)
 {
@@ -126,3 +127,4 @@  _ctansl(long double complex z)
  } while (fabsl(t/d) > MACHEPL);
  return d;
 }
+#endif
diff --git a/newlib/libm/complex/cexpl.c b/newlib/libm/complex/cexpl.c
index 8b56634ba..872116bc0 100644
--- a/newlib/libm/complex/cexpl.c
+++ b/newlib/libm/complex/cexpl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 cexpl(long double complex z)
 {
@@ -44,3 +45,4 @@  cexpl(long double complex z)
  w = r * cosl(y) + r * sinl(y) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/clogl.c b/newlib/libm/complex/clogl.c
index 3644a44fc..0743d3962 100644
--- a/newlib/libm/complex/clogl.c
+++ b/newlib/libm/complex/clogl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 clogl(long double complex z)
 {
@@ -44,3 +45,4 @@  clogl(long double complex z)
  w = p + rr * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/cpowl.c b/newlib/libm/complex/cpowl.c
index 85c2c20f2..5ca64d0e1 100644
--- a/newlib/libm/complex/cpowl.c
+++ b/newlib/libm/complex/cpowl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 cpowl(long double complex a, long double complex z)
 {
@@ -54,3 +55,4 @@  cpowl(long double complex a, long double complex z)
  w = r * cosl(theta) + (r * sinl(theta)) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/cprojl.c b/newlib/libm/complex/cprojl.c
index e71c77353..59906015a 100644
--- a/newlib/libm/complex/cprojl.c
+++ b/newlib/libm/complex/cprojl.c
@@ -45,6 +45,7 @@  __RCSID("$NetBSD: cprojl.c,v 1.7 2014/10/10 00:48:18
christos Exp $");
  *
  * INFINITY + I * copysign(0.0, cimag(z))
  */
+#ifdef _LDBL_EQ_DBL
 long double complex
 cprojl(long double complex z)
 {
@@ -62,3 +63,4 @@  cprojl(long double complex z)

  return (w.z);
 }
+#endif
diff --git a/newlib/libm/complex/csinhl.c b/newlib/libm/complex/csinhl.c
index 44ed05037..1de06857c 100644
--- a/newlib/libm/complex/csinhl.c
+++ b/newlib/libm/complex/csinhl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 csinhl(long double complex z)
 {
@@ -43,3 +44,4 @@  csinhl(long double complex z)
  w = sinhl(x) * cosl(y) + (coshl(x) * sinl(y)) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/csinl.c b/newlib/libm/complex/csinl.c
index 2b96c7225..74c46fc3e 100644
--- a/newlib/libm/complex/csinl.c
+++ b/newlib/libm/complex/csinl.c
@@ -33,6 +33,7 @@ 
 #include <math.h>
 #include "cephes_subrl.h"

+#ifdef _LDBL_EQ_DBL
 long double complex
 csinl(long double complex z)
 {
@@ -43,3 +44,4 @@  csinl(long double complex z)
  w = sinl(creall(z)) * ch + (cosl(creall(z)) * sh) * I;
  return w;
 }
+#endif
diff --git a/newlib/libm/complex/csqrtl.c b/newlib/libm/complex/csqrtl.c
index c10a1264a..2e43f6253 100644
--- a/newlib/libm/complex/csqrtl.c
+++ b/newlib/libm/complex/csqrtl.c
@@ -49,6 +49,7 @@  __RCSID("$NetBSD: csqrtl.c,v 1.2 2014/10/11 00:43:51
christos Exp $");

 #define cpackl(r, i) ((r) + (i) * I)

+#ifdef _LDBL_EQ_DBL
 long double complex
 csqrtl(long double complex z)
 {
@@ -110,3 +111,4 @@  csqrtl(long double complex z)
  else
  return (result);
 }
+#endif
diff --git a/newlib/libm/complex/ctanhl.c b/newlib/libm/complex/ctanhl.c
index 1db886f63..c77ec41db 100644
--- a/newlib/libm/complex/ctanhl.c
+++ b/newlib/libm/complex/ctanhl.c
@@ -32,6 +32,7 @@ 
 #include <complex.h>
 #include <math.h>

+#ifdef _LDBL_EQ_DBL
 long double complex
 ctanhl(long double complex z)
 {
@@ -45,3 +46,4 @@  ctanhl(long double complex z)

  return w;
 }
+#endif
diff --git a/newlib/libm/complex/ctanl.c b/newlib/libm/complex/ctanl.c
index c5c887c74..332eddaba 100644
--- a/newlib/libm/complex/ctanl.c
+++ b/newlib/libm/complex/ctanl.c
@@ -34,6 +34,7 @@ 
 #include <math.h>
 #include "cephes_subrl.h"

+#ifdef _LDBL_EQ_DBL
 long double complex
 ctanl(long double complex z)
 {
@@ -54,3 +55,4 @@  ctanl(long double complex z)
  w = sinl(2.0L * creall(z)) / d + (sinhl(2.0L * cimagl(z)) / d) * I;
  return w;
 }
+#endif