bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compilation failure on freebsd8.0-p3 (acl-related?)


From: Bruno Haible
Subject: Re: compilation failure on freebsd8.0-p3 (acl-related?)
Date: Thu, 7 Oct 2010 00:54:30 +0200
User-agent: KMail/1.9.9

Hi Jim,

> In file included from ./unistd.h:46,
>                  from ./string.h:60,
>                  from ./sys/select.h:59,
>                  from /usr/include/sys/time.h:319,
>                  from ./sys/time.h:41,
>                  from ./sys/select.h:52,
>                  from 
> /usr/local/ashare/gcc-4.4-20100309/bin/../lib/gcc/i386-unknown-freebsd8.0/4.4.4/include-fixed/sys/types.h:327,
>                  from acl.h:20,
>                  from set-mode-acl.c:22:
> /usr/local/ashare/gcc-4.4-20100309/bin/../lib/gcc/i386-unknown-freebsd8.0/4.4.4/include-fixed/unistd.h:566:
>  error: expected declaration specifiers or '...' before 'fd_set'
> /usr/local/ashare/gcc-4.4-20100309/bin/../lib/gcc/i386-unknown-freebsd8.0/4.4.4/include-fixed/unistd.h:566:
>  error: expected declaration specifiers or '...' before 'fd_set'
> /usr/local/ashare/gcc-4.4-20100309/bin/../lib/gcc/i386-unknown-freebsd8.0/4.4.4/include-fixed/unistd.h:566:
>  error: expected declaration specifiers or '...' before 'fd_set'

The problem is that already during the include of <sys/types.h>, there is
an avalanche of #includes between gnulib headers:
  sys/select.h -> string.h -> unistd.h
And when you include <unistd.h> with only half of the system types being
defined, it's obvious that you run into uses of undefined types.

It is triggered by the recent addition of #include <unistd.h> in <string.h>.

I'm not inclined to invent yet another workaround like lib/unistd.in.h lines
23..36. It's very complex. Rather, I find it better to reduce the number of
#includes on an average platform. This also helps reducing the namespace 
pollution.
It's a little bit for fragile for the case of a new platform that has the same
bug as another platform, but less complex.

I'm therefore applying this; I hope it helps (I don't have a FreeBSD login).


2010-10-06  Bruno Haible  <address@hidden>

        string, sys_select: Avoid #including large headers unless necessary.
        * lib/string.in.h: Don't include <unistd.h> except on NetBSD.
        * lib/sys_select.in.h: Don't include <string.h> except on Solaris,
        OSF/1, BeOS, Haiku.
        Reported by Jim Meyering.

--- lib/string.in.h.orig        Thu Oct  7 00:48:26 2010
+++ lib/string.in.h     Thu Oct  7 00:39:23 2010
@@ -51,8 +51,8 @@
 #endif
 
 /* NetBSD 5.0 declares strsignal in <unistd.h>, not in <string.h>.  */
-/* But avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK)  \
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \
     && ! defined __GLIBC__
 # include <unistd.h>
 #endif
--- lib/sys_select.in.h.orig    Thu Oct  7 00:48:26 2010
+++ lib/sys_select.in.h Thu Oct  7 00:39:30 2010
@@ -51,8 +51,9 @@
 
 /* On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
    that relies on memset(), but without including <string.h>.
-   But avoid namespace pollution on glibc systems.  */
-# ifndef __GLIBC__
+   But in any case avoid namespace pollution on glibc systems.  */
+# if (defined __sun || defined __osf__ || defined __BEOS__) \
+     && ! defined __GLIBC__
 #  include <string.h>
 # endif
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]