From acd7f096d79c181866d56d4aaf3b043e741f1e2c Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 21 Feb 2014 21:45:26 +0000 Subject: Complete _BSD_SOURCE / _SVID_source followup cleanup. This patch completes the headers cleanup consequent on removal of _BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations): * #endif conditionals that referred to BSD or SVID are updated. * Redundant __USE_* tests in cases involving __USE_MISC are removed. This includes cases such as __USE_MISC || __USE_ISOC99, where __USE_MISC is redundant (because __USE_MISC is only ever defined in the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99 is also defined; the same applies to the non-XSI-extended POSIX versions), and cases involving __USE_GNU, where __USE_GNU is redundant (because if __USE_GNU is defined, so are the other __USE_* macros). There may well be other cases of __USE_FOO || __USE_BAR tests that could be simplified because one macro implies the other; this patch only addresses cases involving __USE_MISC. Tested x86_64. * bits/fcntl.h [__USE_MISC]: Remove redundant conditionals. * bits/sigaction.h [__USE_MISC]: Likewise. * bits/waitstatus.h: Update #endif comments. * ctype/ctype.h: Likewise. * dirent/dirent.h: Likewise. [__USE_MISC]: Remove redundant conditionals. * grp/grp.h: Update #endif comments. [__USE_GNU]: Remove redundant conditionals. [__USE_MISC]: Likewise. * inet/netinet/in.h [__USE_GNU]: Likewise. * io/sys/stat.h [__USE_MISC]: Likewise. * libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise. * libio/bits/stdio.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * libio/bits/stdio2.h [__USE_MISC]: Likewise. * libio/stdio.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * math/bits/math-finite.h [__USE_MISC]: Likewise. * math/bits/mathcalls.h [__USE_MISC]: Likewise. * math/math.h: Update #else and #endif comments. [__USE_MISC]: Remove redundant conditionals. * misc/sys/uio.h: Update #endif comments. * posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals. * posix/glob.h [__USE_MISC]: Likewise. * posix/sys/types.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * posix/sys/wait.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * posix/unistd.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * pwd/pwd.h [__USE_GNU]: Likewise. [__USE_MISC]: Likewise. * resolv/netdb.h [__USE_GNU]: Likewise. * signal/signal.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * stdlib/stdlib.h: Update #else and #endif comments. [__USE_MISC]: Remove redundant conditionals. [__USE_GNU]: Likewise. * string/bits/string2.h [__USE_MISC]: Likewise. * string/string.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]: Likewise. * sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise. * sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif comments. [__USE_MISC]: Remove redundant conditionals. * sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise. * sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise. * sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise. * sysdeps/x86/bits/string.h: Update #endif comments. * sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant conditionals. * time/sys/time.h: Update #endif comments. * time/time.h: Likewise. [__USE_MISC]: Remove redundant conditionals. --- posix/bits/unistd.h | 2 +- posix/glob.h | 2 +- posix/sys/types.h | 4 ++-- posix/sys/wait.h | 10 +++++----- posix/unistd.h | 40 ++++++++++++++++++++-------------------- 5 files changed, 29 insertions(+), 29 deletions(-) (limited to 'posix') diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h index d377d28..41cf728 100644 --- a/posix/bits/unistd.h +++ b/posix/bits/unistd.h @@ -119,7 +119,7 @@ pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) # endif #endif -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K extern ssize_t __readlink_chk (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) diff --git a/posix/glob.h b/posix/glob.h index c003643..5e46bc3 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -45,7 +45,7 @@ typedef __SIZE_TYPE__ size_t; #define GLOB_NOESCAPE (1 << 6)/* Backslashes don't quote metacharacters. */ #define GLOB_PERIOD (1 << 7)/* Leading `.' can be matched by metachars. */ -#if !defined __USE_POSIX2 || defined __USE_MISC || defined __USE_GNU +#if !defined __USE_POSIX2 || defined __USE_MISC # define GLOB_MAGCHAR (1 << 8)/* Set in gl_flags if any metachars seen. */ # define GLOB_ALTDIRFUNC (1 << 9)/* Use gl_opendir et al functions. */ # define GLOB_BRACE (1 << 10)/* Expand "{a,b}" to "a" "b". */ diff --git a/posix/sys/types.h b/posix/sys/types.h index 3681813..04ebe34 100644 --- a/posix/sys/types.h +++ b/posix/sys/types.h @@ -99,7 +99,7 @@ typedef __pid_t pid_t; # define __pid_t_defined #endif -#if (defined __USE_MISC || defined __USE_XOPEN || defined __USE_XOPEN2K8) \ +#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \ && !defined __id_t_defined typedef __id_t id_t; # define __id_t_defined @@ -220,7 +220,7 @@ typedef int register_t __attribute__ ((__mode__ (__word__))); /* BSD defines these symbols, so we follow. */ # include -#endif /* Use BSD. */ +#endif /* Use misc. */ #if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \ diff --git a/posix/sys/wait.h b/posix/sys/wait.h index e243db3..bff478a 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -65,13 +65,13 @@ typedef union # define __WAIT_STATUS_DEFN int * # endif -# else /* Don't use BSD. */ +# else /* Don't use misc. */ # define __WAIT_INT(status) (status) # define __WAIT_STATUS int * # define __WAIT_STATUS_DEFN int * -# endif /* Use BSD. */ +# endif /* Use misc. */ /* This will define all the `__W*' macros. */ # include @@ -95,7 +95,7 @@ typedef union #endif /* The following values are used by the `waitid' function. */ -#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_XOPEN2K8 +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 typedef enum { P_ALL, /* Wait for any child. */ @@ -135,7 +135,7 @@ extern __pid_t wait (__WAIT_STATUS __stat_loc); __THROW. */ extern __pid_t waitpid (__pid_t __pid, int *__stat_loc, int __options); -#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_XOPEN2K8 +#if defined __USE_XOPEN || defined __USE_XOPEN2K8 # ifndef __id_t_defined # include typedef __id_t id_t; @@ -178,7 +178,7 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage) __THROWNL; -#endif /* Use BSD. */ +#endif /* Use misc. */ __END_DECLS diff --git a/posix/unistd.h b/posix/unistd.h index 52e9178..ac81d92 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -262,7 +262,7 @@ typedef __pid_t pid_t; # endif #endif /* X/Open */ -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K # ifndef __intptr_t_defined typedef __intptr_t intptr_t; # define __intptr_t_defined @@ -473,7 +473,7 @@ extern int pause (void); extern int chown (const char *__file, __uid_t __owner, __gid_t __group) __THROW __nonnull ((1)) __wur; -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Change the owner and group of the file that FD is open on. */ extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur; @@ -483,7 +483,7 @@ extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur; extern int lchown (const char *__file, __uid_t __owner, __gid_t __group) __THROW __nonnull ((1)) __wur; -#endif /* Use BSD || X/Open Unix. */ +#endif /* Use X/Open Unix. */ #ifdef __USE_ATFILE /* Change the owner and group of FILE relative to the directory FD is open @@ -496,7 +496,7 @@ extern int fchownat (int __fd, const char *__file, __uid_t __owner, /* Change the process's working directory to PATH. */ extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur; -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Change the process's working directory to the one FD is open on. */ extern int fchdir (int __fd) __THROW __wur; #endif @@ -659,7 +659,7 @@ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; This is exactly the same as `setpgid (0, 0)'. */ extern int setpgrp (void) __THROW; -#endif /* Use SVID or BSD. */ +#endif /* Use misc or X/Open. */ /* Create a new session with the calling process as its leader. The process group IDs of the session and the calling process @@ -705,10 +705,10 @@ extern int setuid (__uid_t __uid) __THROW __wur; extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW __wur; #endif -#if defined __USE_MISC || defined __USE_XOPEN2K +#ifdef __USE_XOPEN2K /* Set the effective user ID of the calling process to UID. */ extern int seteuid (__uid_t __uid) __THROW __wur; -#endif /* Use BSD. */ +#endif /* Use POSIX.1-2001. */ /* Set the group ID of the calling process to GID. If the calling process is the super-user, set the real @@ -722,10 +722,10 @@ extern int setgid (__gid_t __gid) __THROW __wur; extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW __wur; #endif -#if defined __USE_MISC || defined __USE_XOPEN2K +#ifdef __USE_XOPEN2K /* Set the effective group ID of the calling process to GID. */ extern int setegid (__gid_t __gid) __THROW __wur; -#endif /* Use BSD. */ +#endif /* Use POSIX.1-2001. */ #ifdef __USE_GNU /* Fetch the real user ID, effective user ID, and saved-set user ID, @@ -762,7 +762,7 @@ extern __pid_t fork (void) __THROWNL; replaced by a call to `execve'. Return -1 for errors, 0 to the new process, and the process ID of the new process to the old process. */ extern __pid_t vfork (void) __THROW; -#endif /* Use BSD or XPG < 7. */ +#endif /* Use misc or XPG < 7. */ /* Return the pathname of the terminal FD is open on, or NULL on errors. @@ -798,7 +798,7 @@ extern int linkat (int __fromfd, const char *__from, int __tofd, __THROW __nonnull ((2, 4)) __wur; #endif -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K /* Make a symbolic link to FROM named TO. */ extern int symlink (const char *__from, const char *__to) __THROW __nonnull ((1, 2)) __wur; @@ -809,7 +809,7 @@ extern int symlink (const char *__from, const char *__to) extern ssize_t readlink (const char *__restrict __path, char *__restrict __buf, size_t __len) __THROW __nonnull ((1, 2)) __wur; -#endif /* Use BSD. */ +#endif /* Use POSIX.1-2001. */ #ifdef __USE_ATFILE /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ @@ -872,7 +872,7 @@ extern int setlogin (const char *__name) __THROW __nonnull ((1)); #endif -#if defined __USE_MISC || defined __USE_UNIX98 || defined __USE_XOPEN2K +#if defined __USE_UNIX98 || defined __USE_XOPEN2K /* Put the name of the current host in no more than LEN bytes of NAME. The result is null-terminated if LEN is large enough for the full name and the terminator. */ @@ -935,7 +935,7 @@ extern void setusershell (void) __THROW; /* Rewind and re-read the file. */ terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, redirects stdin, stdout, and stderr to /dev/null. */ extern int daemon (int __nochdir, int __noclose) __THROW __wur; -#endif /* Use BSD || X/Open. */ +#endif /* Use misc || X/Open. */ #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) @@ -946,7 +946,7 @@ extern int chroot (const char *__path) __THROW __nonnull ((1)) __wur; /* Prompt with PROMPT and read a string from the terminal without echoing. Uses /dev/tty if possible; otherwise stderr and stdin. */ extern char *getpass (const char *__prompt) __nonnull ((1)); -#endif /* Use BSD || X/Open. */ +#endif /* Use misc || X/Open. */ /* Make all changes done to FD actually appear on disk. @@ -983,10 +983,10 @@ extern int getpagesize (void) __THROW __attribute__ ((__const__)); extern int getdtablesize (void) __THROW; # endif -#endif /* Use BSD || X/Open Unix. */ +#endif /* Use misc || X/Open Unix. */ -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 +#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 /* Truncate FILE to LENGTH bytes. */ # ifndef __USE_FILE_OFFSET64 @@ -1006,9 +1006,9 @@ extern int truncate64 (const char *__file, __off64_t __length) __THROW __nonnull ((1)) __wur; # endif -#endif /* Use BSD || X/Open Unix || POSIX 2008. */ +#endif /* Use X/Open Unix || POSIX 2008. */ -#if defined __USE_MISC || defined __USE_POSIX199309 \ +#if defined __USE_POSIX199309 \ || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K /* Truncate the file FD is open on to LENGTH bytes. */ @@ -1026,7 +1026,7 @@ extern int __REDIRECT_NTH (ftruncate, (int __fd, __off64_t __length), extern int ftruncate64 (int __fd, __off64_t __length) __THROW __wur; # endif -#endif /* Use BSD || POSIX.1b || X/Open Unix || XPG6. */ +#endif /* Use POSIX.1b || X/Open Unix || XPG6. */ #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ -- cgit v1.1