summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-17 16:20:52 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-17 16:20:52 +0100
commit7ae4e75af5366086e60fbc2e9454dfd9e5965102 (patch)
tree61ea2340323e17e362de7860824917d3eeb66abd /lib
parent44cd55752aad2a69e1583a2cb37c3b98c5c44ad3 (diff)
downloadguile-7ae4e75af5366086e60fbc2e9454dfd9e5965102.tar.gz
Update Gnulib to v0.0-7695-g26c0590.
* gnulib-local/m4/canonicalize.m4.diff: Remove. * Makefile.am (EXTRA_DIST): Adjust accordingly.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am8
-rw-r--r--lib/binary-io.c3
-rw-r--r--lib/binary-io.h11
-rw-r--r--lib/errno.in.h5
-rw-r--r--lib/fcntl.in.h14
-rw-r--r--lib/gettext.h9
-rw-r--r--lib/localcharset.c7
-rw-r--r--lib/malloca.h2
-rw-r--r--lib/regexec.c2
-rw-r--r--lib/stat-time.c3
-rw-r--r--lib/stat-time.h23
-rw-r--r--lib/stdbool.in.h51
-rw-r--r--lib/stdlib.in.h13
-rw-r--r--lib/verify.h6
-rw-r--r--lib/xsize.c3
-rw-r--r--lib/xsize.h17
16 files changed, 130 insertions, 47 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 8602e1340..49c5140f2 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -155,7 +155,7 @@ EXTRA_DIST += arpa_inet.in.h
## begin gnulib module binary-io
-libgnu_la_SOURCES += binary-io.h
+libgnu_la_SOURCES += binary-io.h binary-io.c
## end gnulib module binary-io
@@ -614,7 +614,7 @@ EXTRA_DIST += $(top_srcdir)/build-aux/gnu-web-doc-update
distclean-local: clean-GNUmakefile
clean-GNUmakefile:
- test x'$(VPATH)' != x && rm -f $(top_builddir)/GNUmakefile || :
+ test '$(srcdir)' = . || rm -f $(top_builddir)/GNUmakefile
EXTRA_DIST += $(top_srcdir)/GNUmakefile
@@ -1795,6 +1795,7 @@ EXTRA_libgnu_la_SOURCES += stat.c
## begin gnulib module stat-time
+libgnu_la_SOURCES += stat-time.c
EXTRA_DIST += stat-time.h
@@ -2133,6 +2134,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
-e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
-e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
-e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+ -e 's|@''REPLACE_PTSNAME''@|$(REPLACE_PTSNAME)|g' \
-e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
-e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
-e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
@@ -3008,7 +3010,7 @@ EXTRA_libgnu_la_SOURCES += write.c
## begin gnulib module xsize
-libgnu_la_SOURCES += xsize.h
+libgnu_la_SOURCES += xsize.h xsize.c
## end gnulib module xsize
diff --git a/lib/binary-io.c b/lib/binary-io.c
new file mode 100644
index 000000000..8bbdb44d1
--- /dev/null
+++ b/lib/binary-io.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define BINARY_IO_INLINE _GL_EXTERN_INLINE
+#include "binary-io.h"
diff --git a/lib/binary-io.h b/lib/binary-io.h
index 77cbd4ec9..30315e10c 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -25,6 +25,11 @@
so we include it here first. */
#include <stdio.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef BINARY_IO_INLINE
+# define BINARY_IO_INLINE _GL_INLINE
+#endif
+
/* set_binary_mode (fd, mode)
sets the binary/text I/O mode of file descriptor fd to the given mode
(must be O_BINARY or O_TEXT) and returns the previous mode. */
@@ -39,9 +44,9 @@
# endif
#else
/* On reasonable systems, binary I/O is the only choice. */
- /* Use an inline function rather than a macro, to avoid gcc warnings
+ /* Use a function rather than a macro, to avoid gcc warnings
"warning: statement with no effect". */
-static inline int
+BINARY_IO_INLINE int
set_binary_mode (int fd, int mode)
{
(void) fd;
@@ -62,4 +67,6 @@ set_binary_mode (int fd, int mode)
# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
#endif
+_GL_INLINE_HEADER_END
+
#endif /* _BINARY_H */
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 21ba05b5f..774c786ba 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -270,5 +270,10 @@
# define GNULIB_defined_ENOTRECOVERABLE 1
# endif
+# ifndef EILSEQ
+# define EILSEQ 2015
+# define GNULIB_defined_EILSEQ 1
+# endif
+
#endif /* _@GUARD_PREFIX@_ERRNO_H */
#endif /* _@GUARD_PREFIX@_ERRNO_H */
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index f39dfe51d..5c934c025 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -216,6 +216,10 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_EXEC O_RDONLY /* This is often close enough in older systems. */
#endif
+#ifndef O_IGNORE_CTTY
+# define O_IGNORE_CTTY 0
+#endif
+
#ifndef O_NDELAY
# define O_NDELAY 0
#endif
@@ -249,10 +253,18 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_NOFOLLOW 0
#endif
+#ifndef O_NOLINK
+# define O_NOLINK 0
+#endif
+
#ifndef O_NOLINKS
# define O_NOLINKS 0
#endif
+#ifndef O_NOTRANS
+# define O_NOTRANS 0
+#endif
+
#ifndef O_RSYNC
# define O_RSYNC 0
#endif
@@ -269,7 +281,7 @@ _GL_WARN_ON_USE (openat, "openat is not portable - "
# define O_TTY_INIT 0
#endif
-#if O_ACCMODE != (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
+#if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
# undef O_ACCMODE
# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH)
#endif
diff --git a/lib/gettext.h b/lib/gettext.h
index c7d974078..d130faa2b 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -183,9 +183,12 @@ npgettext_aux (const char *domain,
#include <string.h>
-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
- (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
- /* || __STDC_VERSION__ >= 199901L */ )
+#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+ /* || __STDC_VERSION__ >= 199901L */ )
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#else
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
+#endif
#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
#include <stdlib.h>
diff --git a/lib/localcharset.c b/lib/localcharset.c
index ad28ec673..c4a0596be 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -542,6 +542,13 @@ locale_charset (void)
if (codeset[0] == '\0')
codeset = "ASCII";
+#ifdef DARWIN7
+ /* Mac OS X sets MB_CUR_MAX to 1 when LC_ALL=C, and "UTF-8"
+ (the default codeset) does not work when MB_CUR_MAX is 1. */
+ if (strcmp (codeset, "UTF-8") == 0 && MB_CUR_MAX <= 1)
+ codeset = "ASCII";
+#endif
+
return codeset;
}
diff --git a/lib/malloca.h b/lib/malloca.h
index c9bc15b8c..deb9bdaa0 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -42,7 +42,7 @@ extern "C" {
and a page size can be as small as 4096 bytes. So we cannot safely
allocate anything larger than 4096 bytes. Also care for the possibility
of a few compiler-allocated temporary stack slots.
- This must be a macro, not an inline function. */
+ This must be a macro, not a function. */
# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL)
#else
# define safe_alloca(N) ((void) (N), NULL)
diff --git a/lib/regexec.c b/lib/regexec.c
index b2c174f05..13c3f15d6 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -735,7 +735,7 @@ re_search_internal (const regex_t *preg,
mctx.input.tip_context = (eflags & REG_NOTBOL) ? CONTEXT_BEGBUF
: CONTEXT_NEWLINE | CONTEXT_BEGBUF;
- /* Check incrementally whether of not the input string match. */
+ /* Check incrementally whether the input string matches. */
incr = (last_start < start) ? -1 : 1;
left_lim = (last_start < start) ? last_start : start;
right_lim = (last_start < start) ? start : last_start;
diff --git a/lib/stat-time.c b/lib/stat-time.c
new file mode 100644
index 000000000..81b83ddb4
--- /dev/null
+++ b/lib/stat-time.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE
+#include "stat-time.h"
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 1aae18a30..daf2ca6ee 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -23,6 +23,11 @@
#include <sys/stat.h>
#include <time.h>
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_STAT_TIME_INLINE
+# define _GL_STAT_TIME_INLINE _GL_INLINE
+#endif
+
/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST,
ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST,
@@ -46,7 +51,7 @@
#endif
/* Return the nanosecond component of *ST's access time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_atime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -59,7 +64,7 @@ get_stat_atime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's status change time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_ctime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -72,7 +77,7 @@ get_stat_ctime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's data modification time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_mtime_ns (struct stat const *st)
{
# if defined STAT_TIMESPEC
@@ -85,7 +90,7 @@ get_stat_mtime_ns (struct stat const *st)
}
/* Return the nanosecond component of *ST's birth time. */
-static inline long int
+_GL_STAT_TIME_INLINE long int
get_stat_birthtime_ns (struct stat const *st)
{
# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
@@ -100,7 +105,7 @@ get_stat_birthtime_ns (struct stat const *st)
}
/* Return *ST's access time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_atime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -114,7 +119,7 @@ get_stat_atime (struct stat const *st)
}
/* Return *ST's status change time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_ctime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -128,7 +133,7 @@ get_stat_ctime (struct stat const *st)
}
/* Return *ST's data modification time. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_mtime (struct stat const *st)
{
#ifdef STAT_TIMESPEC
@@ -143,7 +148,7 @@ get_stat_mtime (struct stat const *st)
/* Return *ST's birth time, if available; otherwise return a value
with tv_sec and tv_nsec both equal to -1. */
-static inline struct timespec
+_GL_STAT_TIME_INLINE struct timespec
get_stat_birthtime (struct stat const *st)
{
struct timespec t;
@@ -186,4 +191,6 @@ get_stat_birthtime (struct stat const *st)
return t;
}
+_GL_INLINE_HEADER_END
+
#endif
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index 6ea7f7001..419342993 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -66,24 +66,19 @@
# undef true
#endif
-/* For the sake of symbolic names in gdb, we define true and false as
- enum constants, not only as macros.
- It is tempting to write
- typedef enum { false = 0, true = 1 } _Bool;
- so that gdb prints values of type 'bool' symbolically. But if we do
- this, values of type '_Bool' may promote to 'int' or 'unsigned int'
- (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
- (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the
- enum; this ensures that '_Bool' promotes to 'int'. */
-#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__)
+#ifdef __cplusplus
+# define _Bool bool
+# define bool bool
+#else
+# if defined __BEOS__ && !defined __HAIKU__
/* A compiler known to have 'bool'. */
/* If the compiler already has both 'bool' and '_Bool', we can assume they
are the same types. */
-# if !@HAVE__BOOL@
+# if !@HAVE__BOOL@
typedef bool _Bool;
-# endif
-#else
-# if !defined __GNUC__
+# endif
+# else
+# if !defined __GNUC__
/* If @HAVE__BOOL@:
Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
the built-in _Bool type is used. See
@@ -103,19 +98,35 @@ typedef bool _Bool;
"Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
The only benefit of the enum, debuggability, is not important
with these compilers. So use 'signed char' and no enum. */
-# define _Bool signed char
-# else
+# define _Bool signed char
+# else
/* With this compiler, trust the _Bool type if the compiler has it. */
-# if !@HAVE__BOOL@
+# if !@HAVE__BOOL@
+ /* For the sake of symbolic names in gdb, define true and false as
+ enum constants, not only as macros.
+ It is tempting to write
+ typedef enum { false = 0, true = 1 } _Bool;
+ so that gdb prints values of type 'bool' symbolically. But then
+ values of type '_Bool' might promote to 'int' or 'unsigned int'
+ (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int'
+ (see ISO C 99 6.3.1.1.(2)). So add a negative value to the
+ enum; this ensures that '_Bool' promotes to 'int'. */
typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
+# endif
# endif
# endif
+# define bool _Bool
#endif
-#define bool _Bool
/* The other macros must be usable in preprocessor directives. */
-#define false 0
-#define true 1
+#ifdef __cplusplus
+# define false false
+# define true true
+#else
+# define false 0
+# define true 1
+#endif
+
#define __bool_true_false_are_defined 1
#endif /* _GL_STDBOOL_H */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 72c9dd1ca..b67a3484e 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -457,10 +457,19 @@ _GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
#if @GNULIB_PTSNAME@
/* Return the pathname of the pseudo-terminal slave associated with
the master FD is open on, or NULL on errors. */
-# if !@HAVE_PTSNAME@
+# if @REPLACE_PTSNAME@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ptsname
+# define ptsname rpl_ptsname
+# endif
+_GL_FUNCDECL_RPL (ptsname, char *, (int fd));
+_GL_CXXALIAS_RPL (ptsname, char *, (int fd));
+# else
+# if !@HAVE_PTSNAME@
_GL_FUNCDECL_SYS (ptsname, char *, (int fd));
-# endif
+# endif
_GL_CXXALIAS_SYS (ptsname, char *, (int fd));
+# endif
_GL_CXXALIASWARN (ptsname);
#elif defined GNULIB_POSIXCHECK
# undef ptsname
diff --git a/lib/verify.h b/lib/verify.h
index 6c4bd43fd..780b55e1d 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -125,7 +125,7 @@
extern int (*dummy (void)) [sizeof (struct {...})];
* GCC warns about duplicate declarations of the dummy function if
- -Wredundant_decls is used. GCC 4.3 and later have a builtin
+ -Wredundant-decls is used. GCC 4.3 and later have a builtin
__COUNTER__ macro that can let us generate unique identifiers for
each dummy function, to suppress this warning.
@@ -133,6 +133,10 @@
which do not support _Static_assert, also do not warn about the
last declaration mentioned above.
+ * GCC warns if -Wnested-externs is enabled and verify() is used
+ within a function body; but inside a function, you can always
+ arrange to use verify_expr() instead.
+
* In C++, any struct definition inside sizeof is invalid.
Use a template type to work around the problem. */
diff --git a/lib/xsize.c b/lib/xsize.c
new file mode 100644
index 000000000..4b4914c2c
--- /dev/null
+++ b/lib/xsize.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define XSIZE_INLINE _GL_EXTERN_INLINE
+#include "xsize.h"
diff --git a/lib/xsize.h b/lib/xsize.h
index 38d1afd3f..831224398 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -27,6 +27,11 @@
# include <stdint.h>
#endif
+_GL_INLINE_HEADER_BEGIN
+#ifndef XSIZE_INLINE
+# define XSIZE_INLINE _GL_INLINE
+#endif
+
/* The size of memory objects is often computed through expressions of
type size_t. Example:
void* p = malloc (header_size + n * element_size).
@@ -48,7 +53,7 @@
((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX)
/* Sum of two sizes, with overflow check. */
-static inline size_t
+XSIZE_INLINE size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
@@ -59,7 +64,7 @@ xsum (size_t size1, size_t size2)
}
/* Sum of three sizes, with overflow check. */
-static inline size_t
+XSIZE_INLINE size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
@@ -69,7 +74,7 @@ xsum3 (size_t size1, size_t size2, size_t size3)
}
/* Sum of four sizes, with overflow check. */
-static inline size_t
+XSIZE_INLINE size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
@@ -79,7 +84,7 @@ xsum4 (size_t size1, size_t size2, size_t size3, size_t size4)
}
/* Maximum of two sizes, with overflow check. */
-static inline size_t
+XSIZE_INLINE size_t
#if __GNUC__ >= 3
__attribute__ ((__pure__))
#endif
@@ -92,7 +97,7 @@ xmax (size_t size1, size_t size2)
/* Multiplication of a count with an element size, with overflow check.
The count must be >= 0 and the element size must be > 0.
- This is a macro, not an inline function, so that it works correctly even
+ This is a macro, not a function, so that it works correctly even
when N is of a wider type and N > SIZE_MAX. */
#define xtimes(N, ELSIZE) \
((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX)
@@ -104,4 +109,6 @@ xmax (size_t size1, size_t size2)
#define size_in_bounds_p(SIZE) \
((SIZE) != SIZE_MAX)
+_GL_INLINE_HEADER_END
+
#endif /* _XSIZE_H */