Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Sep 2002 21:45:06 -0400
From:      Mike Barcroft <mike@FreeBSD.org>
To:        Wesley Morgan <morganw@chemikals.org>
Cc:        current@freebsd.org
Subject:   Re: i386 machine/endian.h
Message-ID:  <20020922214506.D91924@espresso.q9media.com>
In-Reply-To: <20020922205448.A80510-100000@volatile.chemikals.org>; from morganw@chemikals.org on Sun, Sep 22, 2002 at 08:59:51PM -0400
References:  <20020922205448.A80510-100000@volatile.chemikals.org>

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

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Wesley Morgan <morganw@chemikals.org> writes:
> I've been playing around with lang/icc a bit, and find it quite vexing
> that machine/endian.h has macros that are ifdef'd around __GNUC__. The
> intel compiler does not like the macros, partly because they are split
> across multiple lines and possibly for other reasons.
> 
> It seems to me that making a header actually _require_ gcc-isms is
> something that the FreeBSD team should be working away from... Would it
> not be possible to put make some more generic macros available as well?
> I'm sure it's not the only instance of similar issues, but making one
> header less gcc-dependent is a step in the right direction is it not?

This was my fault.  I wasn't paying attention closely to issues with
other compilers.  I've had the attached patch in my local tree for
some time, but haven't had a chance to test it with ICC.  Can you
confirm it fixes the issues you're seeing?

Best regards,
Mike Barcroft

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="endian.diff"

Be careful not to define GCC-specific optimizations in the non-GCC
case.

Index: endian.h
===================================================================
RCS file: /work/repo/src/sys/i386/include/endian.h,v
retrieving revision 1.34
diff -u -r1.34 endian.h
--- endian.h	21 Aug 2002 16:19:58 -0000	1.34
+++ endian.h	22 Aug 2002 00:29:19 -0000
@@ -117,11 +117,18 @@
 	return (__byte_swap_word(_x));
 }
 
-#endif /* __GNUC__ */
-
 #define	__htonl(x)	__bswap32(x)
 #define	__htons(x)	__bswap16(x)
 #define	__ntohl(x)	__bswap32(x)
 #define	__ntohs(x)	__bswap16(x)
+
+#else /* !__GNUC__ */
+
+#undef htonl
+#undef htons
+#undef ntohl
+#undef ntohl
+
+#endif /* __GNUC__ */
 
 #endif /* !_MACHINE_ENDIAN_H_ */

--DocE+STaALJfprDB--

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?20020922214506.D91924>