bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/7] gnulib-tool: transform include guards with `--macro-pref


From: Bruno Haible
Subject: Re: [PATCH 1/7] gnulib-tool: transform include guards with `--macro-prefix'
Date: Sun, 14 Nov 2010 17:48:35 +0100
User-agent: KMail/1.9.9

On 2010-10-12 I wrote:
> I think this and the two other modifications I mentioned in the
> other mail - dealing with include_next and old compilers, and handling of
> typedefs and struct definitions in the *.in.h files - should be dealt with
> at the same time.

'struct random_data' in stdlib.in.h was handled already. Here's a proposed
patch to handle the other type definitions and inline functions in the same
way.


2010-11-14  Bruno Haible  <address@hidden>

        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 <address@hidden>.

--- lib/getopt.in.h.orig        Sun Nov 14 17:47:54 2010
+++ lib/getopt.in.h     Sun Nov 14 15:44:24 2010
@@ -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'.  */
 
--- lib/inttypes.in.h.orig      Sun Nov 14 17:47:54 2010
+++ lib/inttypes.in.h   Sun Nov 14 16:00:08 2010
@@ -1060,7 +1060,10 @@
 
 #if @GNULIB_IMAXDIV@
 # if address@hidden@
+#  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
--- lib/langinfo.in.h.orig      Sun Nov 14 17:47:54 2010
+++ lib/langinfo.in.h   Sun Nov 14 15:58:51 2010
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <langinfo.h>.
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009-2010 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -41,7 +41,10 @@
 /* A platform that lacks <langinfo.h>.  */
 
 /* Assume that it also lacks <nl_types.h> 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
--- lib/math.in.h.orig  Sun Nov 14 17:47:54 2010
+++ lib/math.in.h       Sun Nov 14 16:07:49 2010
@@ -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
 
--- lib/netdb.in.h.orig Sun Nov 14 17:47:54 2010
+++ lib/netdb.in.h      Sun Nov 14 15:45:15 2010
@@ -51,6 +51,7 @@
 
 # if address@hidden@
 
+#  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.  */
--- lib/poll.in.h.orig  Sun Nov 14 17:47:54 2010
+++ lib/poll.in.h       Sun Nov 14 15:46:14 2010
@@ -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)
--- lib/pthread.in.h.orig       Sun Nov 14 17:47:54 2010
+++ lib/pthread.in.h    Sun Nov 14 16:10:49 2010
@@ -40,6 +40,7 @@
 #include <time.h>
 
 #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_ */
--- lib/sched.in.h.orig Sun Nov 14 17:47:54 2010
+++ lib/sched.in.h      Sun Nov 14 15:47:58 2010
@@ -1,5 +1,5 @@
 /* Replacement <sched.h> for platforms that lack it.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -31,10 +31,13 @@
 
 #if address@hidden@
 
+# if !GNULIB_defined_struct_sched_param
 struct sched_param
 {
   int sched_priority;
 };
+#  define GNULIB_defined_struct_sched_param 1
+# endif
 
 #endif
 
--- lib/se-selinux.in.h.orig    Sun Nov 14 17:47:54 2010
+++ lib/se-selinux.in.h Sun Nov 14 16:15:11 2010
@@ -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 */
--- lib/search.in.h.orig        Sun Nov 14 17:47:54 2010
+++ lib/search.in.h     Sun Nov 14 16:12:52 2010
@@ -53,6 +53,7 @@
    for details.  */
 
 # if address@hidden@
+#  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
--- lib/signal.in.h.orig        Sun Nov 14 17:47:54 2010
+++ lib/signal.in.h     Sun Nov 14 16:30:37 2010
@@ -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 address@hidden@
+# if !GNULIB_defined_sigset_t
 typedef unsigned int sigset_t;
+#  define GNULIB_defined_sigset_t 1
+# endif
 #endif
 
 
@@ -81,7 +87,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
 
@@ -176,7 +185,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
@@ -250,6 +262,9 @@
 # if address@hidden@
 
 #  if address@hidden@
+
+#   if !GNULIB_defined_siginfo_types
+
 /* Present to allow compilation, but unsupported by gnulib.  */
 union sigval
 {
@@ -271,11 +286,17 @@
   union sigval si_value;
 };
 typedef struct siginfo_t siginfo_t;
