1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

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.
This commit is contained in:
Joseph Myers
2014-02-13 22:07:25 +00:00
parent d668061994
commit ed9a38e21b
14 changed files with 46 additions and 33 deletions

View File

@ -1,3 +1,19 @@
2014-02-13 Joseph Myers <joseph@codesourcery.com>
* 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 <schwab@suse.de> 2014-02-13 Andreas Schwab <schwab@suse.de>
[BZ #16574] [BZ #16574]

View File

@ -41,9 +41,7 @@
# define MAP_FILE 0x0001 /* Mapped from a file or device. */ # define MAP_FILE 0x0001 /* Mapped from a file or device. */
# define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */ # define MAP_ANON 0x0002 /* Allocated from anonymous virtual memory. */
# define MAP_TYPE 0x000f /* Mask for type field. */ # define MAP_TYPE 0x000f /* Mask for type field. */
# ifdef __USE_MISC # define MAP_ANONYMOUS MAP_ANON /* Linux name. */
# define MAP_ANONYMOUS MAP_ANON /* Linux name. */
# endif
#endif #endif
/* Sharing types (must choose one and only one of these). */ /* Sharing types (must choose one and only one of these). */

View File

@ -143,7 +143,7 @@ __END_NAMESPACE_C99
extern int isctype (int __c, int __mask) __THROW; extern int isctype (int __c, int __mask) __THROW;
#endif #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 /* Return nonzero iff C is in the ASCII set
(i.e., is no more than 7 bits wide). */ (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)) # define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c))
# endif /* Optimizing gcc */ # 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 isascii(c) __isascii (c)
# define toascii(c) __toascii (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)) # 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 __isascii_l(c,l) ((l), __isascii (c))
# define __toascii_l(c,l) ((l), __toascii (c)) # define __toascii_l(c,l) ((l), __toascii (c))
# endif # endif
@ -335,7 +335,7 @@ extern int toupper_l (int __c, __locale_t __l) __THROW;
# define isblank_l(c,l) __isblank_l ((c), (l)) # 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 isascii_l(c,l) __isascii_l ((c), (l))
# define toascii_l(c,l) __toascii_l ((c), (l)) # define toascii_l(c,l) __toascii_l ((c), (l))
# endif # endif

View File

