From: Paul Eggert Date: Mon, 24 Jun 2019 18:54:00 +0000 (-0700) Subject: unistd: stddef.h and sys/types.h namespace cleanup X-Git-Tag: v1.0~4826 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a6e8a8612bd34cc60034b544c48c5b8f7f0b41fc;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 8a4763aad7..1ce1c16b21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2019-06-24 Paul Eggert + + 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 maintainer-makefile: restore portability to non-GNU awks diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 9ffb2e9900..032cc933d1 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 +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include +#endif /* mingw doesn't define the SEEK_* or *_FILENO macros in . */ /* MSVC declares 'unlink' in , not in . We must include @@ -124,15 +127,9 @@ /* MSVC defines off_t in . 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 -#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 #endif