Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Oct 2000 13:45:59 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Poul-Henning Kamp <phk@FreeBSD.ORG>
Cc:        current@FreeBSD.ORG
Subject:   Re: #include <struct.h> in <sys/queue.h>
Message-ID:  <Pine.BSF.4.21.0010031313320.8600-100000@besplex.bde.org>
In-Reply-To: <18798.970481178@critter>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2 Oct 2000, Poul-Henning Kamp wrote:

> Trying to compile the ircII port, it crashes with:
> 
> ===>  Building for ircii-4.4X
> cc -I. -I/usr/ports/irc/ircII/work/ircii-4.4X/include -O -pipe -DHAVE_CONFIG_H -c /usr/ports/irc/ircII/work/ircii-4.4X/source/alias.c
> In file included from /usr/include/sys/queue.h:40,
>                  from /usr/include/netinet6/in6.h:76,
>                  from /usr/include/netinet/in.h:475,
>                  from /usr/ports/irc/ircII/work/ircii-4.4X/include/irc.h:79,
>                  from /usr/ports/irc/ircII/work/ircii-4.4X/source/alias.c:35:
> /usr/ports/irc/ircII/work/ircii-4.4X/include/struct.h:51: syntax error before `_'
> 
> This is because there is a file called "struct.h" in the ircII distribution.
> 
> The addition of #include <struct.h> to <sys/queue.h> looks a bit unsettling
> to me:  A sys/* file shouldn't reference a /usr/include file I think ?

I corresponded with the author of this bug soon after it was committed, but
didn't follow up.

> Is the correct thing not to mv <struct.h> to <sys/struct.h>, create
> a <struct.h> which just pulls in <sys/struct.h> and have <sys/queue.h>
> #include <sys/struct.h> ?

Of course not.  Just expand the one macro that is used (strbase()) in the
one place that it is used in <sys/queue.h>.

I think <struct.h> should have been removed when offsetof() became
standard.  It was only used in one place in /usr/src (lastcomm).  Only
the fldsiz() macro is used there.  <struct.h> defines 2 other macros:
fldoff() and strbase().  fldoff() is a bad version of offsetof() (one
that takes a struct tag instead of a type, so it can't be used with
typedefed structs).  strbase() is now used in <sys/queue.h>.  It is
easy to implement directly using offsetof().  Unfortunately, if it is
implemented using offsetof(), then <sys/queue.h> will depend on
<stddef.h>.

Bruce



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?Pine.BSF.4.21.0010031313320.8600-100000>