Bug 15730

Summary: ieeefp.h is broken on i386 with gcc -ansi
Product: Base System Reporter: brooks <brooks>
Component: miscAssignee: Sheldon Hearn <sheldonh>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description brooks 1999-12-28 01:10:01 UTC
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

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

This patch fixes /usr/include/ieeefp.h.  It is identical to rev 1.2.
How-To-Repeat: 
Try to compile a program including ieeefp.h with the -ansi option on
FreeBSD 3.x.
Comment 1 Sheldon Hearn 1999-12-29 11:15:49 UTC
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.
Comment 2 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-29 14:11:58 UTC
State Changed
From-To: open->closed

I was being silly waiting for Bruce -- the MFC is obviously 
necessary. :-) 

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


Comment 3 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-29 14:11:58 UTC
Responsible Changed
From-To: freebsd-bugs->sheldonh

I did it.