From brooks@sense-brooks-226.oz.net  Mon Dec 27 17:04:01 1999
Return-Path: <brooks@sense-brooks-226.oz.net>
Received: from sense-brooks-226.oz.net (sense-brooks-226.oz.net [216.39.156.226])
	by hub.freebsd.org (Postfix) with ESMTP id EBE2A150DE
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Dec 1999 17:03:59 -0800 (PST)
	(envelope-from brooks@sense-brooks-226.oz.net)
Received: (from brooks@localhost)
	by sense-brooks-226.oz.net (8.9.3/8.9.3) id RAA01945;
	Mon, 27 Dec 1999 17:06:33 -0800 (PST)
	(envelope-from brooks)
Message-Id: <199912280106.RAA01945@sense-brooks-226.oz.net>
Date: Mon, 27 Dec 1999 17:06:33 -0800 (PST)
From: brooks@one-eyed-alien.net
Sender: brooks@sense-brooks-226.oz.net
Reply-To: brooks@one-eyed-alien.net
To: FreeBSD-gnats-submit@freebsd.org
Subject: ieeefp.h is broken on i386 with gcc -ansi
X-Send-Pr-Version: 3.2

>Number:         15730
>Category:       misc
>Synopsis:       ieeefp.h is broken on i386 with gcc -ansi
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    sheldonh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 17:10:01 PST 1999
>Closed-Date:    Wed Dec 29 06:11:58 PST 1999
>Last-Modified:  Wed Dec 29 06:13:07 PST 1999
>Originator:     Brooks Davis
>Release:        FreeBSD 3.4-RC i386
>Organization:
The Aerospace Corp.
>Environment:

FreeBSD minya 3.4-RC FreeBSD 3.4-RC #3: Mon Dec 27 12:56:23 PST 1999     root@minya:/usr/src/sys/compile/MINYA-DEV  i386

>Description:

The problem is two-fold.  First, fpgetround(3) tells you to include
floatingpoint.h in the SYNOPSIS which is non-portable as Solaris and
Irix both seem to require that you include ieeefp.h to use the functions
described in fpgetround.3.  Second, when attempting to include ieeefp.h
instead of floatingpoint.h, i386 is not defined so
machine/floatingpoint.h is not included and the compiler exits with
errors like this:

cc -c main.c -DASTROLIB=1  -DLOTHRST=1 -g -Wall -ansi -pedantic -O2
-DMAXCHR=256 -I../perfct -I../lib/ad_c  -I../lib/lothrst -I../lib/jak
In file included from main.c:6:
/usr/include/ieeefp.h:18: parse error before `fpgetround'
/usr/include/ieeefp.h:18: ANSI C forbids data definition with no type or storage class
/usr/include/ieeefp.h:19: parse error before `fpsetround'
/usr/include/ieeefp.h:19: warning: parameter names (without types) in function declaration
/usr/include/ieeefp.h:19: ANSI C forbids data definition with no type or storage class

>How-To-Repeat:

Try to compile a program including ieeefp.h with the -ansi option on
FreeBSD 3.x.

>Fix:

This patch fixes fpgetround(3) to act like other platforms.

Index: fpgetround.3
===================================================================
RCS file: /home/ncvs/src/share/man/man3/fpgetround.3,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 fpgetround.3
--- fpgetround.3	1999/08/29 16:45:39	1.6.2.1
+++ fpgetround.3	1999/12/28 00:42:22
@@ -46,7 +46,7 @@
 .Nm fpresetsticky
 .Nd IEEE floating point interface
 .Sh SYNOPSIS
-.Fd #include <floatingpoint.h>
+.Fd #include <ieeefp.h>
 .Ft typedef enum {
 .br
 .Fa 	FP_RN,	


 This patch fixes /usr/include/ieeefp.h.  It is identical to rev 1.2.

--- ieeefp.h.orig	Thu Jul  1 11:24:40 1999
+++ ieeefp.h	Mon Dec 27 16:37:47 1999
@@ -11,9 +11,9 @@
 #include <sys/cdefs.h>
 #include <machine/ieeefp.h>
 
-#ifdef	i386
+#ifdef __i386__
 #include <machine/floatingpoint.h>
-#else
+#else /* !__i386__ */
 __BEGIN_DECLS
 extern fp_rnd    fpgetround __P((void));
 extern fp_rnd    fpsetround __P((fp_rnd));
@@ -22,6 +22,6 @@
 extern fp_except fpgetsticky __P((void));
 extern fp_except fpsetsticky __P((fp_except));
 __END_DECLS
-#endif /* i386 */
+#endif /* __i386__ */
 
 #endif /* _IEEEFP_H_ */

>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: brooks@one-eyed-alien.net
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, bde@FreeBSD.org
Subject: Re: misc/15730: ieeefp.h is broken on i386 with gcc -ansi 
Date: Wed, 29 Dec 1999 13:15:49 +0200

 On Mon, 27 Dec 1999 17:06:33 PST, brooks@one-eyed-alien.net wrote:
 
 > The problem is two-fold.  First, fpgetround(3) tells you to include
 > floatingpoint.h in the SYNOPSIS which is non-portable as Solaris and
 > Irix both seem to require that you include ieeefp.h to use the functions
 > described in fpgetround.3.
 
 That problem was fixed shortly after 3.4-RELEASE. :-)
 
 > Second, when attempting to include ieeefp.h instead of
 > floatingpoint.h, i386 is not defined so machine/floatingpoint.h is not
 > included and the compiler exits with errors like this:
 
 This problem was addressed in rev 1.2 of src/include/ieeefp.h, but never
 merged back to stable.
 
 I've copied Bruce Evans, who committed that revision, so that he can
 give us a thumbs up on the MFC. :-)
 
 Ciao,
 Sheldon.
 
State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Wed Dec 29 06:11:58 PST 1999 
State-Changed-Why:  
I was being silly waiting for Bruce -- the MFC is obviously 
necessary. :-) 

Fixed in rev 1.1.2.2 of src/include/ieeefp.h . 


Responsible-Changed-From-To: freebsd-bugs->sheldonh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Dec 29 06:11:58 PST 1999 
Responsible-Changed-Why:  
I did it. 
>Unformatted:
