From ed9a38e21b8c7b4f413d7f8e3fc183297df3c2be Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 13 Feb 2014 22:07:25 +0000 Subject: Clean up trivially redundant __USE_MISC conditionals. This patch cleans up cases of __USE_MISC that are trivially redundant after the recent substitution of __USE_MISC for __USE_BSD and __USE_SVID: either in constructs such as "defined __USE_MISC || defined __USE_MISC", or else (in the bits/mman.h case) a conditional on __USE_MISC nested inside another __USE_MISC conditional. (The cleanups remaining after this patch are still quite large, but it seems a reasonable piece to separate out.) Tested x86_64. * bits/mman.h [__USE_MISC]: Remove redundant conditionals. * ctype/ctype.h [__USE_MISC]: Likewise. * dirent/dirent.h [__USE_MISC]: Likewise. * grp/grp.h [__USE_MISC]: Likewise. * io/fcntl.h [__USE_MISC]: Likewise. * io/sys/stat.h [__USE_MISC]: Likewise. * libio/stdio.h [__USE_MISC]: Likewise. * posix/unistd.h [__USE_MISC]: Likewise. * pwd/pwd.h [__USE_MISC]: Likewise. * stdlib.h [__USE_MISC]: Likewise. * string/bits/string2.h [__USE_MISC]: Likewise. * string/string.h [__USE_MISC]: Likewise. * time/time.h [__USE_MISC]: Likewise. --- ChangeLog | 16 ++++++++++++++++ bits/mman.h | 4 +--- ctype/ctype.h | 8 ++++---- dirent/dirent.h | 10 +++++----- grp/grp.h | 4 ++-- io/fcntl.h | 2 +- io/sys/stat.h | 12 ++++++------ libio/stdio.h | 5 ++--- posix/unistd.h | 2 +- pwd/pwd.h | 4 ++-- stdlib/stdlib.h | 4 ++-- string/bits/string2.h | 2 +- string/string.h | 4 ++-- time/time.h | 2 +- 14 files changed, 46 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d060df..03b03e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2014-02-13 Joseph Myers + + * bits/mman.h [__USE_MISC]: Remove redundant conditionals. + * ctype/ctype.h [__USE_MISC]: Likewise. + * dirent/dirent.h [__USE_MISC]: Likewise. + * grp/grp.h [__USE_MISC]: Likewise. + * io/fcntl.h [__USE_MISC]: Likewise. + * io/sys/stat.h [__USE_MISC]: Likewise. + * libio/stdio.h [__USE_MISC]: Likewise. + * posix/unistd.h [__USE_MISC]: Likewise. + * pwd/pwd.h [__USE_MISC]: Likewise. + * stdlib.h [__USE_MISC]: Likewise. + * string/bits/string2.h [__USE_MISC]: Likewise. + * string/string.h [__USE_MISC]: Likewise. + * time/time.h [__USE_MISC]: Likewise. + 2014-02-13 Andreas Schwab [BZ #16574] diff --git a/bits/mman.h b/bits/mman.h index ba57af0..058c3d2 100644 --- a/bits/mman.h +++ b/bits/mman.h @@ -41,9 +41,7 @@ # define MAP_FILE 0x0001 /* Mapped from a file or device. */ # define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */ # define MAP_TYPE 0x000f /* Mask for type field. */ -# ifdef __USE_MISC -# define MAP_ANONYMOUS MAP_ANON /* Linux name. */ -# endif +# define MAP_ANONYMOUS MAP_ANON /* Linux name. */ #endif /* Sharing types (must choose one and only one of these). */ diff --git a/ctype/ctype.h b/ctype/ctype.h index e5a4592..a493b92 100644 --- a/ctype/ctype.h +++ b/ctype/ctype.h @@ -143,7 +143,7 @@ __END_NAMESPACE_C99 extern int isctype (int __c, int __mask) __THROW; #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN /* Return nonzero iff C is in the ASCII set (i.e., is no more than 7 bits wide). */ @@ -229,7 +229,7 @@ __NTH (toupper (int __c)) # define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) # endif /* Optimizing gcc */ -# if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +# if defined __USE_MISC || defined __USE_XOPEN # define isascii(c) __isascii (c) # define toascii(c) __toascii (c) @@ -316,7 +316,7 @@ extern int toupper_l (int __c, __locale_t __l) __THROW; # define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) -# if defined __USE_MISC || defined __USE_MISC +# ifdef __USE_MISC # define __isascii_l(c,l) ((l), __isascii (c)) # define __toascii_l(c,l) ((l), __toascii (c)) # endif @@ -335,7 +335,7 @@ extern int toupper_l (int __c, __locale_t __l) __THROW; # define isblank_l(c,l) __isblank_l ((c), (l)) -# if defined __USE_MISC || defined __USE_MISC +# ifdef __USE_MISC # define isascii_l(c,l) __isascii_l ((c), (l)) # define toascii_l(c,l) __toascii_l ((c), (l)) # endif diff --git a/dirent/dirent.h b/dirent/dirent.h index 24710f0..bf37a7f 100644 --- a/dirent/dirent.h +++ b/dirent/dirent.h @@ -60,7 +60,7 @@ typedef __ino64_t ino64_t; #include -#if (defined __USE_MISC || defined __USE_MISC) && !defined d_fileno +#if defined __USE_MISC && !defined d_fileno # define d_ino d_fileno /* Backward compatibility. */ #endif @@ -207,7 +207,7 @@ extern int readdir64_r (DIR *__restrict __dirp, /* Rewind DIRP to the beginning of the directory. */ extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1)); -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN # include /* Seek to position POS on DIRP. */ @@ -217,7 +217,7 @@ extern void seekdir (DIR *__dirp, long int __pos) __THROW __nonnull ((1)); extern long int telldir (DIR *__dirp) __THROW __nonnull ((1)); #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN2K8 +#if defined __USE_MISC || defined __USE_XOPEN2K8 /* Return the file descriptor used by DIRP. */ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); @@ -226,7 +226,7 @@ extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); # define dirfd(dirp) _DIR_dirfd (dirp) # endif -# if defined __USE_MISC || defined __USE_MISC +# ifdef __USE_MISC # ifndef MAXNAMLEN /* Get the definitions of the POSIX.1 limits. */ # include @@ -343,7 +343,7 @@ extern int alphasort64 (const struct dirent64 **__e1, #endif /* Use BSD or misc or XPG7. */ -#if defined __USE_MISC || defined __USE_MISC +#ifdef __USE_MISC /* Read directory entries from FD into BUF, reading at most NBYTES. Reading starts at offset *BASEP, and *BASEP is updated with the new position after reading. Returns the number of bytes read; zero when at diff --git a/grp/grp.h b/grp/grp.h index 7cae768..5bdc221 100644 --- a/grp/grp.h +++ b/grp/grp.h @@ -54,7 +54,7 @@ struct group #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Rewind the group-file stream. This function is a possible cancellation point and therefore not @@ -62,7 +62,7 @@ struct group extern void setgrent (void); #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ || defined __USE_XOPEN2K8 /* Close the group-file stream. diff --git a/io/fcntl.h b/io/fcntl.h index 3848df9..cf512dd 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -87,7 +87,7 @@ typedef __pid_t pid_t; # define S_ISUID __S_ISUID /* Set user ID on execution. */ # define S_ISGID __S_ISGID /* Set group ID on execution. */ -# if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +# if defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX # endif diff --git a/io/sys/stat.h b/io/sys/stat.h index 0dbcc86..9b02703 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -104,7 +104,7 @@ __BEGIN_DECLS #include -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN # define S_IFMT __S_IFMT # define S_IFDIR __S_IFDIR # define S_IFCHR __S_IFCHR @@ -116,7 +116,7 @@ __BEGIN_DECLS # ifdef __S_IFLNK # define S_IFLNK __S_IFLNK # endif -# if (defined __USE_MISC || defined __USE_MISC || defined __USE_UNIX98) \ +# if (defined __USE_MISC || defined __USE_UNIX98) \ && defined __S_IFSOCK # define S_IFSOCK __S_IFSOCK # endif @@ -164,7 +164,7 @@ __BEGIN_DECLS #define S_ISUID __S_ISUID /* Set user ID on execution. */ #define S_ISGID __S_ISGID /* Set group ID on execution. */ -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN /* Save swapped text after use (sticky bit). This is pretty well obsolete. */ # define S_ISVTX __S_ISVTX #endif @@ -175,7 +175,7 @@ __BEGIN_DECLS /* Read, write, and execute by owner. */ #define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) -#if defined __USE_MISC && defined __USE_MISC +#ifdef __USE_MISC # define S_IREAD S_IRUSR # define S_IWRITE S_IWUSR # define S_IEXEC S_IXUSR @@ -332,7 +332,7 @@ extern int mkdirat (int __fd, const char *__path, __mode_t __mode) /* Create a device file named PATH, with permission and special bits MODE and device number DEV (which can be constructed from major and minor device numbers with the `makedev' macro above). */ -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev) __THROW __nonnull ((1)); @@ -478,7 +478,7 @@ __NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf, } # endif -# if defined __USE_MISC || defined __USE_MISC +# ifdef __USE_MISC __extern_inline int __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) { diff --git a/libio/stdio.h b/libio/stdio.h index b70e107..90a253f 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -604,7 +604,7 @@ extern int putchar_unlocked (int __c); #endif /* Use POSIX or MISC. */ -#if defined __USE_MISC || defined __USE_MISC \ +#if defined __USE_MISC \ || (defined __USE_XOPEN && !defined __USE_XOPEN2K) /* Get a word (int) from STREAM. */ extern int getw (FILE *__stream); @@ -864,8 +864,7 @@ extern int fileno_unlocked (FILE *__stream) __THROW __wur; #endif -#if (defined __USE_POSIX2 || defined __USE_MISC || defined __USE_MISC || \ - defined __USE_MISC) +#if defined __USE_POSIX2 || defined __USE_MISC /* Create a new stream connected to a pipe running the given command. This function is a possible cancellation point and therefore not diff --git a/posix/unistd.h b/posix/unistd.h index b9ff6e4..52e9178 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -645,7 +645,7 @@ extern __pid_t getpgid (__pid_t __pid) __THROW; If PGID is zero, the process ID of the process is used. */ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Both System V and BSD have `setpgrp' functions, but with different calling conventions. The BSD function is the same as POSIX.1 `setpgid' (above). The System V function takes no arguments and puts the calling diff --git a/pwd/pwd.h b/pwd/pwd.h index 7b40b48..6f3c98d 100644 --- a/pwd/pwd.h +++ b/pwd/pwd.h @@ -64,7 +64,7 @@ struct passwd #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED /* Rewind the password-file stream. This function is a possible cancellation point and therefore not @@ -131,7 +131,7 @@ extern struct passwd *getpwnam (const char *__name); other reentrant functions so the chances are good this is what the POSIX people would choose. */ -# if defined __USE_MISC || defined __USE_MISC +# ifdef __USE_MISC /* This function is not part of POSIX and therefore no official cancellation point. But due to similarity with an POSIX interface or due to the implementation it is a cancellation point and diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 6f3449b..20b79a7 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -310,7 +310,7 @@ extern long int a64l (const char *__s) #endif /* Use SVID || extended X/Open. */ -#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_MISC +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED # include /* we need int32_t... */ /* These are the functions that actually do things. The `random', `srandom', @@ -488,7 +488,7 @@ __END_NAMESPACE_STD extern void cfree (void *__ptr) __THROW; #endif /* Use misc. */ -#if defined __USE_GNU || defined __USE_MISC || defined __USE_MISC +#if defined __USE_GNU || defined __USE_MISC # include #endif /* Use GNU, BSD, or misc. */ diff --git a/string/bits/string2.h b/string/bits/string2.h index fb83579..ad7316b 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -1287,7 +1287,7 @@ extern char *__strdup (const char *__string) __THROW __attribute_malloc__; __retval; })) \ : __strdup (s))) -# if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED +# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED # define strdup(s) __strdup (s) # endif # endif diff --git a/string/string.h b/string/string.h index 9fabf2b..22ee34b 100644 --- a/string/string.h +++ b/string/string.h @@ -54,7 +54,7 @@ __END_NAMESPACE_STD /* Copy no more than N bytes of SRC to DEST, stopping when C is found. Return the position in DEST one byte past where C was copied, or NULL if C was not found in the first N bytes of SRC. */ -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN +#if defined __USE_MISC || defined __USE_XOPEN extern void *memccpy (void *__restrict __dest, const void *__restrict __src, int __c, size_t __n) __THROW __nonnull ((1, 2)); @@ -170,7 +170,7 @@ extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, __locale_t __l) __THROW __nonnull ((2, 4)); #endif -#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ +#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ || defined __USE_XOPEN2K8 /* Duplicate S, returning an identical malloc'd string. */ extern char *strdup (const char *__s) diff --git a/time/time.h b/time/time.h index 99b8474..608ab9d 100644 --- a/time/time.h +++ b/time/time.h @@ -74,7 +74,7 @@ __BEGIN_NAMESPACE_STD /* Returned by `time'. */ typedef __time_t time_t; __END_NAMESPACE_STD -#if defined __USE_POSIX || defined __USE_MISC || defined __USE_MISC +#if defined __USE_POSIX || defined __USE_MISC __USING_NAMESPACE_STD(time_t) #endif -- cgit v1.1