From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72521 invoked by alias); 26 May 2019 16:37:44 -0000 Mailing-List: contact glibc-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: , Sender: glibc-cvs-owner@sourceware.org List-Subscribe: Received: (qmail 72504 invoked by uid 9014); 26 May 2019 16:37:44 -0000 Date: Sun, 26 May 2019 16:37:00 -0000 Message-ID: <20190526163744.72503.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Zack Weinberg To: glibc-cvs@sourceware.org Subject: [glibc/zack/no-nested-includes] Don't include sys/types.h 5/n: misc nonstandard headers X-Act-Checkin: glibc X-Git-Author: Zack Weinberg X-Git-Refname: refs/heads/zack/no-nested-includes X-Git-Oldrev: 3b6eff6f195749a07f8c13cad0ff384aad334ffa X-Git-Newrev: cf6819bb624a6a952428d8d77480b0e9972d510c X-SW-Source: 2019-q2/txt/msg00261.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=cf6819bb624a6a952428d8d77480b0e9972d510c commit cf6819bb624a6a952428d8d77480b0e9972d510c Author: Zack Weinberg Date: Sun May 26 11:49:25 2019 -0400 Don't include sys/types.h 5/n: misc nonstandard headers Many nonstandard headers can also easily avoid including sys/types.h. * elf/link.h, inet/aliases.h, misc/sys/xattr.h: Don't include sys/types.h. Include stddef.h for size_t. * gmon/sys/gmon.h: Don't include sys/types.h. * gmon/sys/profil.h: Don't include sys/types.h. Include stddef.h for size_t. Include bits/types/struct_timeval.h. * io/fts.h: Don't include sys/types.h. Include bits/types/dev_t.h, bits/types/ino_t.h, bits/types/ino64_t.h, and bits/types/nlink_t.h. * io/sys/sendfile.h: Don't include sys/types.h. Include stddef.h for size_t. Include bits/types.h, bits/types/off_t.h, and bits/types/ssize_t.h. * stdlib/sys/random.h: Don't include sys/types.h. Include stddef.h for size_t. Include bits/types/ssize_t.h. * gmon/tst-sprofil.h: Include sys/time.h. * sysdeps/mach/hurd/sendfile.c: Include sys/types.h. * scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES): Update. Diff: --- elf/link.h | 5 ++++- gmon/sys/gmon.h | 2 -- gmon/sys/profil.h | 6 ++++-- gmon/tst-sprofil.c | 1 + inet/aliases.h | 4 ++-- io/fts.h | 5 ++++- io/sys/sendfile.h | 8 +++++++- misc/sys/xattr.h | 5 ++++- scripts/check-obsolete-constructs.py | 8 +------- stdlib/sys/random.h | 5 ++++- sysdeps/mach/hurd/sendfile.c | 1 + 11 files changed, 32 insertions(+), 18 deletions(-) diff --git a/elf/link.h b/elf/link.h index 7a463bc..e3143a8 100644 --- a/elf/link.h +++ b/elf/link.h @@ -21,9 +21,12 @@ #define _LINK_H 1 #include + +#define __need_size_t +#include + #include #include -#include /* We use this macro to refer to ELF types independent of the native wordsize. `ElfW(TYPE)' is used in place of `Elf32_TYPE' or `Elf64_TYPE'. */ diff --git a/gmon/sys/gmon.h b/gmon/sys/gmon.h index b4cc3b0..5d7de0f 100644 --- a/gmon/sys/gmon.h +++ b/gmon/sys/gmon.h @@ -34,8 +34,6 @@ #include -#include - /* * See gmon_out.h for gmon.out format. */ diff --git a/gmon/sys/profil.h b/gmon/sys/profil.h index ba99ac8..e38f153 100644 --- a/gmon/sys/profil.h +++ b/gmon/sys/profil.h @@ -20,8 +20,10 @@ #include -#include -#include +#define __need_size_t +#include + +#include /* This interface is intended to follow the sprofil() system calls as described by the sprofil(2) man page of Irix v6.5, except that: diff --git a/gmon/tst-sprofil.c b/gmon/tst-sprofil.c index 3f7f909..53de7a6 100644 --- a/gmon/tst-sprofil.c +++ b/gmon/tst-sprofil.c @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/inet/aliases.h b/inet/aliases.h index 67828ca..66230b6 100644 --- a/inet/aliases.h +++ b/inet/aliases.h @@ -20,8 +20,8 @@ #include -#include - +#define __need_size_t +#include __BEGIN_DECLS diff --git a/io/fts.h b/io/fts.h index acfa260..0e43b35 100644 --- a/io/fts.h +++ b/io/fts.h @@ -51,8 +51,11 @@ #define _FTS_H 1 #include -#include +#include +#include +#include +#include typedef struct { struct _ftsent *fts_cur; /* current node */ diff --git a/io/sys/sendfile.h b/io/sys/sendfile.h index b21c085..5ed26d3 100644 --- a/io/sys/sendfile.h +++ b/io/sys/sendfile.h @@ -20,7 +20,13 @@ #define _SYS_SENDFILE_H 1 #include -#include + +#include +#include +#include + +#define __need_size_t +#include __BEGIN_DECLS diff --git a/misc/sys/xattr.h b/misc/sys/xattr.h index f1143f8..9531333 100644 --- a/misc/sys/xattr.h +++ b/misc/sys/xattr.h @@ -19,8 +19,11 @@ #define _SYS_XATTR_H 1 #include -#include +#define __need_size_t +#include + +#include __BEGIN_DECLS diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py index 4bc4909..4472c80 100755 --- a/scripts/check-obsolete-constructs.py +++ b/scripts/check-obsolete-constructs.py @@ -556,19 +556,17 @@ HEADER_ALLOWED_INCLUDES = { "netinet/tcp.h": [ "sys/socket.h" ], # Nonstandardized top-level headers - "aliases.h": [ "sys/types.h" ], "argp.h": [ "ctype.h", "errno.h", "getopt.h", "limits.h", "stdio.h" ], "argz.h": [ "errno.h", "string.h" ], "elf.h": [ "stdint.h" ], "envz.h": [ "argz.h", "errno.h" ], "fpregdef.h": [ "sys/fpregdef.h" ], - "fts.h": [ "sys/types.h" ], "gshadow.h": [ "paths.h" ], "ieee754.h": [ "float.h" ], "lastlog.h": [ "utmp.h" ], "libintl.h": [ "locale.h" ], - "link.h": [ "dlfcn.h", "elf.h", "sys/types.h" ], + "link.h": [ "dlfcn.h", "elf.h" ], "malloc.h": [ "stdio.h" ], "memory.h": [ "string.h" ], "mntent.h": [ "paths.h" ], @@ -603,7 +601,6 @@ HEADER_ALLOWED_INCLUDES = { "sys/fcntl.h": [ "fcntl.h" ], "sys/file.h": [ "fcntl.h" ], "sys/fsuid.h": [ "sys/types.h" ], - "sys/gmon.h": [ "sys/types.h" ], "sys/inotify.h": [ "stdint.h" ], "sys/ioctl.h": [ "sys/ttydefaults.h" ], "sys/mount.h": [ "sys/ioctl.h" ], @@ -613,12 +610,9 @@ HEADER_ALLOWED_INCLUDES = { "sys/platform/ppc.h": [ "stdint.h" ], "sys/procfs.h": [ "sys/time.h", "sys/types.h", "sys/user.h" ], - "sys/profil.h": [ "sys/time.h", "sys/types.h" ], "sys/ptrace.h": [ "sys/ucontext.h" ], "sys/quota.h": [ "sys/types.h" ], - "sys/random.h": [ "sys/types.h" ], "sys/raw.h": [ "stdint.h", "sys/ioctl.h" ], - "sys/sendfile.h": [ "sys/types.h" ], "sys/signal.h": [ "signal.h" ], "sys/signalfd.h": [ "stdint.h" ], "sys/socketvar.h": [ "sys/socket.h" ], diff --git a/stdlib/sys/random.h b/stdlib/sys/random.h index 2297edf..f3cd54e 100644 --- a/stdlib/sys/random.h +++ b/stdlib/sys/random.h @@ -20,7 +20,10 @@ #define _SYS_RANDOM_H 1 #include -#include + +#define __need_size_t +#include +#include /* Flags for use with getrandom. */ #define GRND_NONBLOCK 0x01 diff --git a/sysdeps/mach/hurd/sendfile.c b/sysdeps/mach/hurd/sendfile.c index 4857396..dbb1ab8 100644 --- a/sysdeps/mach/hurd/sendfile.c +++ b/sysdeps/mach/hurd/sendfile.c @@ -17,6 +17,7 @@ . */ #include +#include #include /* Send COUNT bytes from file associated with IN_FD starting at OFFSET to