]> Savannah Git Hosting - gnulib.git/commitdiff
unistd: stddef.h and sys/types.h namespace cleanup
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Jun 2019 18:54:00 +0000 (11:54 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Jun 2019 18:54:27 +0000 (11:54 -0700)
* 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
lib/unistd.in.h

index 8a4763aad75c0f6677e565e335c2d16bae1925eb..1ce1c16b2137bb798edc92335ed2c867e8d1e00f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2019-06-24  Paul Eggert  <eggert@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  <akim@lrde.epita.fr>
 
        maintainer-makefile: restore portability to non-GNU awks
index 9ffb2e990077c2167998d0b1dae5847de7ee9624..032cc933d1477ec7bffd02c44914e23f2394282c 100644 (file)
 #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
 
 /* 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