Re: Avoid implicit declarations in long double complex functions
"Dionna Amalie Glaze via newlib" <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <CAAH4kHbpBdAD8BYbxcgavzcxJXzAjotB3zCNOyC2MhxvBvxPtw@mail.gmail.com> |
I reapplied the patch on a fresh clone here. On Thu, Jun 13, 2019 at 4:05 AM Corinna Vinschen <[email protected]> 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)
0001-Wrap-complex-math-definitions-in-ifdefs.patch
(application/octet-stream, 9.2 KB)
From 62174e664b1eee368a2229b697aab287265510ac Mon Sep 17 00:00:00 2001 From: Dionna Glaze <[email protected]> Date: Thu, 13 Jun 2019 15:35:28 -0700 Subject: [PATCH] Wrap complex math definitions in ifdefs The ifdefs used also wrap the functions that the complex implementations depend on. Valid C99 does not permit the implicit declarations that the complex function definitions use when _LDBL_EQ_DBL is not defined. --- newlib/libm/complex/cacoshl.c | 2 ++ newlib/libm/complex/cacosl.c | 3 ++- newlib/libm/complex/cargl.c | 2 ++ newlib/libm/complex/casinhl.c | 2 ++ newlib/libm/complex/casinl.c | 3 ++- 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 ++ 19 files changed, 38 insertions(+), 2 deletions(-) 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..2d1990cc1 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) { @@ -42,4 +43,4 @@ cacosl(long double complex z) w = (M_PI_2L - creall(w)) - cimagl(w) * I; return w; } - +#endif diff --git a/newlib/libm/complex/cargl.c b/newlib/libm/complex/cargl.c index 790cffe8f..5d075936b 100644 --- a/newlib/libm/complex/cargl.c +++ b/newlib/libm/complex/cargl.c @@ -7,6 +7,7 @@ #include <complex.h> #include <math.h> +#ifdef _LDBL_EQ_DBL long double cargl(long double complex z) { @@ -16,3 +17,4 @@ cargl(long double complex z) return atan2l (cimagl (z), creall (z)); #endif } +#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..78a649c7b 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) { @@ -117,4 +118,4 @@ return; w = zz * (-1.0L * I); 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 -- 2.22.0.rc2.383.gf4fbbf30c2-goog