Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Dec 1999 17:06:33 -0800 (PST)
From:      brooks@one-eyed-alien.net
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/15730: ieeefp.h is broken on i386 with gcc -ansi
Message-ID:  <199912280106.RAA01945@sense-brooks-226.oz.net>

next in thread | raw e-mail | index | archive | help

>Number:         15730
>Category:       misc
>Synopsis:       ieeefp.h is broken on i386 with gcc -ansi
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 27 17:10:01 PST 1999
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912280106.RAA01945>