+
+#    define GNULIB_defined_siginfo_types 1
+#   endif
+
 #  endif /* address@hidden@ */
 
 /* 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
@@ -291,12 +312,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));
--- lib/spawn.in.h.orig Sun Nov 14 17:47:54 2010
+++ lib/spawn.in.h      Sun Nov 14 16:25:56 2010
@@ -83,6 +83,7 @@
 # define posix_spawnattr_t rpl_posix_spawnattr_t
 #endif
 #if @REPLACE_POSIX_SPAWN@ || address@hidden@
+# 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@ || address@hidden@
+# 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@
--- lib/stdint.in.h.orig        Sun Nov 14 17:47:54 2010
+++ lib/stdint.in.h     Sun Nov 14 16:32:49 2010
@@ -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
@@ -282,6 +284,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
--- lib/stdio.in.h.orig Sun Nov 14 17:47:54 2010
+++ lib/stdio.in.h      Sun Nov 14 17:34:56 2010
@@ -356,17 +356,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
+#   endif
 }
+#   define GNULIB_defined_fseek_function 1
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # define _GL_FSEEK_WARN /* Category 1, above.  */
@@ -431,17 +434,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
+#   endif
 }
+#   define GNULIB_defined_ftell_function 1
+#  endif
 # endif
 #elif defined GNULIB_POSIXCHECK
 # define _GL_FTELL_WARN /* Category 1, above.  */
--- lib/sys_socket.in.h.orig    Sun Nov 14 17:47:54 2010
+++ lib/sys_socket.in.h Sun Nov 14 17:36:51 2010
@@ -67,7 +67,10 @@
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 #if address@hidden@
+# if !GNULIB_defined_sa_family_t
 typedef unsigned short  sa_family_t;
+#  define GNULIB_defined_sa_family_t 1
+# endif
 #endif
 
 #if address@hidden@
@@ -82,12 +85,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@
@@ -152,7 +159,10 @@
 #  include <sys/types.h>
 #  include <io.h>
 
+#  if !GNULIB_defined_socklen_t
 typedef int socklen_t;
+#   define GNULIB_defined_socklen_t 1
+#  endif
 
 # endif
 
@@ -160,6 +170,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
@@ -176,6 +188,9 @@
   return 0;
 }
 
+#  define GNULIB_defined_rpl_fd_isset 1
+# endif
+
 # undef FD_ISSET
 # define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
 
--- lib/sys_stat.in.h.orig      Sun Nov 14 17:47:55 2010
+++ lib/sys_stat.in.h   Sun Nov 14 17:38:07 2010
@@ -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
--- lib/sys_time.in.h.orig      Sun Nov 14 17:47:55 2010
+++ lib/sys_time.in.h   Sun Nov 14 15:51:48 2010
@@ -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
--- lib/sys_times.in.h.orig     Sun Nov 14 17:47:55 2010
+++ lib/sys_times.in.h  Sun Nov 14 16:21:47 2010
@@ -48,6 +48,7 @@
 # endif
 
 # if address@hidden@
+#  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@
--- lib/sys_utsname.in.h.orig   Sun Nov 14 17:47:55 2010
+++ lib/sys_utsname.in.h        Sun Nov 14 15:52:26 2010
@@ -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 /* address@hidden@ */
 
 
--- lib/time.in.h.orig  Sun Nov 14 17:47:55 2010
+++ lib/time.in.h       Sun Nov 14 16:20:47 2010
@@ -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
--- lib/unistd.in.h.orig        Sun Nov 14 17:47:55 2010
+++ lib/unistd.in.h     Sun Nov 14 17:40:00 2010
@@ -765,11 +765,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
--- lib/wchar.in.h.orig Sun Nov 14 17:47:55 2010
+++ lib/wchar.in.h      Sun Nov 14 16:17:14 2010
@@ -100,10 +100,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
 
 
--- lib/wctype.in.h.orig        Sun Nov 14 17:47:55 2010
+++ lib/wctype.in.h     Sun Nov 14 17:45:39 2010
@@ -72,58 +72,60 @@
 #endif
 
 
+#if !GNULIB_defined_wctype_functions
+
 /* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
    Linux libc5 has <wctype.h> 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 <ctype.h> 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 <wctype.h> 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,50 +258,50 @@
 }
 
 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
 #  endif
-# endif
 
 static inline int
-# if @REPLACE_ISWBLANK@
+#  if @REPLACE_ISWBLANK@
 rpl_iswblank
-# else
+#  else
 iswblank
-# endif
+#  endif
          (wint_t wc)
 {
   return wc == ' ' || wc == '\t';
 }
 
-#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
@@ -319,20 +321,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));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]