This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>


On Sat, Nov 14, 2015 at 03:41:08PM -0500, Zack Weinberg wrote:
> On Sat, Nov 14, 2015 at 4:18 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> > Roland McGrath <roland@hack.frob.com> writes:
> >
> >> What do the modern BSDs do about this issue?
> >
> > Nothing, they have the same problem.
> >
> > https://svnweb.freebsd.org/base/head/sys/sys/types.h?view=markup#l356
> >
> > (__BSD_VISIBLE is the equivalent of __USE_BSD.)
> 
> However, if I'm reading these headers correctly, FreeBSD does *not*
> include sys/types.h in stdlib.h.  (It does include sys/_types.h but I

Exactly. While I would like to get rid of _all_ implicit inclusion of
sys/sysmacros.h, I think it's the _interaction_ of these two implicit
inclusions (stdlib->sys/types and sys/types->sys/sysmacros) that's
extremely problematic. Modern software has little if any reason to
include sys/types.h anyway, but basically everything has to include
stdlib.h, and having stdlib indirectly define major() and minor() is
almost as embarassing as MSVC's defining of min() and max(). One way
or another this really needs to be fixed.

One way to fix this would be to make stdlib.h include a new header,
sys/real_types.h or something (or the FreeBSD name, sys/_types.h), and
have sys/types.h just be:

#include <sys/real_types.h>
#if ...
#include <sys/sysmacros.h>
#endif

But again I would just prefer getting rid of all implicit inclusion of
sysmacros.h.

Rich


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]