delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/07/01/14:12:23

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=314Exly2VanS0vkhRFOV3lJTMtmDw4HSjFMpvUX+B1g=;
b=jJwMJdTQPcSJRyZf4WWCC46EmxzpdYzL3zMJJ/Sbbl4yDQcy8H2WlKYz/fIwusYv+p
FoJKWFlqCs0dp2yBa04Y1FuFrdgaAeZSpEGVA5tf1c5MnL+Cfbzdd7OR/Z/APpsKVUUR
2hCA6AY0vhCm70VVrsECxeSQIAjFj/1KP/w7U=
MIME-Version: 1.0
In-Reply-To: <201107011753.p61Hr3XO020234@envy.delorie.com>
References: <BANLkTikW3CVu0QEHyFwgfpvzqNoMR6Tfrg AT mail DOT gmail DOT com>
<83tyb6qce3 DOT fsf AT gnu DOT org>
<BANLkTi=q_JbhptgWTi8ZN7mtq9NO9zPX0g AT mail DOT gmail DOT com>
<201107011526 DOT p61FQs24012782 AT envy DOT delorie DOT com>
<BANLkTi=BU4UzOR+RtD9hJRCtKq6eR3AYog AT mail DOT gmail DOT com>
<201107011539 DOT p61FdYjI013658 AT envy DOT delorie DOT com>
<BANLkTi=HfCnAD4WUndyU_bdnP6wXuOPo0A AT mail DOT gmail DOT com>
<201107011548 DOT p61FmWQW014052 AT envy DOT delorie DOT com>
<BANLkTinA0i1sOT4tM4igv6Y1aR+3vdnNJg AT mail DOT gmail DOT com>
<201107011557 DOT p61FvXVP014582 AT envy DOT delorie DOT com>
<BANLkTim-07ErkunBix8U46KYFF497HKAPA AT mail DOT gmail DOT com>
<201107011614 DOT p61GEu8r015173 AT envy DOT delorie DOT com>
<4E0DFC80 DOT 2070607 AT iki DOT fi>
<BANLkTinPMEVyiceCG5QEjRDsTwqWqfUuGg AT mail DOT gmail DOT com>
<BANLkTi=+dUg8py11+BweccQtUdum1pxApA AT mail DOT gmail DOT com>
<201107011734 DOT p61HYlRK019374 AT envy DOT delorie DOT com>
<BANLkTi=rTRfAoChLEvb+2QCFQNYkcFKTQg AT mail DOT gmail DOT com>
<201107011753 DOT p61Hr3XO020234 AT envy DOT delorie DOT com>
Date: Fri, 1 Jul 2011 21:12:15 +0300
Message-ID: <BANLkTinrOAihDo1B_uTbWccdOKfFXs7ujw@mail.gmail.com>
Subject: Re: gcc-4.4: conflicting types for built-in function 'cabs' and 'cabsf'
From: Ozkan Sezer <sezeroz AT gmail DOT com>
To: djgpp-workers AT delorie DOT com
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, Jul 1, 2011 at 8:53 PM, DJ Delorie <dj AT delorie DOT com> wrote:
>
>> Old gcc?
>
> Do we really want to support gcc older than 2.95 ?
>

I guess not.

Quick'n'dirty patch below. Tested comqilation using gcc-3.3.6
and 4.4.7.  (Can't test anything older than 3.3 at the moment.)
If OK, use it and abuse it.

Index: w_cabs.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/w_cabs.c,v
retrieving revision 1.3
diff -u -p -r1.3 w_cabs.c
--- w_cabs.c	14 Dec 1999 12:01:34 -0000	1.3
+++ w_cabs.c	1 Jul 2011 18:01:44 -0000
@@ -9,18 +9,8 @@

 #include "fdlibm.h"

-struct complex {
-	double x;
-	double y;
-};
-
-#ifdef __STDC__
-double cabs(struct complex);
-double cabs(struct complex z)
-#else
-double cabs(z)
-     struct complex z;
-#endif
+double cabs(double _Complex);
+double cabs(double _Complex z)
 {
-	return hypot(z.x, z.y);
+	return hypot(__real__ z, __imag__ z);
 }
Index: wf_cabs.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/wf_cabs.c,v
retrieving revision 1.3
diff -u -p -r1.3 wf_cabs.c
--- wf_cabs.c	14 Dec 1999 12:01:34 -0000	1.3
+++ wf_cabs.c	1 Jul 2011 18:01:44 -0000
@@ -9,18 +9,8 @@

 #include "fdlibm.h"

-struct complex {
-	float x;
-	float y;
-};
-
-#ifdef __STDC__
-float cabsf(struct complex);
-float cabsf(struct complex z)
-#else
-float cabsf(z)
-	struct complex z;
-#endif
+float cabsf(float _Complex);
+float cabsf(float _Complex z)
 {
-	return hypotf(z.x, z.y);
+	return hypotf(__real__ z, __imag__ z);
 }


--
O.S.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019