* lib/unistd.in.h [__GLIBC__]: Do not include stddef.h or sys/types.h. [!__GLIBC__]: Always include sys/types.h, since unistd.h is supposed to declare off_t and ssize_t. Problem found when looking at why @GNULIB_PWRITE@ was different from the newly-added @GNULIB_COPY_FILE_RANGE@ with respect to ssize_t. --- ChangeLog | 10 ++++++++++ lib/unistd.in.h | 17 +++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 8a4763aad..1ce1c16b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-06-24 Paul Eggert <egg...@cs.ucla.edu> + + unistd: stddef.h and sys/types.h namespace cleanup + * lib/unistd.in.h [__GLIBC__]: + Do not include stddef.h or sys/types.h. + [!__GLIBC__]: Always include sys/types.h, since unistd.h is + supposed to declare off_t and ssize_t. Problem found when looking + at why @GNULIB_PWRITE@ was different from the newly-added + @GNULIB_COPY_FILE_RANGE@ with respect to ssize_t. + 2019-06-22 Akim Demaille <a...@lrde.epita.fr> maintainer-makefile: restore portability to non-GNU awks diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 9ffb2e990..032cc933d 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -52,7 +52,10 @@ #define _@GUARD_PREFIX@_UNISTD_H /* NetBSD 5.0 mis-defines NULL. Also get size_t. */ -#include <stddef.h> +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include <stddef.h> +#endif /* mingw doesn't define the SEEK_* or *_FILENO macros in <unistd.h>. */ /* MSVC declares 'unlink' in <stdio.h>, not in <unistd.h>. We must include @@ -124,15 +127,9 @@ /* MSVC defines off_t in <sys/types.h>. May also define off_t to a 64-bit type on native Windows. */ -#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@ -/* Get off_t. */ -# include <sys/types.h> -#endif - -#if (@GNULIB_READ@ || @GNULIB_WRITE@ \ - || @GNULIB_READLINK@ || @GNULIB_READLINKAT@ \ - || @GNULIB_PREAD@ || @GNULIB_PWRITE@ || defined GNULIB_POSIXCHECK) -/* Get ssize_t. */ +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +/* Get off_t, ssize_t. */ # include <sys/types.h> #endif -- 2.21.0