@ -60,7 +60,7 @@ typedef __ino64_t ino64_t;
#include <bits/dirent.h> #include <bits/dirent.h>
#if (defined __USE_MISC || defined __USE_MISC) && !defined d_fileno #if defined __USE_MISC && !defined d_fileno
# define d_ino d_fileno /* Backward compatibility. */ # define d_ino d_fileno /* Backward compatibility. */
#endif #endif
@ -207,7 +207,7 @@ extern int readdir64_r (DIR *__restrict __dirp,
/* Rewind DIRP to the beginning of the directory. */ /* Rewind DIRP to the beginning of the directory. */
extern void rewinddir (DIR *__dirp) __THROW __nonnull ((1)); 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 <bits/types.h> # include <bits/types.h>
/* Seek to position POS on DIRP. */ /* 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)); extern long int telldir (DIR *__dirp) __THROW __nonnull ((1));
#endif #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. */ /* Return the file descriptor used by DIRP. */
extern int dirfd (DIR *__dirp) __THROW __nonnull ((1)); 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) # define dirfd(dirp) _DIR_dirfd (dirp)
# endif # endif
# if defined __USE_MISC || defined __USE_MISC # ifdef __USE_MISC
# ifndef MAXNAMLEN # ifndef MAXNAMLEN
/* Get the definitions of the POSIX.1 limits. */ /* Get the definitions of the POSIX.1 limits. */
# include <bits/posix1_lim.h> # include <bits/posix1_lim.h>
@ -343,7 +343,7 @@ extern int alphasort64 (const struct dirent64 **__e1,
#endif /* Use BSD or misc or XPG7. */ #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. /* Read directory entries from FD into BUF, reading at most NBYTES.
Reading starts at offset *BASEP, and *BASEP is updated with the new Reading starts at offset *BASEP, and *BASEP is updated with the new
position after reading. Returns the number of bytes read; zero when at position after reading. Returns the number of bytes read; zero when at

View File

@ -54,7 +54,7 @@ struct group
#endif #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. /* Rewind the group-file stream.
This function is a possible cancellation point and therefore not This function is a possible cancellation point and therefore not
@ -62,7 +62,7 @@ struct group
extern void setgrent (void); extern void setgrent (void);
#endif #endif
#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \
|| defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8
/* Close the group-file stream. /* Close the group-file stream.

View File

@ -87,7 +87,7 @@ typedef __pid_t pid_t;
# define S_ISUID __S_ISUID /* Set user ID on execution. */ # define S_ISUID __S_ISUID /* Set user ID on execution. */
# define S_ISGID __S_ISGID /* Set group 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. */ /* Save swapped text after use (sticky bit). This is pretty well obsolete. */
# define S_ISVTX __S_ISVTX # define S_ISVTX __S_ISVTX
# endif # endif

View File

@ -104,7 +104,7 @@ __BEGIN_DECLS
#include <bits/stat.h> #include <bits/stat.h>
#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN #if defined __USE_MISC || defined __USE_XOPEN
# define S_IFMT __S_IFMT # define S_IFMT __S_IFMT
# define S_IFDIR __S_IFDIR # define S_IFDIR __S_IFDIR
# define S_IFCHR __S_IFCHR # define S_IFCHR __S_IFCHR
@ -116,7 +116,7 @@ __BEGIN_DECLS
# ifdef __S_IFLNK # ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK # define S_IFLNK __S_IFLNK
# endif # endif
# if (defined __USE_MISC || defined __USE_MISC || defined __USE_UNIX98) \ # if (defined __USE_MISC || defined __USE_UNIX98) \
&& defined __S_IFSOCK && defined __S_IFSOCK
# define S_IFSOCK __S_IFSOCK # define S_IFSOCK __S_IFSOCK
# endif # endif
@ -164,7 +164,7 @@ __BEGIN_DECLS
#define S_ISUID __S_ISUID /* Set user ID on execution. */ #define S_ISUID __S_ISUID /* Set user ID on execution. */
#define S_ISGID __S_ISGID /* Set group 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. */ /* Save swapped text after use (sticky bit). This is pretty well obsolete. */
# define S_ISVTX __S_ISVTX # define S_ISVTX __S_ISVTX
#endif #endif
@ -175,7 +175,7 @@ __BEGIN_DECLS
/* Read, write, and execute by owner. */ /* Read, write, and execute by owner. */
#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC) #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_IREAD S_IRUSR
# define S_IWRITE S_IWUSR # define S_IWRITE S_IWUSR
# define S_IEXEC S_IXUSR # 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 /* Create a device file named PATH, with permission and special bits MODE
and device number DEV (which can be constructed from major and minor and device number DEV (which can be constructed from major and minor
device numbers with the `makedev' macro above). */ 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) extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev)
__THROW __nonnull ((1)); __THROW __nonnull ((1));
@ -478,7 +478,7 @@ __NTH (fstatat (int __fd, const char *__filename, struct stat *__statbuf,
} }
# endif # endif
# if defined __USE_MISC || defined __USE_MISC # ifdef __USE_MISC
__extern_inline int __extern_inline int
__NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev)) __NTH (mknod (const char *__path, __mode_t __mode, __dev_t __dev))
{ {

View File

@ -604,7 +604,7 @@ extern int putchar_unlocked (int __c);
#endif /* Use POSIX or MISC. */ #endif /* Use POSIX or MISC. */
#if defined __USE_MISC || defined __USE_MISC \ #if defined __USE_MISC \
|| (defined __USE_XOPEN && !defined __USE_XOPEN2K) || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
/* Get a word (int) from STREAM. */ /* Get a word (int) from STREAM. */
extern int getw (FILE *__stream); extern int getw (FILE *__stream);
@ -864,8 +864,7 @@ extern int fileno_unlocked (FILE *__stream) __THROW __wur;
#endif #endif
#if (defined __USE_POSIX2 || defined __USE_MISC || defined __USE_MISC || \ #if defined __USE_POSIX2 || defined __USE_MISC
defined __USE_MISC)
/* Create a new stream connected to a pipe running the given command. /* Create a new stream connected to a pipe running the given command.
This function is a possible cancellation point and therefore not This function is a possible cancellation point and therefore not

View File

@ -645,7 +645,7 @@ extern __pid_t getpgid (__pid_t __pid) __THROW;
If PGID is zero, the process ID of the process is used. */ If PGID is zero, the process ID of the process is used. */
extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW; 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 /* Both System V and BSD have `setpgrp' functions, but with different
calling conventions. The BSD function is the same as POSIX.1 `setpgid' calling conventions. The BSD function is the same as POSIX.1 `setpgid'
(above). The System V function takes no arguments and puts the calling (above). The System V function takes no arguments and puts the calling

View File

@ -64,7 +64,7 @@ struct passwd
#endif #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. /* Rewind the password-file stream.
This function is a possible cancellation point and therefore not 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 other reentrant functions so the chances are good this is what the
POSIX people would choose. */ 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 /* This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and or due to the implementation it is a cancellation point and

View File

@ -310,7 +310,7 @@ extern long int a64l (const char *__s)
#endif /* Use SVID || extended X/Open. */ #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 <sys/types.h> /* we need int32_t... */ # include <sys/types.h> /* we need int32_t... */
/* These are the functions that actually do things. The `random', `srandom', /* These are the functions that actually do things. The `random', `srandom',
@ -488,7 +488,7 @@ __END_NAMESPACE_STD
extern void cfree (void *__ptr) __THROW; extern void cfree (void *__ptr) __THROW;
#endif /* Use misc. */ #endif /* Use misc. */
#if defined __USE_GNU || defined __USE_MISC || defined __USE_MISC #if defined __USE_GNU || defined __USE_MISC
# include <alloca.h> # include <alloca.h>
#endif /* Use GNU, BSD, or misc. */ #endif /* Use GNU, BSD, or misc. */

View File

@ -1287,7 +1287,7 @@ extern char *__strdup (const char *__string) __THROW __attribute_malloc__;
__retval; })) \ __retval; })) \
: __strdup (s))) : __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) # define strdup(s) __strdup (s)
# endif # endif
# endif # endif

View File

@ -54,7 +54,7 @@ __END_NAMESPACE_STD
/* Copy no more than N bytes of SRC to DEST, stopping when C is found. /* 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, 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. */ 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, extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
int __c, size_t __n) int __c, size_t __n)
__THROW __nonnull ((1, 2)); __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)); __locale_t __l) __THROW __nonnull ((2, 4));
#endif #endif
#if defined __USE_MISC || defined __USE_MISC || defined __USE_XOPEN_EXTENDED \ #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED \
|| defined __USE_XOPEN2K8 || defined __USE_XOPEN2K8
/* Duplicate S, returning an identical malloc'd string. */ /* Duplicate S, returning an identical malloc'd string. */
extern char *strdup (const char *__s) extern char *strdup (const char *__s)

View File

@ -74,7 +74,7 @@ __BEGIN_NAMESPACE_STD
/* Returned by `time'. */ /* Returned by `time'. */
typedef __time_t time_t; typedef __time_t time_t;
__END_NAMESPACE_STD __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) __USING_NAMESPACE_STD(time_t)
#endif #endif