This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
I lose? (byteorder.h)
- To: egcs Mailing List <egcs at egcs dot cygnus dot com>
- Subject: I lose? (byteorder.h)
- From: Warren Young <tangent at mail dot com>
- Date: Thu, 01 Jul 1999 21:47:01 -0600
- Organization: -ENOENT
As a result of my UnixWare 2.1.x attempts to build gcc 2.95, I just "rm
-r'd" my "egcs" directory and checked it all out again. While watching
the build proceed, I saw the following message:
fixproto: populating `include'
/usr/local/src/egcs/gcc/include/sys/byteorder.h:17: #error You lose!
This file is only useful with GNU compilers.
Is this related to the htons() thread?
As one of the people who got bit by the htons() problem on UW, I wanted
to weigh in on it before you guys came to a final solution for this
issue. To get around the htons() issue, I would pass
"-D_SYS_BYTEORDER_H" to the compiler with my Makefiles. This skips the
native UnixWare compiler's byteorder.h file in favor of the GNU one,
thus avoiding the definition conflict.
The only problem with this solution is that in addition to blocking the
UW version of htons() and friends, it also skips some important #defines
that tell other headers whether the system is big-endian or
little-endian. As far as I can tell this only rarely causes a problem,
but I found one place it does: when using raw sockets. If you use the
network packet header structures defined in the system header files,
there are sections of conditional code that control the order of some of
the elements of the structures.
The instance I ran into was that the first octet of the IP header is
split into two nibbles: the IP version number (4, usually) and the
header length. Apparently little-endian compilers swap these nibbles
with respect to their proper network order, so the header defines them
in the "wrong order" to compensate when the byte order macro is set to
indicate a little-endian machine. But, skipping the system's
byteorder.h header skips that definition.
So, before you go off wanting to replace the system header or disable
it, make sure you include all the UW behavior into the GNU version of
this header. If that's not desirable, we'd better look at other
options.
Also, this may be a FAQ, but what's the proper name for the compiler
suite now? The EGCS name is probably obsolete now, isn't it? I mean,
it's not "experimental" any more....
--
= Warren -- http://www.cyberport.com/~tangent/