Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2003 02:05:58 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Terry Lambert <tlambert2@mindspring.com>, Jake Burkholder <jake@locore.ca>, sparc@FreeBSD.ORG, current@FreeBSD.ORG
Subject:   Re: [PATCH] Re: fpsetmask on sparc64
Message-ID:  <20030113100558.GA3423@dhcp01.pn.xcllnt.net>
In-Reply-To: <20030113190710.I11541-100000@gamplex.bde.org>
References:  <20030113034638.GA2310@dhcp01.pn.xcllnt.net> <20030113190710.I11541-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 13, 2003 at 07:59:30PM +1100, Bruce Evans wrote:
> 
> > The synopsis section of our manpage clearly states the inclusion
> > of <ieeefp.h>. That header file includes a machine dependent
> > counterpart <machine/ieeefp.h>. On alpha, ia64 and sparc64
> > <machine/floatingpoint.h> is empty with the exception of the
> > inclusion of <machine/ieeefp.h>.
> >
> > Hence, I would like to see the prototypes and/or implementation
> > in <machine/ieeefp.h>.
> 
> The prototypes are machine-independent, so they are correctly placed
> in <ieeefp.h>.

Agreed in principle, not in practice.

> This has the technical problem that it is difficult
> to implement declared functions as inlines (*), so we use an ugly
> i386 ifdef in <ieefp.h> to prevent them being declared.  This seems
> least evil since inlining them doesn't seem to be useful and the
> wart only affects i386's, and these functions should be obsoleted
> by the C99 functions as soon as possible.

This part is what makes me opt for moving the prototypes to the
MD header. These functions are trivial most of the time that
inlining them makes sense. I don't see why other platforms can't
or won't inline in the future.

What about signaling the MI header about the existence (or non-
existence) of inline functions and/or macros in the MD header so
that the MI header can optionally provide the prototypes? This
can be done by having the MD header define (or undefine) some
macro (or set of macros).

Also, it appears to me that we always have to provide non-inlined
versions in libc for when inlining is disabled. See ctype.h.
I may misinterpret the comment though...

> > Since on i386 <machine/floatingpoint.h>
> > also includes <machine/ieeefp.h>, we should be able to move
> > the implementation on i386 to <machine/ieeefp.h> as well. If
> > possible, I'd like to see <machine/floatingpoint.h> retired
> > unless there's a compelling reason to keep it...
> 
> There is no good reason for these to be separate, but they may be
> required for compatibility.

It appears to be mostly a FreeBSD-ism in its current form. Both
NetBSD and OpenBSD resist having it. Maybe the newer platforms
should just remove it before it grows code...

Anyone object to remove the header on at least sparc64 and ia64?
(powerpc doesn't have it -- keep it that way :-)

Am I right when I say that removing floatingpoint.h (both the MD
file and the MI link) will fix the port, independent of how we
shape ieeefp.h?

> - We implement <floatingpoint.h> as a link to <machine/floatingpoint.h>
>   to get the MD and implementation details right and the MI details wrong.
>   Perhaps the broken ports include this and not <machine/floatingpoint.h>.
>   Then they would be less broken.

Some configure scripts may check for <floatingpoint.h> for compatibility
with SunOS/Solaris. I doubt they will check <machine/floatingpoint.h>

In summary: I like Terry's second patch but am sensitive to having
the MI prototypes in <ieeefp.h> as well as allowing inlining.
What about something like the following to keep the prototypes in
<ieeefp.h>, but still allow inlining (in combination with Terrys
patch):

Index: ieeefp.h
===================================================================
RCS file: /home/ncvs/src/include/ieeefp.h,v
retrieving revision 1.6
diff -u -r1.6 ieeefp.h
--- ieeefp.h	23 Mar 2002 17:24:53 -0000	1.6
+++ ieeefp.h	13 Jan 2003 09:59:08 -0000
@@ -12,9 +12,9 @@
 #include <sys/cdefs.h>
 #include <machine/ieeefp.h>
 
-#ifdef __i386__
-#include <machine/floatingpoint.h>
-#else /* !__i386__ */
+#if !defined(_IEEEFP_INLINED_)
 __BEGIN_DECLS
 extern fp_rnd_t    fpgetround(void);
 extern fp_rnd_t    fpsetround(fp_rnd_t);
@@ -23,6 +23,6 @@
 extern fp_except_t fpgetsticky(void);
 extern fp_except_t fpsetsticky(fp_except_t);
 __END_DECLS
-#endif /* __i386__ */
+#endif /* !_IEEEFP_INLINED */
 
 #endif /* _IEEEFP_H_ */

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

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




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