# HG changeset patch # User Bruno Haible # Date 1289753330 -3600 # Node ID da5595160b9fdbada52b16026a4121b40b9108bf # Parent 8f6d3e05c7e2ee6555cb8b410aa1d8301dbc721e Allow multiple gnulib generated replacements to coexist. * lib/getopt.in.h (struct option): Avoid identical redefinition. * lib/inttypes.in.h (imaxdiv_t): Likewise. * lib/langinfo.in.h (nl_item): Likewise. * lib/math.in.h (_NaN, NAN): Likewise. * lib/netdb.in.h (struct addrinfo): Likewise. * lib/poll.in.h (struct pollfd, nfds_t): Likewise. * lib/pthread.in.h (pthread_t, pthread_attr_t, pthread_barrier_t, pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, pthread_key_t, pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, pthread_rwlock_t, pthread_rwlockattr_t, pthread_cond_destroy, pthread_cond_init, pthread_cond_signal, pthread_cond_wait, pthread_create, pthread_exit, pthread_join, pthread_mutexattr_destroy, pthread_mutexattr_init, pthread_mutexattr_settype, pthread_mutex_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, pthread_spinlock_t, pthread_spin_init, pthread_spin_destroy, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): Likewise. * lib/sched.in.h (struct sched_param): Likewise. * lib/se-selinux.in.h (security_class_t, security_context_t, is_selinux_enabled, getcon, freecon, getfscreatecon, setfscreatecon, matchpathcon, getfilecon, lgetfilecon, fgetfilecon, setfilecon, lsetfilecon, fsetfilecon, security_check_context, security_check_context_raw, setexeccon, matchpathcon_init_prefix): Likewise. * lib/search.in.h (VISIT, _gl_search_compar_fn, _gl_search_action_fn): Likewise. * lib/signal.in.h (sig_atomic_t, sigset_t, verify_NSIG_constraint, _gl_function_taking_int_returning_void_t, union sigval, struct siginfo_t, siginfo_t, struct sigaction): Likewise. * lib/spawn.in.h (posix_spawnattr_t, posix_spawn_file_actions_t, verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise. * lib/stdint.in.h (gl_int8_t, gl_uint8_t, gl_int16_t, gl_uint16_t, gl_int32_t, gl_uint32_t, gl_int64_t, gl_uint64_t, int_least8_t, uint_least8_t, int_least16_t, uint_least16_t, int_least32_t, uint_least32_t, int_least64_t, uint_least64_t, gl_int_fast8_t, gl_uint_fast8_t, gl_int_fast16_t, gl_uint_fast16_t, gl_int_fast32_t, gl_uint_fast32_t, int_fast64_t, uint_fast64_t, gl_intptr_t, gl_uintptr_t, intmax_t, uintmax_t, _verify_intmax_size): Likewise. * lib/stdio.in.h (rpl_fseek, rpl_ftell): Likewise. * lib/sys_socket.in.h (sa_family_t, struct sockaddr_storage, socklen_t, rpl_fd_isset): Likewise. * lib/sys_stat.in.h (rpl_mkdir): Likewise. * lib/sys_time.in.h (struct timeval): Likewise. * lib/sys_times.in.h (struct tms): Likewise. * lib/sys_utsname.in.h (struct utsname): * lib/time.in.h (struct timespec, __time_t_must_be_integral): Likewise. * lib/unistd.in.h (getpagesize): Likewise. * lib/wchar.in.h (mbstate_t): Likewise. * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit, towlower, towupper): Likewise. Reported by Sam Steingold . diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,59 @@ +2010-11-14 Bruno Haible + + Allow multiple gnulib generated replacements to coexist. + * lib/getopt.in.h (struct option): Avoid identical redefinition. + * lib/inttypes.in.h (imaxdiv_t): Likewise. + * lib/langinfo.in.h (nl_item): Likewise. + * lib/math.in.h (_NaN, NAN): Likewise. + * lib/netdb.in.h (struct addrinfo): Likewise. + * lib/poll.in.h (struct pollfd, nfds_t): Likewise. + * lib/pthread.in.h (pthread_t, pthread_attr_t, pthread_barrier_t, + pthread_barrierattr_t, pthread_cond_t, pthread_condattr_t, + pthread_key_t, pthread_mutex_t, pthread_mutexattr_t, pthread_once_t, + pthread_rwlock_t, pthread_rwlockattr_t, pthread_cond_destroy, + pthread_cond_init, pthread_cond_signal, pthread_cond_wait, + pthread_create, pthread_exit, pthread_join, pthread_mutexattr_destroy, + pthread_mutexattr_init, pthread_mutexattr_settype, + pthread_mutex_destroy, pthread_mutex_init, pthread_mutex_lock, + pthread_mutex_trylock, pthread_mutex_unlock, pthread_spinlock_t, + pthread_spin_init, pthread_spin_destroy, pthread_spin_lock, + pthread_spin_trylock, pthread_spin_unlock): Likewise. + * lib/sched.in.h (struct sched_param): Likewise. + * lib/se-selinux.in.h (security_class_t, security_context_t, + is_selinux_enabled, getcon, freecon, getfscreatecon, setfscreatecon, + matchpathcon, getfilecon, lgetfilecon, fgetfilecon, setfilecon, + lsetfilecon, fsetfilecon, security_check_context, + security_check_context_raw, setexeccon, matchpathcon_init_prefix): + Likewise. + * lib/search.in.h (VISIT, _gl_search_compar_fn, _gl_search_action_fn): + Likewise. + * lib/signal.in.h (sig_atomic_t, sigset_t, verify_NSIG_constraint, + _gl_function_taking_int_returning_void_t, union sigval, + struct siginfo_t, siginfo_t, struct sigaction): Likewise. + * lib/spawn.in.h (posix_spawnattr_t, posix_spawn_file_actions_t, + verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise. + * lib/stdint.in.h (gl_int8_t, gl_uint8_t, gl_int16_t, gl_uint16_t, + gl_int32_t, gl_uint32_t, gl_int64_t, gl_uint64_t, int_least8_t, + uint_least8_t, int_least16_t, uint_least16_t, int_least32_t, + uint_least32_t, int_least64_t, uint_least64_t, gl_int_fast8_t, + gl_uint_fast8_t, gl_int_fast16_t, gl_uint_fast16_t, gl_int_fast32_t, + gl_uint_fast32_t, int_fast64_t, uint_fast64_t, gl_intptr_t, + gl_uintptr_t, intmax_t, uintmax_t, _verify_intmax_size): Likewise. + * lib/stdio.in.h (rpl_fseek, rpl_ftell): Likewise. + * lib/sys_socket.in.h (sa_family_t, struct sockaddr_storage, + socklen_t, rpl_fd_isset): Likewise. + * lib/sys_stat.in.h (rpl_mkdir): Likewise. + * lib/sys_time.in.h (struct timeval): Likewise. + * lib/sys_times.in.h (struct tms): Likewise. + * lib/sys_utsname.in.h (struct utsname): + * lib/time.in.h (struct timespec, __time_t_must_be_integral): Likewise. + * lib/unistd.in.h (getpagesize): Likewise. + * lib/wchar.in.h (mbstate_t): Likewise. + * lib/wctype.in.h (iswalnum, iswalpha, iswblank, iswcntrl, iswdigit, + iswgraph, iswlower, iswprint, iswpunct, iswspace, iswupper, iswxdigit, + towlower, towupper): Likewise. + Reported by Sam Steingold . + 2011-02-05 Eric Blake unsetenv: work around Haiku issues diff --git a/lib/getopt.in.h b/lib/getopt.in.h --- a/lib/getopt.in.h +++ b/lib/getopt.in.h @@ -181,6 +181,7 @@ one). For long options that have a zero `flag' field, `getopt' returns the contents of the `val' field. */ +# if !GNULIB_defined_struct_option struct option { const char *name; @@ -190,6 +191,8 @@ int *flag; int val; }; +# define GNULIB_defined_struct_option 1 +# endif /* Names for the values of the `has_arg' field of `struct option'. */ diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h --- a/lib/inttypes.in.h +++ b/lib/inttypes.in.h @@ -1060,7 +1060,10 @@ #if @GNULIB_IMAXDIV@ # if !@HAVE_DECL_IMAXDIV@ +# if !GNULIB_defined_imaxdiv_t typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; +# define GNULIB_defined_imaxdiv_t 1 +# endif extern imaxdiv_t imaxdiv (intmax_t, intmax_t); # endif #elif defined GNULIB_POSIXCHECK diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h --- a/lib/langinfo.in.h +++ b/lib/langinfo.in.h @@ -41,7 +41,10 @@ /* A platform that lacks . */ /* Assume that it also lacks and the nl_item type. */ +# if !GNULIB_defined_nl_item typedef int nl_item; +# define GNULIB_defined_nl_item 1 +# endif /* nl_langinfo items of the LC_CTYPE category */ # define CODESET 10000 diff --git a/lib/math.in.h b/lib/math.in.h --- a/lib/math.in.h +++ b/lib/math.in.h @@ -73,18 +73,21 @@ it on platforms like Solaris 10, where NAN is present but defined as a function pointer rather than a floating point constant. */ #if !defined NAN || @REPLACE_NAN@ -# undef NAN +# if !GNULIB_defined_NAN +# undef NAN /* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */ -# ifdef __DECC +# ifdef __DECC static float _NaN () { static float zero = 0.0f; return zero / zero; } -# define NAN (_NaN()) -# else -# define NAN (0.0f / 0.0f) +# define NAN (_NaN()) +# else +# define NAN (0.0f / 0.0f) +# endif +# define GNULIB_defined_NAN 1 # endif #endif diff --git a/lib/netdb.in.h b/lib/netdb.in.h --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -51,6 +51,7 @@ # if !@HAVE_STRUCT_ADDRINFO@ +# if !GNULIB_defined_struct_addrinfo /* Structure to contain information about address of a service provider. */ struct addrinfo { @@ -63,6 +64,8 @@ char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; +# define GNULIB_defined_struct_addrinfo 1 +# endif # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ diff --git a/lib/poll.in.h b/lib/poll.in.h --- a/lib/poll.in.h +++ b/lib/poll.in.h @@ -54,6 +54,8 @@ # define POLLWRNORM 0x0100 # define POLLWRBAND 0x0200 +# if !GNULIB_defined_poll_types + struct pollfd { int fd; /* which file descriptor to poll */ @@ -63,6 +65,9 @@ typedef unsigned long nfds_t; +# define GNULIB_defined_poll_types 1 +# endif + /* Define INFTIM only if doing so conforms to POSIX. */ # if !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) # define INFTIM (-1) diff --git a/lib/pthread.in.h b/lib/pthread.in.h --- a/lib/pthread.in.h +++ b/lib/pthread.in.h @@ -40,6 +40,7 @@ #include #if ! @HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_types typedef int pthread_t; typedef int pthread_attr_t; typedef int pthread_barrier_t; @@ -52,6 +53,8 @@ typedef int pthread_once_t; typedef int pthread_rwlock_t; typedef int pthread_rwlockattr_t; +# define GNULIB_defined_pthread_types 1 +# endif #endif #ifndef PTHREAD_COND_INITIALIZER @@ -97,6 +100,8 @@ #if ! @HAVE_PTHREAD_T@ +# if !GNULIB_defined_pthread_functions + /* Provide substitutes for the thread functions that should work adequately on a single-threaded implementation, where pthread_create always fails. The goal is to let programs compile @@ -217,10 +222,15 @@ return 0; } +# define GNULIB_defined_pthread_functions 1 +# endif + #endif #if ! @HAVE_PTHREAD_SPINLOCK_T@ +# if !GNULIB_defined_pthread_spinlock_t + /* Approximate spinlocks with mutexes. */ typedef pthread_mutex_t pthread_spinlock_t; @@ -254,6 +264,10 @@ { return pthread_mutex_unlock (lock); } + +# define GNULIB_defined_pthread_spinlock_t 1 +# endif + #endif #endif /* _GL_PTHREAD_H_ */ diff --git a/lib/sched.in.h b/lib/sched.in.h --- a/lib/sched.in.h +++ b/lib/sched.in.h @@ -31,10 +31,13 @@ #if !@HAVE_STRUCT_SCHED_PARAM@ +# if !GNULIB_defined_struct_sched_param struct sched_param { int sched_priority; }; +# define GNULIB_defined_struct_sched_param 1 +# endif #endif diff --git a/lib/se-selinux.in.h b/lib/se-selinux.in.h --- a/lib/se-selinux.in.h +++ b/lib/se-selinux.in.h @@ -33,9 +33,11 @@ /* The definition of _GL_UNUSED_PARAMETER is copied here. */ +# if !GNULIB_defined_security_types + typedef unsigned short security_class_t; -# define security_context_t char* -# define is_selinux_enabled() 0 +# define security_context_t char* +# define is_selinux_enabled() 0 static inline int getcon (security_context_t *con _GL_UNUSED_PARAMETER) { errno = ENOTSUP; return -1; } @@ -88,5 +90,8 @@ char const *prefix _GL_UNUSED_PARAMETER) { errno = ENOTSUP; return -1; } +# define GNULIB_defined_security_types 1 +# endif + # endif #endif /* _GL_SELINUX_SELINUX_H */ diff --git a/lib/search.in.h b/lib/search.in.h --- a/lib/search.in.h +++ b/lib/search.in.h @@ -53,6 +53,7 @@ for details. */ # if !@HAVE_TSEARCH@ +# if !GNULIB_defined_search_types typedef enum { preorder, @@ -61,13 +62,18 @@ leaf } VISIT; +# define GNULIB_defined_search_types 1 +# endif # endif # ifdef __cplusplus extern "C" { # endif +# if !GNULIB_defined_search_fn_types typedef int (*_gl_search_compar_fn) (const void *, const void *); typedef void (*_gl_search_action_fn) (const void *, VISIT, int); +# define GNULIB_defined_search_fn_types 1 +# endif # ifdef __cplusplus } # endif diff --git a/lib/signal.in.h b/lib/signal.in.h --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -50,14 +50,20 @@ 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. Hence, redefine this to a non-volatile type as needed. */ #if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +# if !GNULIB_defined_sig_atomic_t typedef int rpl_sig_atomic_t; -# undef sig_atomic_t -# define sig_atomic_t rpl_sig_atomic_t +# undef sig_atomic_t +# define sig_atomic_t rpl_sig_atomic_t +# define GNULIB_defined_sig_atomic_t 1 +# endif #endif /* A set or mask of signals. */ #if !@HAVE_SIGSET_T@ +# if !GNULIB_defined_sigset_t typedef unsigned int sigset_t; +# define GNULIB_defined_sigset_t 1 +# endif #endif @@ -89,7 +95,10 @@ # endif /* This code supports only 32 signals. */ +# if !GNULIB_defined_verify_NSIG_constraint typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; +# define GNULIB_defined_verify_NSIG_constraint 1 +# endif # endif @@ -184,7 +193,10 @@ # ifdef __cplusplus extern "C" { # endif +# if !GNULIB_defined_function_taking_int_returning_void_t typedef void (*_gl_function_taking_int_returning_void_t) (int); +# define GNULIB_defined_function_taking_int_returning_void_t 1 +# endif # ifdef __cplusplus } # endif @@ -258,6 +270,9 @@ # if !@HAVE_SIGACTION@ # if !@HAVE_SIGINFO_T@ + +# if !GNULIB_defined_siginfo_types + /* Present to allow compilation, but unsupported by gnulib. */ union sigval { @@ -279,11 +294,17 @@ union sigval si_value; }; typedef struct siginfo_t siginfo_t; + +# define GNULIB_defined_siginfo_types 1 +# endif + # endif /* !@HAVE_SIGINFO_T@ */ /* We assume that platforms which lack the sigaction() function also lack the 'struct sigaction' type, and vice versa. */ +# if !GNULIB_defined_struct_sigaction + struct sigaction { union @@ -299,12 +320,15 @@ /* Not all POSIX flags are supported. */ int sa_flags; }; -# define sa_handler _sa_func._sa_handler -# define sa_sigaction _sa_func._sa_sigaction +# define sa_handler _sa_func._sa_handler +# define sa_sigaction _sa_func._sa_sigaction /* Unsupported flags are not present. */ -# define SA_RESETHAND 1 -# define SA_NODEFER 2 -# define SA_RESTART 4 +# define SA_RESETHAND 1 +# define SA_NODEFER 2 +# define SA_RESTART 4 + +# define GNULIB_defined_struct_sigaction 1 +# endif _GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict, struct sigaction *restrict)); diff --git a/lib/spawn.in.h b/lib/spawn.in.h --- a/lib/spawn.in.h +++ b/lib/spawn.in.h @@ -83,6 +83,7 @@ # define posix_spawnattr_t rpl_posix_spawnattr_t #endif #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWNATTR_T@ +# if !GNULIB_defined_posix_spawnattr_t typedef struct { short int _flags; @@ -93,6 +94,8 @@ int _policy; int __pad[16]; } posix_spawnattr_t; +# define GNULIB_defined_posix_spawnattr_t 1 +# endif #endif @@ -102,6 +105,7 @@ # define posix_spawn_file_actions_t rpl_posix_spawn_file_actions_t #endif #if @REPLACE_POSIX_SPAWN@ || !@HAVE_POSIX_SPAWN_FILE_ACTIONS_T@ +# if !GNULIB_defined_posix_spawn_file_actions_t typedef struct { int _allocated; @@ -109,6 +113,8 @@ struct __spawn_action *_actions; int __pad[16]; } posix_spawn_file_actions_t; +# define GNULIB_defined_posix_spawn_file_actions_t 1 +# endif #endif @@ -146,6 +152,7 @@ | POSIX_SPAWN_SETSCHEDULER \ | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \ + 1) +#if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK @@ -153,6 +160,8 @@ & POSIX_SPAWN_USEVFORK) == 0) ? 1 : -1]; +# define GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap 1 +#endif #if @GNULIB_POSIX_SPAWN@ diff --git a/lib/stdint.in.h b/lib/stdint.in.h --- a/lib/stdint.in.h +++ b/lib/stdint.in.h @@ -108,6 +108,8 @@ warnings in the signed case. */ \ ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) +#if !GNULIB_defined_stdint_types + /* 7.18.1.1. Exact-width integer types */ /* Here we assume a standard architecture where the hardware integer @@ -296,6 +298,9 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) ? 1 : -1]; +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ + /* 7.18.2. Limits of specified-width integer types */ #if ! defined __cplusplus || defined __STDC_LIMIT_MACROS diff --git a/lib/stdio.in.h b/lib/stdio.in.h --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -367,17 +367,20 @@ /* Provide an fseek function that is consistent with fseeko. */ /* In order to avoid that fseek gets defined as a macro here, the developer can request the 'fseek' module. */ -# undef fseek -# define fseek rpl_fseek +# if !GNULIB_defined_fseek_function +# undef fseek +# define fseek rpl_fseek static inline int _GL_ARG_NONNULL ((1)) rpl_fseek (FILE *fp, long offset, int whence) { -# if @REPLACE_FSEEKO@ +# if @REPLACE_FSEEKO@ return rpl_fseeko (fp, offset, whence); -# else +# else return fseeko (fp, offset, whence); +# endif +} +# define GNULIB_defined_fseek_function 1 # endif -} # endif #elif defined GNULIB_POSIXCHECK # define _GL_FSEEK_WARN /* Category 1, above. */ @@ -442,17 +445,20 @@ /* Provide an ftell function that is consistent with ftello. */ /* In order to avoid that ftell gets defined as a macro here, the developer can request the 'ftell' module. */ -# undef ftell -# define ftell rpl_ftell +# if !GNULIB_defined_ftell_function +# undef ftell +# define ftell rpl_ftell static inline long _GL_ARG_NONNULL ((1)) rpl_ftell (FILE *f) { -# if @REPLACE_FTELLO@ +# if @REPLACE_FTELLO@ return rpl_ftello (f); -# else +# else return ftello (f); +# endif +} +# define GNULIB_defined_ftell_function 1 # endif -} # endif #elif defined GNULIB_POSIXCHECK # define _GL_FTELL_WARN /* Category 1, above. */ diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h --- a/lib/sys_socket.in.h +++ b/lib/sys_socket.in.h @@ -67,7 +67,10 @@ /* The definition of _GL_WARN_ON_USE is copied here. */ #if !@HAVE_SA_FAMILY_T@ +# if !GNULIB_defined_sa_family_t typedef unsigned short sa_family_t; +# define GNULIB_defined_sa_family_t 1 +# endif #endif #if @HAVE_STRUCT_SOCKADDR_STORAGE@ @@ -89,12 +92,16 @@ : alignof (__ss_aligntype)) \ + sizeof (__ss_aligntype))) +# if !GNULIB_defined_struct_sockaddr_storage struct sockaddr_storage { sa_family_t ss_family; /* Address family, etc. */ __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; +# define GNULIB_defined_struct_sockaddr_storage 1 +# endif + #endif #if @HAVE_SYS_SOCKET_H@ @@ -159,7 +166,10 @@ # include # include +# if !GNULIB_defined_socklen_t typedef int socklen_t; +# define GNULIB_defined_socklen_t 1 +# endif # endif @@ -167,6 +177,8 @@ #if @HAVE_WINSOCK2_H@ +# if !GNULIB_defined_rpl_fd_isset + /* Re-define FD_ISSET to avoid a WSA call while we are not using network sockets. */ static inline int @@ -183,6 +195,9 @@ return 0; } +# define GNULIB_defined_rpl_fd_isset 1 +# endif + # undef FD_ISSET # define FD_ISSET(fd, set) rpl_fd_isset(fd, set) diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -461,11 +461,14 @@ which are included above. */ # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# if !GNULIB_defined_rpl_mkdir static inline int rpl_mkdir (char const *name, mode_t mode) { return _mkdir (name); } +# define GNULIB_defined_rpl_mkdir 1 +# endif # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define mkdir rpl_mkdir diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h --- a/lib/sys_time.in.h +++ b/lib/sys_time.in.h @@ -51,11 +51,16 @@ # endif # if ! @HAVE_STRUCT_TIMEVAL@ + +# if !GNULIB_defined_struct_timeval struct timeval { time_t tv_sec; long int tv_usec; }; +# define GNULIB_defined_struct_timeval 1 +# endif + # endif # ifdef __cplusplus diff --git a/lib/sys_times.in.h b/lib/sys_times.in.h --- a/lib/sys_times.in.h +++ b/lib/sys_times.in.h @@ -48,6 +48,7 @@ # endif # if !@HAVE_STRUCT_TMS@ +# if !GNULIB_defined_struct_tms /* Structure describing CPU time used by a process and its children. */ struct tms { @@ -57,6 +58,8 @@ clock_t tms_cutime; /* User CPU time of dead children. */ clock_t tms_cstime; /* System CPU time of dead children. */ }; +# define GNULIB_defined_struct_tms 1 +# endif # endif # if @GNULIB_TIMES@ diff --git a/lib/sys_utsname.in.h b/lib/sys_utsname.in.h --- a/lib/sys_utsname.in.h +++ b/lib/sys_utsname.in.h @@ -57,6 +57,7 @@ # define _UTSNAME_MACHINE_LENGTH _UTSNAME_LENGTH # endif +# if !GNULIB_defined_struct_utsname /* Structure describing the system and machine. */ struct utsname { @@ -73,6 +74,9 @@ /* Name of the hardware type the system is running on. */ char machine[_UTSNAME_MACHINE_LENGTH]; }; +# define GNULIB_defined_struct_utsname 1 +# endif + #endif /* !@HAVE_STRUCT_UTSNAME@ */ diff --git a/lib/time.in.h b/lib/time.in.h --- a/lib/time.in.h +++ b/lib/time.in.h @@ -69,13 +69,16 @@ extern "C" { # endif -# undef timespec -# define timespec rpl_timespec +# if !GNULIB_defined_struct_timespec +# undef timespec +# define timespec rpl_timespec struct timespec { time_t tv_sec; long int tv_nsec; }; +# define GNULIB_defined_struct_timespec 1 +# endif # ifdef __cplusplus } @@ -84,6 +87,7 @@ # endif # endif +# if !GNULIB_defined_struct_time_t_must_be_integral /* Per http://austingroupbugs.net/view.php?id=327, POSIX requires time_t to be an integer type, even though C99 permits floating point. We don't know of any implementation that uses floating @@ -92,6 +96,8 @@ struct __time_t_must_be_integral { unsigned int __floating_time_t_unsupported : (time_t) 1; }; +# define GNULIB_defined_struct_time_t_must_be_integral 1 +# endif /* Sleep for at least RQTP seconds unless interrupted, If interrupted, return -1 and store the remaining time into RMTP. See diff --git a/lib/unistd.in.h b/lib/unistd.in.h --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -796,11 +796,14 @@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) # define getpagesize() _gl_getpagesize () # else +# if !GNULIB_defined_getpagesize_function static inline int getpagesize () { return _gl_getpagesize (); } +# define GNULIB_defined_getpagesize_function 1 +# endif # endif # endif # endif diff --git a/lib/wchar.in.h b/lib/wchar.in.h --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -104,10 +104,12 @@ On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for implementing mbrtowc for encodings like UTF-8. */ #if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@ +# if !GNULIB_defined_mbstate_t typedef int rpl_mbstate_t; -# undef mbstate_t -# define mbstate_t rpl_mbstate_t -# define GNULIB_defined_mbstate_t 1 +# undef mbstate_t +# define mbstate_t rpl_mbstate_t +# define GNULIB_defined_mbstate_t 1 +# endif #endif diff --git a/lib/wctype.in.h b/lib/wctype.in.h --- a/lib/wctype.in.h +++ b/lib/wctype.in.h @@ -72,58 +72,60 @@ #endif +#if !GNULIB_defined_wctype_functions + /* FreeBSD 4.4 to 4.11 has but lacks the functions. Linux libc5 has and the functions but they are broken. Assume all 11 functions (all isw* except iswblank) are implemented the same way, or not at all. */ -#if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ +# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@ /* IRIX 5.3 has macros but no functions, its isw* macros refer to an undefined variable _ctmp_ and to macros like _P, and they refer to system functions like _iswctype that are not in the standard C library. Rather than try to get ancient buggy implementations like this to work, just disable them. */ -# undef iswalnum -# undef iswalpha -# undef iswblank -# undef iswcntrl -# undef iswdigit -# undef iswgraph -# undef iswlower -# undef iswprint -# undef iswpunct -# undef iswspace -# undef iswupper -# undef iswxdigit -# undef towlower -# undef towupper +# undef iswalnum +# undef iswalpha +# undef iswblank +# undef iswcntrl +# undef iswdigit +# undef iswgraph +# undef iswlower +# undef iswprint +# undef iswpunct +# undef iswspace +# undef iswupper +# undef iswxdigit +# undef towlower +# undef towupper /* Linux libc5 has and the functions but they are broken. */ -# if @REPLACE_ISWCNTRL@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define iswalnum rpl_iswalnum -# define iswalpha rpl_iswalpha -# define iswblank rpl_iswblank -# define iswcntrl rpl_iswcntrl -# define iswdigit rpl_iswdigit -# define iswgraph rpl_iswgraph -# define iswlower rpl_iswlower -# define iswprint rpl_iswprint -# define iswpunct rpl_iswpunct -# define iswspace rpl_iswspace -# define iswupper rpl_iswupper -# define iswxdigit rpl_iswxdigit -# define towlower rpl_towlower -# define towupper rpl_towupper +# if @REPLACE_ISWCNTRL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iswalnum rpl_iswalnum +# define iswalpha rpl_iswalpha +# define iswblank rpl_iswblank +# define iswcntrl rpl_iswcntrl +# define iswdigit rpl_iswdigit +# define iswgraph rpl_iswgraph +# define iswlower rpl_iswlower +# define iswprint rpl_iswprint +# define iswpunct rpl_iswpunct +# define iswspace rpl_iswspace +# define iswupper rpl_iswupper +# define iswxdigit rpl_iswxdigit +# define towlower rpl_towlower +# define towupper rpl_towupper +# endif # endif -# endif static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswalnum -# else +# else iswalnum -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') @@ -131,88 +133,88 @@ } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswalpha -# else +# else iswalpha -# endif +# endif (wint_t wc) { return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswblank -# else +# else iswblank -# endif +# endif (wint_t wc) { return wc == ' ' || wc == '\t'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswcntrl -# else +# else iswcntrl -# endif +# endif (wint_t wc) { return (wc & ~0x1f) == 0 || wc == 0x7f; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswdigit -# else +# else iswdigit -# endif +# endif (wint_t wc) { return wc >= '0' && wc <= '9'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswgraph -# else +# else iswgraph -# endif +# endif (wint_t wc) { return wc >= '!' && wc <= '~'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswlower -# else +# else iswlower -# endif +# endif (wint_t wc) { return wc >= 'a' && wc <= 'z'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswprint -# else +# else iswprint -# endif +# endif (wint_t wc) { return wc >= ' ' && wc <= '~'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswpunct -# else +# else iswpunct -# endif +# endif (wint_t wc) { return (wc >= '!' && wc <= '~' @@ -221,11 +223,11 @@ } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswspace -# else +# else iswspace -# endif +# endif (wint_t wc) { return (wc == ' ' || wc == '\t' @@ -233,22 +235,22 @@ } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswupper -# else +# else iswupper -# endif +# endif (wint_t wc) { return wc >= 'A' && wc <= 'Z'; } static inline int -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_iswxdigit -# else +# else iswxdigit -# endif +# endif (wint_t wc) { return ((wc >= '0' && wc <= '9') @@ -256,42 +258,42 @@ } static inline wint_t -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_towlower -# else +# else towlower -# endif +# endif (wint_t wc) { return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc); } static inline wint_t -# if @REPLACE_ISWCNTRL@ +# if @REPLACE_ISWCNTRL@ rpl_towupper -# else +# else towupper -# endif +# endif (wint_t wc) { return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc); } -#elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@ +# elif ! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@ /* Only the iswblank function is missing. */ -# if @REPLACE_ISWBLANK@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define iswblank rpl_iswblank +# if @REPLACE_ISWBLANK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define iswblank rpl_iswblank +# endif +_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); +# else +_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); # endif -_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc)); -# else -_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc)); + # endif -#endif - -#if defined __MINGW32__ +# if defined __MINGW32__ /* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t. The functions towlower and towupper are implemented in the MSVCRT library @@ -311,20 +313,23 @@ { return (wint_t) (wchar_t) towlower (wc); } -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define towlower rpl_towlower -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towlower rpl_towlower +# endif static inline wint_t rpl_towupper (wint_t wc) { return (wint_t) (wchar_t) towupper (wc); } -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define towupper rpl_towupper -# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define towupper rpl_towupper +# endif -#endif /* __MINGW32__ */ +# endif /* __MINGW32__ */ + +# define GNULIB_defined_wctype_functions 1 +#endif #if @REPLACE_ISWCNTRL@ _GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));