delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/08/20/08:54:59

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Sat, 20 Aug 2011 15:52:58 +0300
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: [PATCH] fix cabs and cabsf build failure with gcc-4.4, test results
In-reply-to: <CAA2C=vAjAgCxQqu1bJGE05Rbjd+6b7z_2xKZ=YHYfsKr5uKptQ@mail.gmail.com>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-id: <83ty9c453p.fsf@gnu.org>
References: <CAA2C=vCABbghMEVV2Hss+eXcmkFxuHA+dE6+Nc+-yzw-cHv1YA AT mail DOT gmail DOT com> <CAA2C=vBLXmFb9Pu7nmivBhiOGs=VghZ8f90CvcAk+ijV3+Cq+A AT mail DOT gmail DOT com> <CAA2C=vAjAgCxQqu1bJGE05Rbjd+6b7z_2xKZ=YHYfsKr5uKptQ AT mail DOT gmail 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

> Date: Sat, 20 Aug 2011 14:26:18 +0300
> From: Ozkan Sezer <sezeroz AT gmail DOT com>
> 
> PING^2

Sorry for the delay.  I applied the patch now, with 3 changes:

 . I added a Copyright year to each file to indicate a change in the
   year 2011.

 . I used "_Complex double" and "_Complex float" in the declarations,
   not "double _Complex" etc., as the GCC manual seems to suggest the
   former.

 . I didn't remove the K&R prototypes, and instead modified them to
   fit the STDC ones.

The patch I committed appears below.  Please see if I didn't screw up
anything.

Thanks again for your work on this.

Index: src/libm/math/w_cabs.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/w_cabs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- src/libm/math/w_cabs.c	14 Dec 1999 12:01:34 -0000	1.3
+++ src/libm/math/w_cabs.c	20 Aug 2011 12:41:02 -0000	1.4
@@ -1,3 +1,4 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /*
@@ -9,18 +10,13 @@
 
 #include "fdlibm.h"
 
-struct complex {
-	double x;
-	double y;
-};
-
 #ifdef __STDC__
-double cabs(struct complex);
-double cabs(struct complex z)
+double cabs(_Complex double);
+double cabs(_Complex double z)
 #else
 double cabs(z)
-     struct complex z;
+     _Complex double z;
 #endif
 {
-	return hypot(z.x, z.y);
+	return hypot(__real__ z, __imag__ z);
 }
Index: src/libm/math/wf_cabs.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libm/math/wf_cabs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- src/libm/math/wf_cabs.c	14 Dec 1999 12:01:34 -0000	1.3
+++ src/libm/math/wf_cabs.c	20 Aug 2011 12:41:02 -0000	1.4
@@ -1,3 +1,4 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /*
@@ -9,18 +10,13 @@
 
 #include "fdlibm.h"
 
-struct complex {
-	float x;
-	float y;
-};
-
 #ifdef __STDC__
-float cabsf(struct complex);
-float cabsf(struct complex z)
+float cabsf(_Complex float);
+float cabsf(_Complex float z)
 #else
 float cabsf(z)
-	struct complex z;
+	_Complex float z;
 #endif
 {
-	return hypotf(z.x, z.y);
+	return hypotf(__real__ z, __imag__ z);
 }

- Raw text -


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