summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-06 23:25:57 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-06 23:25:57 +0200
commit005de2e8273853e155c21767b1c8bdb4f3f3ca53 (patch)
tree1f215bb57b2bc61926e3d27357f7c43e993e73b9 /lib
parent32299e49e83b941082bee348c993630bb455a324 (diff)
Update Gnulib to v0.0-7509-g98a2286.
* Makefile.am (EXTRA_DIST): Add `m4/gnulib-cache.m4'. * build-aux/git-version-gen: Keep unchanged.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am206
-rw-r--r--lib/alignof.h3
-rw-r--r--lib/alloca.in.h13
-rw-r--r--lib/arpa_inet.in.h3
-rw-r--r--lib/asnprintf.c3
-rw-r--r--lib/binary-io.h41
-rw-r--r--lib/c-ctype.c3
-rw-r--r--lib/c-ctype.h3
-rw-r--r--lib/c-strcase.h3
-rw-r--r--lib/c-strcasecmp.c3
-rw-r--r--lib/c-strncasecmp.c3
-rw-r--r--lib/canonicalize-lgpl.c23
-rw-r--r--lib/ceil.c6
-rw-r--r--lib/config.charset5
-rw-r--r--lib/dirent.in.h9
-rw-r--r--lib/errno.in.h51
-rw-r--r--lib/fcntl.in.h4
-rw-r--r--lib/float+.h3
-rw-r--r--lib/floor.c6
-rw-r--r--lib/fstat.c6
-rw-r--r--lib/gai_strerror.c3
-rw-r--r--lib/getaddrinfo.c3
-rw-r--r--lib/gettext.h3
-rw-r--r--lib/iconv.c3
-rw-r--r--lib/iconv.in.h3
-rw-r--r--lib/iconv_close.c3
-rw-r--r--lib/iconv_open.c5
-rw-r--r--lib/inet_ntop.c3
-rw-r--r--lib/isinf.c3
-rw-r--r--lib/langinfo.in.h3
-rw-r--r--lib/localcharset.c5
-rw-r--r--lib/localcharset.h3
-rw-r--r--lib/locale.in.h107
-rw-r--r--lib/localeconv.c103
-rw-r--r--lib/log.c38
-rw-r--r--lib/log1p.c518
-rw-r--r--lib/malloc.c3
-rw-r--r--lib/malloca.c9
-rw-r--r--lib/malloca.h3
-rw-r--r--lib/math.in.h969
-rw-r--r--lib/mbrtowc.c22
-rw-r--r--lib/msvc-inval.c3
-rw-r--r--lib/msvc-inval.h3
-rw-r--r--lib/msvc-nothrow.c3
-rw-r--r--lib/msvc-nothrow.h3
-rw-r--r--lib/netdb.in.h3
-rw-r--r--lib/netinet_in.in.h3
-rw-r--r--lib/nproc.c9
-rw-r--r--lib/nproc.h3
-rw-r--r--lib/pathmax.h3
-rw-r--r--lib/pipe2.c3
-rw-r--r--lib/printf-args.c3
-rw-r--r--lib/printf-args.h3
-rw-r--r--lib/printf-parse.c5
-rw-r--r--lib/printf-parse.h3
-rw-r--r--lib/ref-add.sin3
-rw-r--r--lib/ref-del.sin3
-rw-r--r--lib/regcomp.c169
-rw-r--r--lib/regex.c17
-rw-r--r--lib/regex.h179
-rw-r--r--lib/regex_internal.c61
-rw-r--r--lib/regex_internal.h43
-rw-r--r--lib/regexec.c72
-rw-r--r--lib/round.c174
-rw-r--r--lib/safe-read.h2
-rw-r--r--lib/safe-write.h2
-rw-r--r--lib/signal.in.h12
-rw-r--r--lib/size_max.h3
-rw-r--r--lib/snprintf.c3
-rw-r--r--lib/stat.c15
-rw-r--r--lib/stdalign.in.h3
-rw-r--r--lib/stdbool.in.h3
-rw-r--r--lib/stddef.in.h3
-rw-r--r--lib/stdint.in.h65
-rw-r--r--lib/stdio.in.h33
-rw-r--r--lib/stdlib.in.h16
-rw-r--r--lib/strcasecmp.c63
-rw-r--r--lib/streq.h8
-rw-r--r--lib/strftime.c2
-rw-r--r--lib/string.in.h26
-rw-r--r--lib/strings.in.h123
-rw-r--r--lib/strncasecmp.c63
-rw-r--r--lib/sys_file.in.h3
-rw-r--r--lib/sys_socket.in.h5
-rw-r--r--lib/sys_stat.in.h63
-rw-r--r--lib/sys_time.in.h17
-rw-r--r--lib/sys_types.in.h15
-rw-r--r--lib/sys_uio.in.h3
-rw-r--r--lib/time.in.h3
-rw-r--r--lib/time_r.c3
-rw-r--r--lib/trunc.c6
-rw-r--r--lib/unistd.in.h23
-rw-r--r--lib/unistr.in.h174
-rw-r--r--lib/unitypes.in.h22
-rw-r--r--lib/vasnprintf.c9
-rw-r--r--lib/vasnprintf.h3
-rw-r--r--lib/vsnprintf.c3
-rw-r--r--lib/w32sock.h4
-rw-r--r--lib/wchar.in.h70
-rw-r--r--lib/wctype.in.h3
-rw-r--r--lib/xsize.h3
101 files changed, 2952 insertions, 905 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ab5f2d12e..f6680d680 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -62,9 +62,11 @@ libgnu_la_LDFLAGS += $(ISNANL_LIBM)
libgnu_la_LDFLAGS += $(LDEXP_LIBM)
libgnu_la_LDFLAGS += $(LIBSOCKET)
libgnu_la_LDFLAGS += $(LOG1P_LIBM)
+libgnu_la_LDFLAGS += $(LOG_LIBM)
libgnu_la_LDFLAGS += $(LTLIBICONV)
libgnu_la_LDFLAGS += $(LTLIBINTL)
libgnu_la_LDFLAGS += $(LTLIBUNISTRING)
+libgnu_la_LDFLAGS += $(ROUND_LIBM)
libgnu_la_LDFLAGS += $(SERVENT_LIB)
libgnu_la_LDFLAGS += $(TRUNC_LIBM)
@@ -279,7 +281,7 @@ configmake.h: Makefile
echo '#define PKGINCLUDEDIR "$(pkgincludedir)"'; \
echo '#define PKGLIBDIR "$(pkglibdir)"'; \
echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
- } | sed '/""/d' > $@-t
+ } | sed '/""/d' > $@-t && \
mv -f $@-t $@
BUILT_SOURCES += configmake.h
@@ -911,12 +913,15 @@ locale.h: locale.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_LOCALE_H''@|$(NEXT_LOCALE_H)|g' \
+ -e 's/@''GNULIB_LOCALECONV''@/$(GNULIB_LOCALECONV)/g' \
-e 's/@''GNULIB_SETLOCALE''@/$(GNULIB_SETLOCALE)/g' \
-e 's/@''GNULIB_DUPLOCALE''@/$(GNULIB_DUPLOCALE)/g' \
-e 's|@''HAVE_DUPLOCALE''@|$(HAVE_DUPLOCALE)|g' \
-e 's|@''HAVE_XLOCALE_H''@|$(HAVE_XLOCALE_H)|g' \
+ -e 's|@''REPLACE_LOCALECONV''@|$(REPLACE_LOCALECONV)|g' \
-e 's|@''REPLACE_SETLOCALE''@|$(REPLACE_SETLOCALE)|g' \
-e 's|@''REPLACE_DUPLOCALE''@|$(REPLACE_DUPLOCALE)|g' \
+ -e 's|@''REPLACE_STRUCT_LCONV''@|$(REPLACE_STRUCT_LCONV)|g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -929,6 +934,33 @@ EXTRA_DIST += locale.in.h
## end gnulib module locale
+## begin gnulib module localeconv
+
+
+EXTRA_DIST += localeconv.c
+
+EXTRA_libgnu_la_SOURCES += localeconv.c
+
+## end gnulib module localeconv
+
+## begin gnulib module log
+
+
+EXTRA_DIST += log.c
+
+EXTRA_libgnu_la_SOURCES += log.c
+
+## end gnulib module log
+
+## begin gnulib module log1p
+
+
+EXTRA_DIST += log1p.c
+
+EXTRA_libgnu_la_SOURCES += log1p.c
+
+## end gnulib module log1p
+
## begin gnulib module lstat
@@ -991,6 +1023,9 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_ATANF''@/$(GNULIB_ATANF)/g' \
-e 's/@''GNULIB_ATANL''@/$(GNULIB_ATANL)/g' \
-e 's/@''GNULIB_ATAN2F''@/$(GNULIB_ATAN2F)/g' \
+ -e 's/@''GNULIB_CBRT''@/$(GNULIB_CBRT)/g' \
+ -e 's/@''GNULIB_CBRTF''@/$(GNULIB_CBRTF)/g' \
+ -e 's/@''GNULIB_CBRTL''@/$(GNULIB_CBRTL)/g' \
-e 's/@''GNULIB_CEIL''@/$(GNULIB_CEIL)/g' \
-e 's/@''GNULIB_CEILF''@/$(GNULIB_CEILF)/g' \
-e 's/@''GNULIB_CEILL''@/$(GNULIB_CEILL)/g' \
@@ -1002,17 +1037,33 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_COSHF''@/$(GNULIB_COSHF)/g' \
-e 's/@''GNULIB_EXPF''@/$(GNULIB_EXPF)/g' \
-e 's/@''GNULIB_EXPL''@/$(GNULIB_EXPL)/g' \
+ -e 's/@''GNULIB_EXP2''@/$(GNULIB_EXP2)/g' \
+ -e 's/@''GNULIB_EXP2F''@/$(GNULIB_EXP2F)/g' \
+ -e 's/@''GNULIB_EXP2L''@/$(GNULIB_EXP2L)/g' \
+ -e 's/@''GNULIB_EXPM1''@/$(GNULIB_EXPM1)/g' \
+ -e 's/@''GNULIB_EXPM1F''@/$(GNULIB_EXPM1F)/g' \
+ -e 's/@''GNULIB_EXPM1L''@/$(GNULIB_EXPM1L)/g' \
-e 's/@''GNULIB_FABSF''@/$(GNULIB_FABSF)/g' \
+ -e 's/@''GNULIB_FABSL''@/$(GNULIB_FABSL)/g' \
-e 's/@''GNULIB_FLOOR''@/$(GNULIB_FLOOR)/g' \
-e 's/@''GNULIB_FLOORF''@/$(GNULIB_FLOORF)/g' \
-e 's/@''GNULIB_FLOORL''@/$(GNULIB_FLOORL)/g' \
-e 's/@''GNULIB_FMA''@/$(GNULIB_FMA)/g' \
-e 's/@''GNULIB_FMAF''@/$(GNULIB_FMAF)/g' \
-e 's/@''GNULIB_FMAL''@/$(GNULIB_FMAL)/g' \
+ -e 's/@''GNULIB_FMOD''@/$(GNULIB_FMOD)/g' \
-e 's/@''GNULIB_FMODF''@/$(GNULIB_FMODF)/g' \
+ -e 's/@''GNULIB_FMODL''@/$(GNULIB_FMODL)/g' \
-e 's/@''GNULIB_FREXPF''@/$(GNULIB_FREXPF)/g' \
-e 's/@''GNULIB_FREXP''@/$(GNULIB_FREXP)/g' \
-e 's/@''GNULIB_FREXPL''@/$(GNULIB_FREXPL)/g' \
+ -e 's/@''GNULIB_HYPOT''@/$(GNULIB_HYPOT)/g' \
+ -e 's/@''GNULIB_HYPOTF''@/$(GNULIB_HYPOTF)/g' \
+ -e 's/@''GNULIB_HYPOTL''@/$(GNULIB_HYPOTL)/g' \
+ < $(srcdir)/math.in.h | \
+ sed -e 's/@''GNULIB_ILOGB''@/$(GNULIB_ILOGB)/g' \
+ -e 's/@''GNULIB_ILOGBF''@/$(GNULIB_ILOGBF)/g' \
+ -e 's/@''GNULIB_ILOGBL''@/$(GNULIB_ILOGBL)/g' \
-e 's/@''GNULIB_ISFINITE''@/$(GNULIB_ISFINITE)/g' \
-e 's/@''GNULIB_ISINF''@/$(GNULIB_ISINF)/g' \
-e 's/@''GNULIB_ISNAN''@/$(GNULIB_ISNAN)/g' \
@@ -1021,12 +1072,28 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_ISNANL''@/$(GNULIB_ISNANL)/g' \
-e 's/@''GNULIB_LDEXPF''@/$(GNULIB_LDEXPF)/g' \
-e 's/@''GNULIB_LDEXPL''@/$(GNULIB_LDEXPL)/g' \
- -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
+ -e 's/@''GNULIB_LOG''@/$(GNULIB_LOG)/g' \
-e 's/@''GNULIB_LOGF''@/$(GNULIB_LOGF)/g' \
-e 's/@''GNULIB_LOGL''@/$(GNULIB_LOGL)/g' \
+ -e 's/@''GNULIB_LOG10''@/$(GNULIB_LOG10)/g' \
-e 's/@''GNULIB_LOG10F''@/$(GNULIB_LOG10F)/g' \
+ -e 's/@''GNULIB_LOG10L''@/$(GNULIB_LOG10L)/g' \
+ -e 's/@''GNULIB_LOG1P''@/$(GNULIB_LOG1P)/g' \
+ -e 's/@''GNULIB_LOG1PF''@/$(GNULIB_LOG1PF)/g' \
+ -e 's/@''GNULIB_LOG1PL''@/$(GNULIB_LOG1PL)/g' \
+ -e 's/@''GNULIB_LOG2''@/$(GNULIB_LOG2)/g' \
+ -e 's/@''GNULIB_LOG2F''@/$(GNULIB_LOG2F)/g' \
+ -e 's/@''GNULIB_LOG2L''@/$(GNULIB_LOG2L)/g' \
+ -e 's/@''GNULIB_LOGB''@/$(GNULIB_LOGB)/g' \
+ -e 's/@''GNULIB_LOGBF''@/$(GNULIB_LOGBF)/g' \
+ -e 's/@''GNULIB_LOGBL''@/$(GNULIB_LOGBL)/g' \
+ -e 's/@''GNULIB_MODF''@/$(GNULIB_MODF)/g' \
-e 's/@''GNULIB_MODFF''@/$(GNULIB_MODFF)/g' \
+ -e 's/@''GNULIB_MODFL''@/$(GNULIB_MODFL)/g' \
-e 's/@''GNULIB_POWF''@/$(GNULIB_POWF)/g' \
+ -e 's/@''GNULIB_REMAINDER''@/$(GNULIB_REMAINDER)/g' \
+ -e 's/@''GNULIB_REMAINDERF''@/$(GNULIB_REMAINDERF)/g' \
+ -e 's/@''GNULIB_REMAINDERL''@/$(GNULIB_REMAINDERL)/g' \
-e 's/@''GNULIB_RINT''@/$(GNULIB_RINT)/g' \
-e 's/@''GNULIB_RINTF''@/$(GNULIB_RINTF)/g' \
-e 's/@''GNULIB_RINTL''@/$(GNULIB_RINTL)/g' \
@@ -1045,7 +1112,7 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's/@''GNULIB_TRUNC''@/$(GNULIB_TRUNC)/g' \
-e 's/@''GNULIB_TRUNCF''@/$(GNULIB_TRUNCF)/g' \
-e 's/@''GNULIB_TRUNCL''@/$(GNULIB_TRUNCL)/g' \
- < $(srcdir)/math.in.h | \
+ | \
sed -e 's|@''HAVE_ACOSF''@|$(HAVE_ACOSF)|g' \
-e 's|@''HAVE_ACOSL''@|$(HAVE_ACOSL)|g' \
-e 's|@''HAVE_ASINF''@|$(HAVE_ASINF)|g' \
@@ -1053,20 +1120,31 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_ATANF''@|$(HAVE_ATANF)|g' \
-e 's|@''HAVE_ATANL''@|$(HAVE_ATANL)|g' \
-e 's|@''HAVE_ATAN2F''@|$(HAVE_ATAN2F)|g' \
+ -e 's|@''HAVE_CBRT''@|$(HAVE_CBRT)|g' \
+ -e 's|@''HAVE_CBRTF''@|$(HAVE_CBRTF)|g' \
+ -e 's|@''HAVE_CBRTL''@|$(HAVE_CBRTL)|g' \
-e 's|@''HAVE_COPYSIGN''@|$(HAVE_COPYSIGN)|g' \
- -e 's|@''HAVE_COPYSIGNF''@|$(HAVE_COPYSIGNF)|g' \
-e 's|@''HAVE_COPYSIGNL''@|$(HAVE_COPYSIGNL)|g' \
-e 's|@''HAVE_COSF''@|$(HAVE_COSF)|g' \
-e 's|@''HAVE_COSL''@|$(HAVE_COSL)|g' \
-e 's|@''HAVE_COSHF''@|$(HAVE_COSHF)|g' \
-e 's|@''HAVE_EXPF''@|$(HAVE_EXPF)|g' \
-e 's|@''HAVE_EXPL''@|$(HAVE_EXPL)|g' \
+ -e 's|@''HAVE_EXPM1''@|$(HAVE_EXPM1)|g' \
+ -e 's|@''HAVE_EXPM1F''@|$(HAVE_EXPM1F)|g' \
-e 's|@''HAVE_FABSF''@|$(HAVE_FABSF)|g' \
+ -e 's|@''HAVE_FABSL''@|$(HAVE_FABSL)|g' \
-e 's|@''HAVE_FMA''@|$(HAVE_FMA)|g' \
-e 's|@''HAVE_FMAF''@|$(HAVE_FMAF)|g' \
-e 's|@''HAVE_FMAL''@|$(HAVE_FMAL)|g' \
-e 's|@''HAVE_FMODF''@|$(HAVE_FMODF)|g' \
+ -e 's|@''HAVE_FMODL''@|$(HAVE_FMODL)|g' \
-e 's|@''HAVE_FREXPF''@|$(HAVE_FREXPF)|g' \
+ -e 's|@''HAVE_HYPOTF''@|$(HAVE_HYPOTF)|g' \
+ -e 's|@''HAVE_HYPOTL''@|$(HAVE_HYPOTL)|g' \
+ -e 's|@''HAVE_ILOGB''@|$(HAVE_ILOGB)|g' \
+ -e 's|@''HAVE_ILOGBF''@|$(HAVE_ILOGBF)|g' \
+ -e 's|@''HAVE_ILOGBL''@|$(HAVE_ILOGBL)|g' \
-e 's|@''HAVE_ISNANF''@|$(HAVE_ISNANF)|g' \
-e 's|@''HAVE_ISNAND''@|$(HAVE_ISNAND)|g' \
-e 's|@''HAVE_ISNANL''@|$(HAVE_ISNANL)|g' \
@@ -1074,10 +1152,18 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_LOGF''@|$(HAVE_LOGF)|g' \
-e 's|@''HAVE_LOGL''@|$(HAVE_LOGL)|g' \
-e 's|@''HAVE_LOG10F''@|$(HAVE_LOG10F)|g' \
+ -e 's|@''HAVE_LOG10L''@|$(HAVE_LOG10L)|g' \
+ -e 's|@''HAVE_LOG1P''@|$(HAVE_LOG1P)|g' \
+ -e 's|@''HAVE_LOG1PF''@|$(HAVE_LOG1PF)|g' \
+ -e 's|@''HAVE_LOG1PL''@|$(HAVE_LOG1PL)|g' \
+ -e 's|@''HAVE_LOGBF''@|$(HAVE_LOGBF)|g' \
+ -e 's|@''HAVE_LOGBL''@|$(HAVE_LOGBL)|g' \
-e 's|@''HAVE_MODFF''@|$(HAVE_MODFF)|g' \
+ -e 's|@''HAVE_MODFL''@|$(HAVE_MODFL)|g' \
-e 's|@''HAVE_POWF''@|$(HAVE_POWF)|g' \
+ -e 's|@''HAVE_REMAINDER''@|$(HAVE_REMAINDER)|g' \
+ -e 's|@''HAVE_REMAINDERF''@|$(HAVE_REMAINDERF)|g' \
-e 's|@''HAVE_RINT''@|$(HAVE_RINT)|g' \
- -e 's|@''HAVE_RINTF''@|$(HAVE_RINTF)|g' \
-e 's|@''HAVE_RINTL''@|$(HAVE_RINTL)|g' \
-e 's|@''HAVE_SINF''@|$(HAVE_SINF)|g' \
-e 's|@''HAVE_SINL''@|$(HAVE_SINL)|g' \
@@ -1090,16 +1176,30 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_DECL_ACOSL''@|$(HAVE_DECL_ACOSL)|g' \
-e 's|@''HAVE_DECL_ASINL''@|$(HAVE_DECL_ASINL)|g' \
-e 's|@''HAVE_DECL_ATANL''@|$(HAVE_DECL_ATANL)|g' \
+ -e 's|@''HAVE_DECL_CBRTF''@|$(HAVE_DECL_CBRTF)|g' \
+ -e 's|@''HAVE_DECL_CBRTL''@|$(HAVE_DECL_CBRTL)|g' \
-e 's|@''HAVE_DECL_CEILF''@|$(HAVE_DECL_CEILF)|g' \
-e 's|@''HAVE_DECL_CEILL''@|$(HAVE_DECL_CEILL)|g' \
+ -e 's|@''HAVE_DECL_COPYSIGNF''@|$(HAVE_DECL_COPYSIGNF)|g' \
-e 's|@''HAVE_DECL_COSL''@|$(HAVE_DECL_COSL)|g' \
-e 's|@''HAVE_DECL_EXPL''@|$(HAVE_DECL_EXPL)|g' \
+ -e 's|@''HAVE_DECL_EXP2''@|$(HAVE_DECL_EXP2)|g' \
+ -e 's|@''HAVE_DECL_EXP2F''@|$(HAVE_DECL_EXP2F)|g' \
+ -e 's|@''HAVE_DECL_EXP2L''@|$(HAVE_DECL_EXP2L)|g' \
+ -e 's|@''HAVE_DECL_EXPM1L''@|$(HAVE_DECL_EXPM1L)|g' \
-e 's|@''HAVE_DECL_FLOORF''@|$(HAVE_DECL_FLOORF)|g' \
-e 's|@''HAVE_DECL_FLOORL''@|$(HAVE_DECL_FLOORL)|g' \
-e 's|@''HAVE_DECL_FREXPL''@|$(HAVE_DECL_FREXPL)|g' \
-e 's|@''HAVE_DECL_LDEXPL''@|$(HAVE_DECL_LDEXPL)|g' \
- -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
-e 's|@''HAVE_DECL_LOGL''@|$(HAVE_DECL_LOGL)|g' \
+ -e 's|@''HAVE_DECL_LOG10L''@|$(HAVE_DECL_LOG10L)|g' \
+ -e 's|@''HAVE_DECL_LOG2''@|$(HAVE_DECL_LOG2)|g' \
+ -e 's|@''HAVE_DECL_LOG2F''@|$(HAVE_DECL_LOG2F)|g' \
+ -e 's|@''HAVE_DECL_LOG2L''@|$(HAVE_DECL_LOG2L)|g' \
+ -e 's|@''HAVE_DECL_LOGB''@|$(HAVE_DECL_LOGB)|g' \
+ -e 's|@''HAVE_DECL_REMAINDER''@|$(HAVE_DECL_REMAINDER)|g' \
+ -e 's|@''HAVE_DECL_REMAINDERL''@|$(HAVE_DECL_REMAINDERL)|g' \
+ -e 's|@''HAVE_DECL_RINTF''@|$(HAVE_DECL_RINTF)|g' \
-e 's|@''HAVE_DECL_ROUND''@|$(HAVE_DECL_ROUND)|g' \
-e 's|@''HAVE_DECL_ROUNDF''@|$(HAVE_DECL_ROUNDF)|g' \
-e 's|@''HAVE_DECL_ROUNDL''@|$(HAVE_DECL_ROUNDL)|g' \
@@ -1110,30 +1210,67 @@ math.h: math.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_DECL_TRUNCF''@|$(HAVE_DECL_TRUNCF)|g' \
-e 's|@''HAVE_DECL_TRUNCL''@|$(HAVE_DECL_TRUNCL)|g' \
| \
- sed -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
+ sed -e 's|@''REPLACE_CBRTF''@|$(REPLACE_CBRTF)|g' \
+ -e 's|@''REPLACE_CBRTL''@|$(REPLACE_CBRTL)|g' \
+ -e 's|@''REPLACE_CEIL''@|$(REPLACE_CEIL)|g' \
-e 's|@''REPLACE_CEILF''@|$(REPLACE_CEILF)|g' \
-e 's|@''REPLACE_CEILL''@|$(REPLACE_CEILL)|g' \
+ -e 's|@''REPLACE_EXPM1''@|$(REPLACE_EXPM1)|g' \
+ -e 's|@''REPLACE_EXPM1F''@|$(REPLACE_EXPM1F)|g' \
+ -e 's|@''REPLACE_EXP2''@|$(REPLACE_EXP2)|g' \
+ -e 's|@''REPLACE_EXP2L''@|$(REPLACE_EXP2L)|g' \
+ -e 's|@''REPLACE_FABSL''@|$(REPLACE_FABSL)|g' \
-e 's|@''REPLACE_FLOOR''@|$(REPLACE_FLOOR)|g' \
-e 's|@''REPLACE_FLOORF''@|$(REPLACE_FLOORF)|g' \
-e 's|@''REPLACE_FLOORL''@|$(REPLACE_FLOORL)|g' \
-e 's|@''REPLACE_FMA''@|$(REPLACE_FMA)|g' \
-e 's|@''REPLACE_FMAF''@|$(REPLACE_FMAF)|g' \
-e 's|@''REPLACE_FMAL''@|$(REPLACE_FMAL)|g' \
+ -e 's|@''REPLACE_FMOD''@|$(REPLACE_FMOD)|g' \
+ -e 's|@''REPLACE_FMODF''@|$(REPLACE_FMODF)|g' \
+ -e 's|@''REPLACE_FMODL''@|$(REPLACE_FMODL)|g' \
-e 's|@''REPLACE_FREXPF''@|$(REPLACE_FREXPF)|g' \
-e 's|@''REPLACE_FREXP''@|$(REPLACE_FREXP)|g' \
-e 's|@''REPLACE_FREXPL''@|$(REPLACE_FREXPL)|g' \
-e 's|@''REPLACE_HUGE_VAL''@|$(REPLACE_HUGE_VAL)|g' \
+ -e 's|@''REPLACE_HYPOT''@|$(REPLACE_HYPOT)|g' \
+ -e 's|@''REPLACE_HYPOTF''@|$(REPLACE_HYPOTF)|g' \
+ -e 's|@''REPLACE_HYPOTL''@|$(REPLACE_HYPOTL)|g' \
+ -e 's|@''REPLACE_ILOGB''@|$(REPLACE_ILOGB)|g' \
+ -e 's|@''REPLACE_ILOGBF''@|$(REPLACE_ILOGBF)|g' \
-e 's|@''REPLACE_ISFINITE''@|$(REPLACE_ISFINITE)|g' \
-e 's|@''REPLACE_ISINF''@|$(REPLACE_ISINF)|g' \
-e 's|@''REPLACE_ISNAN''@|$(REPLACE_ISNAN)|g' \
-e 's|@''REPLACE_ITOLD''@|$(REPLACE_ITOLD)|g' \
-e 's|@''REPLACE_LDEXPL''@|$(REPLACE_LDEXPL)|g' \
+ -e 's|@''REPLACE_LOG''@|$(REPLACE_LOG)|g' \
+ -e 's|@''REPLACE_LOGF''@|$(REPLACE_LOGF)|g' \
+ -e 's|@''REPLACE_LOGL''@|$(REPLACE_LOGL)|g' \
+ -e 's|@''REPLACE_LOG10''@|$(REPLACE_LOG10)|g' \
+ -e 's|@''REPLACE_LOG10F''@|$(REPLACE_LOG10F)|g' \
+ -e 's|@''REPLACE_LOG10L''@|$(REPLACE_LOG10L)|g' \
+ -e 's|@''REPLACE_LOG1P''@|$(REPLACE_LOG1P)|g' \
+ -e 's|@''REPLACE_LOG1PF''@|$(REPLACE_LOG1PF)|g' \
+ -e 's|@''REPLACE_LOG1PL''@|$(REPLACE_LOG1PL)|g' \
+ -e 's|@''REPLACE_LOG2''@|$(REPLACE_LOG2)|g' \
+ -e 's|@''REPLACE_LOG2F''@|$(REPLACE_LOG2F)|g' \
+ -e 's|@''REPLACE_LOG2L''@|$(REPLACE_LOG2L)|g' \
+ -e 's|@''REPLACE_LOGB''@|$(REPLACE_LOGB)|g' \
+ -e 's|@''REPLACE_LOGBF''@|$(REPLACE_LOGBF)|g' \
+ -e 's|@''REPLACE_LOGBL''@|$(REPLACE_LOGBL)|g' \
+ -e 's|@''REPLACE_MODF''@|$(REPLACE_MODF)|g' \
+ -e 's|@''REPLACE_MODFF''@|$(REPLACE_MODFF)|g' \
+ -e 's|@''REPLACE_MODFL''@|$(REPLACE_MODFL)|g' \
-e 's|@''REPLACE_NAN''@|$(REPLACE_NAN)|g' \
+ -e 's|@''REPLACE_REMAINDER''@|$(REPLACE_REMAINDER)|g' \
+ -e 's|@''REPLACE_REMAINDERF''@|$(REPLACE_REMAINDERF)|g' \
+ -e 's|@''REPLACE_REMAINDERL''@|$(REPLACE_REMAINDERL)|g' \
-e 's|@''REPLACE_ROUND''@|$(REPLACE_ROUND)|g' \
-e 's|@''REPLACE_ROUNDF''@|$(REPLACE_ROUNDF)|g' \
-e 's|@''REPLACE_ROUNDL''@|$(REPLACE_ROUNDL)|g' \
-e 's|@''REPLACE_SIGNBIT''@|$(REPLACE_SIGNBIT)|g' \
-e 's|@''REPLACE_SIGNBIT_USING_GCC''@|$(REPLACE_SIGNBIT_USING_GCC)|g' \
+ -e 's|@''REPLACE_SQRTL''@|$(REPLACE_SQRTL)|g' \
-e 's|@''REPLACE_TRUNC''@|$(REPLACE_TRUNC)|g' \
-e 's|@''REPLACE_TRUNCF''@|$(REPLACE_TRUNCF)|g' \
-e 's|@''REPLACE_TRUNCL''@|$(REPLACE_TRUNCL)|g' \
@@ -1387,6 +1524,15 @@ EXTRA_libgnu_la_SOURCES += rmdir.c
## end gnulib module rmdir
+## begin gnulib module round
+
+
+EXTRA_DIST += round.c
+
+EXTRA_libgnu_la_SOURCES += round.c
+
+## end gnulib module round
+
## begin gnulib module safe-read
libgnu_la_SOURCES += safe-read.c
@@ -1817,7 +1963,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
-e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
-e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
-e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
- -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
-e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
-e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@@ -2008,15 +2153,6 @@ EXTRA_DIST += stdlib.in.h
## end gnulib module stdlib
-## begin gnulib module strcase
-
-
-EXTRA_DIST += strcasecmp.c strncasecmp.c
-
-EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
-
-## end gnulib module strcase
-
## begin gnulib module streq
@@ -2143,37 +2279,6 @@ EXTRA_DIST += string.in.h
## end gnulib module string
-## begin gnulib module strings
-
-BUILT_SOURCES += strings.h
-
-# We need the following in order to create <strings.h> when the system
-# doesn't have one that works with the given compiler.
-strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
- $(AM_V_GEN)rm -f $@-t $@ && \
- { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
- sed -e 's|@''GUARD_PREFIX''@|GL|g' \
- -e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
- -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
- -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
- -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
- -e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
- -e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
- -e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
- -e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
- -e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
- -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
- -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
- -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
- < $(srcdir)/strings.in.h; \
- } > $@-t && \
- mv $@-t $@
-MOSTLYCLEANFILES += strings.h strings.h-t
-
-EXTRA_DIST += strings.in.h
-
-## end gnulib module strings
-
## begin gnulib module sys_file
BUILT_SOURCES += sys/file.h
@@ -2269,6 +2374,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+ -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
-e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
-e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
-e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@@ -2336,6 +2442,7 @@ sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
-e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
-e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
-e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+ -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
@@ -2363,6 +2470,7 @@ sys/types.h: sys_types.in.h $(top_builddir)/config.status
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
+ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
< $(srcdir)/sys_types.in.h; \
} > $@-t && \
mv $@-t $@
@@ -2473,6 +2581,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+ -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
-e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
-e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
-e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@@ -2571,6 +2680,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
+ -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
diff --git a/lib/alignof.h b/lib/alignof.h
index 17942eac5..b6d866694 100644
--- a/lib/alignof.h
+++ b/lib/alignof.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _ALIGNOF_H
#define _ALIGNOF_H
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index fe959544d..c36bdf9ae 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -14,9 +14,9 @@
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA. */
+ License along with this program; if not, see
+ <http://www.gnu.org/licenses/>.
+ */
/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
means there is a real alloca function. */
@@ -44,6 +44,13 @@
# define alloca _alloca
# elif defined __DECC && defined __VMS
# define alloca __ALLOCA
+# elif defined __TANDEM && defined _TNS_E_TARGET
+# ifdef __cplusplus
+extern "C"
+# endif
+void *_alloca (unsigned short);
+# pragma intrinsic (_alloca)
+# define alloca _alloca
# else
# include <stddef.h>
# ifdef __cplusplus
diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h
index 4295f67a9..e58072362 100644
--- a/lib/arpa_inet.in.h
+++ b/lib/arpa_inet.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ARPA_INET_H
diff --git a/lib/asnprintf.c b/lib/asnprintf.c
index 1120bed4b..778068fd9 100644
--- a/lib/asnprintf.c
+++ b/lib/asnprintf.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/binary-io.h b/lib/binary-io.h
index 00a78f029..77cbd4ec9 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -25,28 +25,41 @@
so we include it here first. */
#include <stdio.h>
-/* SET_BINARY (fd);
- changes the file descriptor fd to perform binary I/O. */
+/* 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. */
#if O_BINARY
# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__
# include <io.h> /* declares setmode() */
+# define set_binary_mode setmode
# else
-# define setmode _setmode
+# define set_binary_mode _setmode
# undef fileno
# define fileno _fileno
# endif
-# ifdef __DJGPP__
-# include <unistd.h> /* declares isatty() */
- /* Avoid putting stdin/stdout in binary mode if it is connected to
- the console, because that would make it impossible for the user
- to interrupt the program through Ctrl-C or Ctrl-Break. */
-# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0))
-# else
-# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY))
-# endif
#else
- /* On reasonable systems, binary I/O is the default. */
-# define SET_BINARY(fd) /* do nothing */ ((void) 0)
+ /* On reasonable systems, binary I/O is the only choice. */
+ /* Use an inline function rather than a macro, to avoid gcc warnings
+ "warning: statement with no effect". */
+static inline int
+set_binary_mode (int fd, int mode)
+{
+ (void) fd;
+ (void) mode;
+ return O_BINARY;
+}
+#endif
+
+/* SET_BINARY (fd);
+ changes the file descriptor fd to perform binary I/O. */
+#ifdef __DJGPP__
+# include <unistd.h> /* declares isatty() */
+ /* Avoid putting stdin/stdout in binary mode if it is connected to
+ the console, because that would make it impossible for the user
+ to interrupt the program through Ctrl-C or Ctrl-Break. */
+# define SET_BINARY(fd) ((void) (!isatty (fd) ? (set_binary_mode (fd, O_BINARY), 0) : 0))
+#else
+# define SET_BINARY(fd) ((void) set_binary_mode (fd, O_BINARY))
#endif
#endif /* _BINARY_H */
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
index 512bcdc8f..6b388faea 100644
--- a/lib/c-ctype.c
+++ b/lib/c-ctype.c
@@ -13,8 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index aa3c96409..6ef055022 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -18,8 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
-along with this program; if not, write to the Free Software Foundation,
-Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_CTYPE_H
#define C_CTYPE_H
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 3b92ba907..4d8b60c30 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef C_STRCASE_H
#define C_STRCASE_H
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index c8e070612..69831953e 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 32ced380a..dbec89ee1 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 9b03dc6ac..16550cf19 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -156,8 +156,12 @@ __realpath (const char *name, char *resolved)
{
rpath[0] = '/';
dest = rpath + 1;
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT && name[1] == '/')
- *dest++ = '/';
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (name[1] == '/' && name[2] != '/')
+ *dest++ = '/';
+ *dest = '\0';
+ }
}
for (start = end = name; *start; start = end)
@@ -187,7 +191,7 @@ __realpath (const char *name, char *resolved)
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
- && *dest == '/')
+ && *dest == '/' && dest[1] != '/')
dest++;
}
else
@@ -298,8 +302,12 @@ __realpath (const char *name, char *resolved)
if (buf[0] == '/')
{
dest = rpath + 1; /* It's an absolute symlink */
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT && buf[1] == '/')
- *dest++ = '/';
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
+ {
+ if (buf[1] == '/' && buf[2] != '/')
+ *dest++ = '/';
+ *dest = '\0';
+ }
}
else
{
@@ -308,7 +316,7 @@ __realpath (const char *name, char *resolved)
if (dest > rpath + 1)
while ((--dest)[-1] != '/');
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
- && *dest == '/')
+ && *dest == '/' && dest[1] != '/')
dest++;
}
}
@@ -321,7 +329,8 @@ __realpath (const char *name, char *resolved)
}
if (dest > rpath + 1 && dest[-1] == '/')
--dest;
- if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 && *dest == '/')
+ if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
+ && *dest == '/' && dest[1] != '/')
dest++;
*dest = '\0';
diff --git a/lib/ceil.c b/lib/ceil.c
index 58c3adf0e..810179ca7 100644
--- a/lib/ceil.c
+++ b/lib/ceil.c
@@ -54,6 +54,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
diff --git a/lib/config.charset b/lib/config.charset
index d77104814..58ac759c4 100644
--- a/lib/config.charset
+++ b/lib/config.charset
@@ -14,8 +14,7 @@
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
-# with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# The table consists of lines of the form
# ALIAS CANONICAL
@@ -30,7 +29,7 @@
# The current list of GNU canonical charset names is as follows.
#
# name MIME? used by which systems
-# (darwin = MacOS X, woe32 = native Windows)
+# (darwin = Mac OS X, woe32 = native Windows)
#
# ASCII, ANSI_X3.4-1968 glibc solaris freebsd netbsd darwin cygwin
# ISO-8859-1 Y glibc aix hpux irix osf solaris freebsd netbsd openbsd darwin cygwin
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index ff27059fb..888241597 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -55,6 +55,14 @@ typedef struct gl_directory DIR;
# endif
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -229,6 +237,7 @@ _GL_WARN_ON_USE (scandir, "scandir is unportable - "
# if !@HAVE_ALPHASORT@
_GL_FUNCDECL_SYS (alphasort, int,
(const struct dirent **, const struct dirent **)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
/* Need to cast, because on glibc systems, the parameters are
diff --git a/lib/errno.in.h b/lib/errno.in.h
index 7135f286d..21ba05b5f 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ERRNO_H
@@ -85,6 +84,16 @@
# define GNULIB_defined_ECANCELED 1
# endif
+# ifndef EOWNERDEAD
+# define EOWNERDEAD 133
+# define GNULIB_defined_EOWNERDEAD 1
+# endif
+
+# ifndef ENOTRECOVERABLE
+# define ENOTRECOVERABLE 127
+# define GNULIB_defined_ENOTRECOVERABLE 1
+# endif
+
# ifndef EINPROGRESS
# define EINPROGRESS 112
# define EALREADY 103
@@ -109,15 +118,17 @@
# define ELOOP 114
# define EHOSTUNREACH 110
# define EWOULDBLOCK 140
+# define GNULIB_defined_ESOCK 1
+# endif
+
+# ifndef ETXTBSY
# define ETXTBSY 139
# define ENODATA 120 /* not required by POSIX */
# define ENOSR 124 /* not required by POSIX */
# define ENOSTR 125 /* not required by POSIX */
-# define ENOTRECOVERABLE 127 /* not required by POSIX */
-# define EOWNERDEAD 133 /* not required by POSIX */
# define ETIME 137 /* not required by POSIX */
# define EOTHER 131 /* not required by POSIX */
-# define GNULIB_defined_ESOCK 1
+# define GNULIB_defined_ESTREAMS 1
# endif
/* These are intentionally the same values as the WSA* error numbers, defined
@@ -228,6 +239,36 @@
# define GNULIB_defined_ECANCELED 1
# endif
+/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not
+ defined. */
+
+# ifndef EOWNERDEAD
+# if defined __sun
+ /* Use the same values as defined for Solaris >= 8, for
+ interoperability. */
+# define EOWNERDEAD 58
+# define ENOTRECOVERABLE 59
+# elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+ /* We have a conflict here: pthreads-win32 defines these values
+ differently than MSVC 10. It's hairy to decide which one to use. */
+# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS
+ /* Use the same values as defined by pthreads-win32, for
+ interoperability. */
+# define EOWNERDEAD 43
+# define ENOTRECOVERABLE 44
+# else
+ /* Use the same values as defined by MSVC 10, for
+ interoperability. */
+# define EOWNERDEAD 133
+# define ENOTRECOVERABLE 127
+# endif
+# else
+# define EOWNERDEAD 2013
+# define ENOTRECOVERABLE 2014
+# endif
+# define GNULIB_defined_EOWNERDEAD 1
+# define GNULIB_defined_ENOTRECOVERABLE 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 56a1f0d6d..f39dfe51d 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -25,6 +25,8 @@
#if defined __need_system_fcntl_h
/* Special invocation convention. */
+/* Needed before <sys/stat.h>.
+ May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
@@ -42,6 +44,8 @@
#ifndef _@GUARD_PREFIX@_FCNTL_H
+/* Needed before <sys/stat.h>.
+ May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* On some systems other than glibc, <sys/stat.h> is a prerequisite of
<fcntl.h>. On glibc systems, we would like to avoid namespace pollution.
diff --git a/lib/float+.h b/lib/float+.h
index bcb95663c..fd4a9ed08 100644
--- a/lib/float+.h
+++ b/lib/float+.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _FLOATPLUS_H
#define _FLOATPLUS_H
diff --git a/lib/floor.c b/lib/floor.c
index c6311c858..7efbe9e30 100644
--- a/lib/floor.c
+++ b/lib/floor.c
@@ -42,6 +42,12 @@
# define L_(literal) literal##f
#endif
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
diff --git a/lib/fstat.c b/lib/fstat.c
index e0ed800ca..3f49e9b9b 100644
--- a/lib/fstat.c
+++ b/lib/fstat.c
@@ -23,6 +23,12 @@
/* Get the original definition of fstat. It might be defined as a macro. */
#include <sys/types.h>
#include <sys/stat.h>
+#if _GL_WINDOWS_64_BIT_ST_SIZE
+# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
+# define stat _stati64
+# undef fstat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
+# define fstat _fstati64
+#endif
#undef __need_system_sys_stat_h
static inline int
diff --git a/lib/gai_strerror.c b/lib/gai_strerror.c
index 41ad0b25b..8b3669455 100644
--- a/lib/gai_strerror.c
+++ b/lib/gai_strerror.c
@@ -14,8 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBC
# include <config.h>
diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c
index 8a34edef7..e53a69b20 100644
--- a/lib/getaddrinfo.c
+++ b/lib/getaddrinfo.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/gettext.h b/lib/gettext.h
index 53ea28e2c..c7d974078 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1
diff --git a/lib/iconv.c b/lib/iconv.c
index 8695fe484..de2fb315d 100644
--- a/lib/iconv.c
+++ b/lib/iconv.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/iconv.in.h b/lib/iconv.in.h
index e492fcc7b..e15094764 100644
--- a/lib/iconv.in.h
+++ b/lib/iconv.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_ICONV_H
diff --git a/lib/iconv_close.c b/lib/iconv_close.c
index 881e111f7..d8b027a42 100644
--- a/lib/iconv_close.c
+++ b/lib/iconv_close.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/iconv_open.c b/lib/iconv_open.c
index 9e4183b24..c01124153 100644
--- a/lib/iconv_open.c
+++ b/lib/iconv_open.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
@@ -57,7 +56,7 @@ rpl_iconv_open (const char *tocode, const char *fromcode)
iconv() to these encoding inserts a BOM, which is wrong.
We do not need to handle conversion between arbitrary encodings and
UTF-{16,32}{BE,LE}, because the 'striconveh' module implements two-step
- conversion throough UTF-8.
+ conversion through UTF-8.
The _ICONV_* constants are chosen to be disjoint from any iconv_t
returned by the system's iconv_open() functions. Recall that iconv_t
is a scalar type. */
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index c21281bd6..0ccd997d0 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* Copyright (c) 1996-1999 by Internet Software Consortium.
diff --git a/lib/isinf.c b/lib/isinf.c
index 8621bfcd3..5efaa9dd3 100644
--- a/lib/isinf.c
+++ b/lib/isinf.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Ben Pfaff <blp@gnu.org>, 2008. */
diff --git a/lib/langinfo.in.h b/lib/langinfo.in.h
index 807b245d2..63b92fd3a 100644
--- a/lib/langinfo.in.h
+++ b/lib/langinfo.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 2c06328cb..ad28ec673 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible <bruno@clisp.org>. */
@@ -30,7 +29,7 @@
#include <stdlib.h>
#if defined __APPLE__ && defined __MACH__ && HAVE_LANGINFO_CODESET
-# define DARWIN7 /* Darwin 7 or newer, i.e. MacOS X 10.3 or newer */
+# define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */
#endif
#if defined _WIN32 || defined __WIN32__
diff --git a/lib/localcharset.h b/lib/localcharset.h
index e7543fee3..b4467f6b7 100644
--- a/lib/localcharset.h
+++ b/lib/localcharset.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _LOCALCHARSET_H
#define _LOCALCHARSET_H
diff --git a/lib/locale.in.h b/lib/locale.in.h
index 9d25ae325..89b674507 100644
--- a/lib/locale.in.h
+++ b/lib/locale.in.h
@@ -30,7 +30,7 @@
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
-/* MacOS X 10.5 defines the locale_t type in <xlocale.h>. */
+/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
#if @HAVE_XLOCALE_H@
# include <xlocale.h>
#endif
@@ -47,6 +47,111 @@
# define LC_MESSAGES 1729
#endif
+/* Bionic libc's 'struct lconv' is just a dummy. */
+#if @REPLACE_STRUCT_LCONV@
+# define lconv rpl_lconv
+struct lconv
+{
+ /* All 'char *' are actually 'const char *'. */
+
+ /* Members that depend on the LC_NUMERIC category of the locale. See
+ <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
+
+ /* Symbol used as decimal point. */
+ char *decimal_point;
+ /* Symbol used to separate groups of digits to the left of the decimal
+ point. */
+ char *thousands_sep;
+ /* Definition of the size of groups of digits to the left of the decimal
+ point. */
+ char *grouping;
+
+ /* Members that depend on the LC_MONETARY category of the locale. See
+ <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
+
+ /* Symbol used as decimal point. */
+ char *mon_decimal_point;
+ /* Symbol used to separate groups of digits to the left of the decimal
+ point. */
+ char *mon_thousands_sep;
+ /* Definition of the size of groups of digits to the left of the decimal
+ point. */
+ char *mon_grouping;
+ /* Sign used to indicate a value >= 0. */
+ char *positive_sign;
+ /* Sign used to indicate a value < 0. */
+ char *negative_sign;
+
+ /* For formatting local currency. */
+ /* Currency symbol (3 characters) followed by separator (1 character). */
+ char *currency_symbol;
+ /* Number of digits after the decimal point. */
+ char frac_digits;
+ /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+ comes after the number. */
+ char p_cs_precedes;
+ /* For values >= 0: Position of the sign. */
+ char p_sign_posn;
+ /* For values >= 0: Placement of spaces between currency symbol, sign, and
+ number. */
+ char p_sep_by_space;
+ /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+ comes after the number. */
+ char n_cs_precedes;
+ /* For values < 0: Position of the sign. */
+ char n_sign_posn;
+ /* For values < 0: Placement of spaces between currency symbol, sign, and
+ number. */
+ char n_sep_by_space;
+
+ /* For formatting international currency. */
+ /* Currency symbol (3 characters) followed by separator (1 character). */
+ char *int_curr_symbol;
+ /* Number of digits after the decimal point. */
+ char int_frac_digits;
+ /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
+ comes after the number. */
+ char int_p_cs_precedes;
+ /* For values >= 0: Position of the sign. */
+ char int_p_sign_posn;
+ /* For values >= 0: Placement of spaces between currency symbol, sign, and
+ number. */
+ char int_p_sep_by_space;
+ /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
+ comes after the number. */
+ char int_n_cs_precedes;
+ /* For values < 0: Position of the sign. */
+ char int_n_sign_posn;
+ /* For values < 0: Placement of spaces between currency symbol, sign, and
+ number. */
+ char int_n_sep_by_space;
+};
+#endif
+
+#if @GNULIB_LOCALECONV@
+# if @REPLACE_LOCALECONV@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef localeconv
+# define localeconv rpl_localeconv
+# endif
+_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
+_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
+# else
+_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
+# endif
+_GL_CXXALIASWARN (localeconv);
+#elif @REPLACE_STRUCT_LCONV@
+# undef localeconv
+# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
+#elif defined GNULIB_POSIXCHECK
+# undef localeconv
+# if HAVE_RAW_DECL_LOCALECONV
+_GL_WARN_ON_USE (localeconv,
+ "localeconv returns too few information on some platforms - "
+ "use gnulib module localeconv for portability");
+# endif
+#endif
+
#if @GNULIB_SETLOCALE@
# if @REPLACE_SETLOCALE@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/lib/localeconv.c b/lib/localeconv.c
new file mode 100644
index 000000000..c22860ca3
--- /dev/null
+++ b/lib/localeconv.c
@@ -0,0 +1,103 @@
+/* Query locale dependent information for formatting numbers.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <locale.h>
+
+#if HAVE_STRUCT_LCONV_DECIMAL_POINT
+
+/* Override for platforms where 'struct lconv' lacks the int_p_*, int_n_*
+ members. */
+
+struct lconv *
+localeconv (void)
+{
+ static struct lconv result;
+# undef lconv
+# undef localeconv
+ struct lconv *sys_result = localeconv ();
+
+ result.decimal_point = sys_result->decimal_point;
+ result.thousands_sep = sys_result->thousands_sep;
+ result.grouping = sys_result->grouping;
+ result.mon_decimal_point = sys_result->mon_decimal_point;
+ result.mon_thousands_sep = sys_result->mon_thousands_sep;
+ result.mon_grouping = sys_result->mon_grouping;
+ result.positive_sign = sys_result->positive_sign;
+ result.negative_sign = sys_result->negative_sign;
+ result.currency_symbol = sys_result->currency_symbol;
+ result.frac_digits = sys_result->frac_digits;
+ result.p_cs_precedes = sys_result->p_cs_precedes;
+ result.p_sign_posn = sys_result->p_sign_posn;
+ result.p_sep_by_space = sys_result->p_sep_by_space;
+ result.n_cs_precedes = sys_result->n_cs_precedes;
+ result.n_sign_posn = sys_result->n_sign_posn;
+ result.n_sep_by_space = sys_result->n_sep_by_space;
+ result.int_curr_symbol = sys_result->int_curr_symbol;
+ result.int_frac_digits = sys_result->int_frac_digits;
+ result.int_p_cs_precedes = sys_result->p_cs_precedes;
+ result.int_p_sign_posn = sys_result->p_sign_posn;
+ result.int_p_sep_by_space = sys_result->p_sep_by_space;
+ result.int_n_cs_precedes = sys_result->n_cs_precedes;
+ result.int_n_sign_posn = sys_result->n_sign_posn;
+ result.int_n_sep_by_space = sys_result->n_sep_by_space;
+
+ return &result;
+}
+
+#else
+
+/* Override for platforms where 'struct lconv' is a dummy. */
+
+# include <limits.h>
+
+struct lconv *
+localeconv (void)
+{
+ static /*const*/ struct lconv result =
+ {
+ /* decimal_point */ ".",
+ /* thousands_sep */ "",
+ /* grouping */ "",
+ /* mon_decimal_point */ "",
+ /* mon_thousands_sep */ "",
+ /* mon_grouping */ "",
+ /* positive_sign */ "",
+ /* negative_sign */ "",
+ /* currency_symbol */ "",
+ /* frac_digits */ CHAR_MAX,
+ /* p_cs_precedes */ CHAR_MAX,
+ /* p_sign_posn */ CHAR_MAX,
+ /* p_sep_by_space */ CHAR_MAX,
+ /* n_cs_precedes */ CHAR_MAX,
+ /* n_sign_posn */ CHAR_MAX,
+ /* n_sep_by_space */ CHAR_MAX,
+ /* int_curr_symbol */ "",
+ /* int_frac_digits */ CHAR_MAX,
+ /* int_p_cs_precedes */ CHAR_MAX,
+ /* int_p_sign_posn */ CHAR_MAX,
+ /* int_p_sep_by_space */ CHAR_MAX,
+ /* int_n_cs_precedes */ CHAR_MAX,
+ /* int_n_sign_posn */ CHAR_MAX,
+ /* int_n_sep_by_space */ CHAR_MAX
+ };
+
+ return &result;
+}
+
+#endif
diff --git a/lib/log.c b/lib/log.c
new file mode 100644
index 000000000..9ec5eaee8
--- /dev/null
+++ b/lib/log.c
@@ -0,0 +1,38 @@
+/* Logarithm.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+double
+log (double x)
+#undef log
+{
+ if (x <= 0.0)
+ {
+ /* Work around the OSF/1 5.1 bug. */
+ if (x == 0.0)
+ /* Return -Infinity. */
+ return -1.0 / 0.0;
+ /* Work around the NetBSD 5.1, Solaris 11 2011-11 bug. */
+ else /* x < 0.0 */
+ /* Return NaN. */
+ return 0.0 / 0.0;
+ }
+ return log (x);
+}
diff --git a/lib/log1p.c b/lib/log1p.c
new file mode 100644
index 000000000..397b140e6
--- /dev/null
+++ b/lib/log1p.c
@@ -0,0 +1,518 @@
+/* Natural logarithm of 1 plus argument.
+ Copyright (C) 2012 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+/* Specification. */
+#include <math.h>
+
+double
+log1p (double x)
+{
+ if (isnand (x))
+ return x;
+
+ if (x <= -1.0)
+ {
+ if (x == -1.0)
+ /* Return -Infinity. */
+ return - HUGE_VAL;
+ else
+ {
+ /* Return NaN. */
+#if defined _MSC_VER || (defined __sgi && !defined __GNUC__)
+ static double zero;
+ return zero / zero;
+#else
+ return 0.0 / 0.0;
+#endif
+ }
+ }
+
+ if (x < -0.5 || x > 1.0)
+ return log (1.0 + x);
+ /* Here -0.5 <= x <= 1.0. */
+
+ if (x == 0.0)
+ /* Return a zero with the same sign as x. */
+ return x;
+
+ /* Decompose x into
+ 1 + x = (1 + m/256) * (1 + y)
+ where
+ m is an integer, -128 <= m <= 256,
+ y is a number, |y| <= 1/256.
+ y is computed as
+ y = (256 * x - m) / (256 + m).
+ Then
+ log(1+x) = log(m/256) + log(1+y)
+ The first summand is a table lookup.
+ The second summand is computed
+ - either through the power series
+ log(1+y) = y
+ - 1/2 * y^2
+ + 1/3 * y^3
+ - 1/4 * y^4
+ + 1/5 * y^5
+ - 1/6 * y^6
+ + 1/7 * y^7
+ - 1/8 * y^8
+ + 1/9 * y^9
+ - 1/10 * y^10
+ + 1/11 * y^11
+ - 1/12 * y^12
+ + 1/13 * y^13
+ - 1/14 * y^14
+ + 1/15 * y^15
+ - ...
+ - or as log(1+y) = log((1+z)/(1-z)) = 2 * atanh(z)
+ where z = y/(2+y)
+ and atanh(z) is computed through its power series:
+ atanh(z) = z
+ + 1/3 * z^3
+ + 1/5 * z^5
+ + 1/7 * z^7
+ + 1/9 * z^9
+ + 1/11 * z^11
+ + 1/13 * z^13
+ + 1/15 * z^15
+ + ...
+ Since |z| <= 1/511 < 0.002, the relative contribution of the z^9
+ term is < 1/9*0.002^8 < 2^-60 <= 2^-DBL_MANT_DIG, therefore we
+ can truncate the series after the z^7 term. */
+
+ {
+ double m = round (x * 256.0);
+ double y = ((x * 256.0) - m) / (m + 256.0);
+ double z = y / (2.0 + y);
+
+/* Coefficients of the power series for atanh(z). */
+#define ATANH_COEFF_1 1.0
+#define ATANH_COEFF_3 0.333333333333333333333333333333333333334
+#define ATANH_COEFF_5 0.2
+#define ATANH_COEFF_7 0.142857142857142857142857142857142857143
+#define ATANH_COEFF_9 0.1111111111111111111111111111111111111113
+#define ATANH_COEFF_11 0.090909090909090909090909090909090909091
+#define ATANH_COEFF_13 0.076923076923076923076923076923076923077
+#define ATANH_COEFF_15 0.066666666666666666666666666666666666667
+
+ double z2 = z * z;
+ double atanh_z =
+ (((ATANH_COEFF_7
+ * z2 + ATANH_COEFF_5)
+ * z2 + ATANH_COEFF_3)
+ * z2 + ATANH_COEFF_1)
+ * z;
+
+ /* log_table[i] = log((i + 128) / 256).
+ Computed in GNU clisp through
+ (setf (long-float-digits) 128)
+ (setq a 0L0)
+ (setf (long-float-digits) 256)
+ (dotimes (i 385)
+ (format t " ~D,~%"
+ (float (log (* (/ (+ i 128) 256) 1L0)) a))) */
+ static const double log_table[385] =
+ {
+ -0.693147180559945309417232121458176568075,
+ -0.6853650401178903604697692213970398044,
+ -0.677642994023980055266378075415729732197,
+ -0.669980121278410931188432960495886651496,
+ -0.662375521893191621046203913861404403985,
+ -0.65482831625780871022347679633437927773,
+ -0.647337644528651106250552853843513225963,
+ -0.639902666041133026551361927671647791137,
+ -0.632522558743510466836625989417756304788,
+ -0.625196518651437560022666843685547154042,
+ -0.617923759322357783718626781474514153438,
+ -0.61070351134887071814907205278986876216,
+ -0.60353502187025817679728065207969203929,
+ -0.59641755410139419712166106497071313106,
+ -0.58935038687830174459117031769420187977,
+ -0.582332814219655195222425952134964639978,
+ -0.575364144903561854878438011987654863008,
+ -0.568443702058988073553825606077313299585,
+ -0.561570822771226036828515992768693405624,
+ -0.554744857700826173731906247856527380683,
+ -0.547965170715447412135297057717612244552,
+ -0.541231138534103334345428696561292056747,
+ -0.534542150383306725323860946832334992828,
+ -0.527897607664638146541620672180936254347,
+ -0.52129692363328608707713317540302930314,
+ -0.514739523087127012297831879947234599722,
+ -0.50822484206593331675332852879892694707,
+ -0.50175232756031585480793331389686769463,
+ -0.495321437230025429054660050261215099,
+ -0.488931639131254417913411735261937295862,
+ -0.482582411452595671747679308725825054355,
+ -0.476273242259330949798142595713829069596,
+ -0.470003629245735553650937031148342064701,
+ -0.463773079495099479425751396412036696525,
+ -0.457581109247178400339643902517133157939,
+ -0.451427243672800141272924605544662667972,
+ -0.445311016655364052636629355711651820077,
+ -0.43923197057898186527990882355156990061,
+ -0.4331896561230192424451526269158655235,
+ -0.427183632062807368078106194920633178807,
+ -0.421213465076303550585562626925177406092,
+ -0.415278729556489003230882088534775334993,
+ -0.409379007429300711070330899107921801414,
+ -0.403513887976902632538339065932507598071,
+ -0.397682967666109433030550215403212372894,
+ -0.391885849981783528404356583224421075418,
+ -0.386122145265033447342107580922798666387,
+ -0.380391470556048421030985561769857535915,
+ -0.374693449441410693606984907867576972481,
+ -0.369027711905733333326561361023189215893,
+ -0.363393894187477327602809309537386757124,
+ -0.357791638638807479160052541644010369001,
+ -0.352220593589352099112142921677820359633,
+ -0.346680413213736728498769933032403617363,
+ -0.341170757402767124761784665198737642087,
+ -0.33569129163814153519122263131727209364,
+ -0.330241686870576856279407775480686721935,
+ -0.324821619401237656369001967407777741178,
+ -0.31943077076636122859621528874235306143,
+ -0.314068827624975851026378775827156709194,
+ -0.308735481649613269682442058976885699557,
+ -0.303430429419920096046768517454655701024,
+ -0.298153372319076331310838085093194799765,
+ -0.292904016432932602487907019463045397996,
+ -0.287682072451780927439219005993827431504,
+ -0.282487255574676923482925918282353780414,
+ -0.277319285416234343803903228503274262719,
+ -0.272177885915815673288364959951380595626,
+ -0.267062785249045246292687241862699949179,
+ -0.261973715741573968558059642502581569596,
+ -0.256910413785027239068190798397055267412,
+ -0.251872619755070079927735679796875342712,
+ -0.2468600779315257978846419408385075613265,
+ -0.24187253642048672427253973837916408939,
+ -0.2369097470783577150364265832942468196375,
+ -0.2319714654377751430492321958603212094726,
+ -0.2270574506353460848586128739534071682175,
+ -0.222167465341154296870334265401817316702,
+ -0.2173012756899813951520225351537951559,
+ -0.212458651214193401740613666010165016867,
+ -0.2076393647782445016154410442673876674964,
+ -0.202843192514751471266885961812429707545,
+ -0.1980699137620937948192675366153429027185,
+ -0.193319311003495979595900706211132426563,
+ -0.188591169807550022358923589720001638093,
+ -0.183885278770137362613157202229852743197,
+ -0.179201429457710992616226033183958974965,
+ -0.174539416351899677264255125093377869519,
+ -0.169899036795397472900424896523305726435,
+ -0.165280090939102924303339903679875604517,
+ -0.160682381690473465543308397998034325468,
+ -0.156105714663061654850502877304344269052,
+ -0.1515498981272009378406898175577424691056,
+ -0.1470147429618096590348349122269674042104,
+ -0.142500062607283030157283942253263107981,
+ -0.1380056730194437167017517619422725179055,
+ -0.1335313926245226231463436209313499745895,
+ -0.129077042275142343345847831367985856258,
+ -0.124642445207276597338493356591214304499,
+ -0.1202274269981598003244753948319154994493,
+ -0.115831815525121705099120059938680166568,
+ -0.1114554409253228268966213677328042273655,
+ -0.1070981355563671005131126851708522185606,
+ -0.1027597339577689347753154133345778104976,
+ -0.098440072813252519902888574928971234883,
+ -0.094138990913861910035632096996525066015,
+ -0.0898563291218610470766469347968659624282,
+ -0.0855919303354035139161469686670511961825,
+ -0.0813456394539524058873423550293617843895,
+ -0.077117303344431289769666193261475917783,
+ -0.072906770808087780565737488890929711303,
+ -0.0687138925480518083746933774035034481663,
+ -0.064538521137571171672923915683992928129,
+ -0.0603805109889074798714456529545968095868,
+ -0.0562397183228760777967376942769773768851,
+ -0.0521160011390140183616307870527840213665,
+ -0.0480092191863606077520036253234446621373,
+ -0.0439192339348354905263921515528654458042,
+ -0.0398459085471996706586162402473026835046,
+ -0.0357891078515852792753420982122404025613,
+ -0.0317486983145803011569962827485256299276,
+ -0.0277245480148548604671395114515163869272,
+ -0.0237165266173160421183468505286730579517,
+ -0.0197245053477785891192717326571593033246,
+ -0.015748356968139168607549511460828269521,
+ -0.0117879557520422404691605618900871263399,
+ -0.0078431774610258928731840424909435816546,
+ -0.00391389932113632909231778364357266484272,
+ 0.0,
+ 0.00389864041565732301393734309584290701073,
+ 0.00778214044205494894746290006113676367813,
+ 0.01165061721997527413559144280921434893315,
+ 0.0155041865359652541508540460424468358779,
+ 0.01934296284313093463590553454155047018545,
+ 0.0231670592815343782287991609622899165794,
+ 0.0269765876982020757480692925396595457815,
+ 0.0307716586667536883710282075967721640917,
+ 0.0345523815066597334073715005898328652816,
+ 0.038318864302136599193755325123797290346,
+ 0.042071213920687054375203805926962379448,
+ 0.045809536031294203166679267614663342114,
+ 0.049533935122276630882096208829824573267,
+ 0.0532445145188122828658701937865287769396,
+ 0.0569413764001384247590131015404494943015,
+ 0.0606246218164348425806061320404202632862,
+ 0.0642943507053972572162284502656114944857,
+ 0.0679506619085077493945652777726294140346,
+ 0.071593653187008817925605272752092034269,
+ 0.075223421237587525698605339983662414637,
+ 0.078840061707776024531540577859198294559,
+ 0.082443669211074591268160068668307805914,
+ 0.086034337341803153381797826721996075141,
+ 0.0896121586896871326199514693784845287854,
+ 0.093177224854183289768781353027759396216,
+ 0.096729626458551112295571056487463437015,
+ 0.1002694531636751493081301751297276601964,
+ 0.1037967936816435648260618037639746883066,
+ 0.1073117357890880506671750303711543368066,
+ 0.1108143663402901141948061693232119280986,
+ 0.1143047712800586336342591448151747734094,
+ 0.1177830356563834545387941094705217050686,
+ 0.1212492436328696851612122640808405265723,
+ 0.1247034785009572358634065153808632684918,
+ 0.128145822691930038174109886961074873852,
+ 0.1315763577887192725887161286894831624516,
+ 0.134995164537504830601983291147085645626,
+ 0.138402322859119135685325873601649187393,
+ 0.1417979118602573498789527352804727189846,
+ 0.1451820098444978972819350637405643235226,
+ 0.1485546943231371429098223170672938691604,
+ 0.151916042025841975071803424896884511328,
+ 0.1552661289111239515223833017101021786436,
+ 0.1586050301766385840933711746258415752456,
+ 0.161932820269313253240338285123614220592,
+ 0.165249572895307162875611449277240313729,
+ 0.1685553610298066669415865321701023169345,
+ 0.171850256926659222340098946055147264935,
+ 0.1751343321278491480142914649863898412374,
+ 0.1784076574728182971194002415109419683545,
+ 0.181670303107634678260605595617079739242,
+ 0.184922338494011992663903592659249621006,
+ 0.1881638324181829868259905803105539806714,
+ 0.191394852999629454609298807561308873447,
+ 0.194615467699671658858138593767269731516,
+ 0.1978257433299198803625720711969614690756,
+ 0.201025746060590741340908337591797808969,
+ 0.204215541428690891503820386196239272214,
+ 0.2073951943460705871587455788490062338536,
+ 0.210564769107349637669552812732351513721,
+ 0.2137243293977181388619051976331987647734,
+ 0.216873938300614359619089525744347498479,
+ 0.220013658305282095907358638661628360712,
+ 0.2231435513142097557662950903098345033745,
+ 0.226263678650453389361787082280390161607,
+ 0.229374101064845829991480725046139871551,
+ 0.232474878743094064920705078095567528222,
+ 0.235566071312766909077588218941043410137,
+ 0.2386477378501750099171491363522813392526,
+ 0.241719936887145168144307515913513900104,
+ 0.244782726417690916434704717466314811104,
+ 0.247836163904581256780602765746524747999,
+ 0.25088030628580941658844644154994089393,
+ 0.253915209980963444137323297906606667466,
+ 0.256940930897500425446759867911224262093,
+ 0.259957524436926066972079494542311044577,
+ 0.26296504550088135182072917321108602859,
+ 0.265963548497137941339125926537543389269,
+ 0.268953087345503958932974357924497845489,
+ 0.271933715483641758831669494532999161983,
+ 0.274905485872799249167009582983018668293,
+ 0.277868451003456306186350032923401233082,
+ 0.280822662900887784639519758873134832073,
+ 0.28376817313064459834690122235025476666,
+ 0.286705032803954314653250930842073965668,
+ 0.289633292583042676878893055525668970004,
+ 0.292553002686377439978201258664126644308,
+ 0.295464212893835876386681906054964195182,
+ 0.298366972551797281464900430293496918012,
+ 0.301261330578161781012875538233755492657,
+ 0.304147335467296717015819874720446989991,
+ 0.30702503529491186207512454053537790169,
+ 0.309894477722864687861624550833227164546,
+ 0.31275571000389688838624655968831903216,
+ 0.315608778986303334901366180667483174144,
+ 0.318453731118534615810247213590599595595,
+ 0.321290612453734292057863145522557457887,
+ 0.324119468654211976090670760434987352183,
+ 0.326940344995853320592356894073809191681,
+ 0.329753286372467981814422811920789810952,
+ 0.332558337300076601412275626573419425269,
+ 0.335355541921137830257179579814166199074,
+ 0.338144944008716397710235913939267433111,
+ 0.340926586970593210305089199780356208443,
+ 0.34370051385331844468019789211029452987,
+ 0.346466767346208580918462188425772950712,
+ 0.349225389785288304181275421187371759687,
+ 0.35197642315717818465544745625943892599,
+ 0.354719909102929028355011218999317665826,
+ 0.357455888921803774226009490140904474434,
+ 0.360184403575007796281574967493016620926,
+ 0.362905493689368453137824345977489846141,
+ 0.365619199560964711319396875217046453067,
+ 0.368325561158707653048230154050398826898,
+ 0.371024618127872663911964910806824955394,
+ 0.373716409793584080821016832715823506644,
+ 0.376400975164253065997877633436251593315,
+ 0.379078352934969458390853345631019858882,
+ 0.38174858149084833985966626493567607862,
+ 0.384411698910332039734790062481290868519,
+ 0.387067742968448287898902502261817665695,
+ 0.38971675114002521337046360400352086705,
+ 0.392358760602863872479379611988215363485,
+ 0.39499380824086897810639403636498176831,
+ 0.397621930647138489104829072973405554918,
+ 0.40024316412701270692932510199513117008,
+ 0.402857544701083514655197565487057707577,
+ 0.405465108108164381978013115464349136572,
+ 0.408065889808221748430198682969084124381,
+ 0.410659924985268385934306203175822787661,
+ 0.41324724855021933092547601552548590025,
+ 0.415827895143710965613328892954902305356,
+ 0.418401899138883817510763261966760106515,
+ 0.42096929464412963612886716150679597245,
+ 0.423530115505803295718430478017910109426,
+ 0.426084395310900063124544879595476618897,
+ 0.428632167389698760206812276426639053152,
+ 0.43117346481837134085917247895559499848,
+ 0.433708320421559393435847903042186017095,
+ 0.436236766774918070349041323061121300663,
+ 0.438758836207627937745575058511446738878,
+ 0.441274560804875229489496441661301225362,
+ 0.443783972410300981171768440588146426918,
+ 0.446287102628419511532590180619669006749,
+ 0.448783982827006710512822115683937186274,
+ 0.451274644139458585144692383079012478686,
+ 0.453759117467120506644794794442263270651,
+ 0.456237433481587594380805538163929748437,
+ 0.458709622626976664843883309250877913511,
+ 0.461175715122170166367999925597855358603,
+ 0.463635740963032513092182277331163919118,
+ 0.466089729924599224558619247504769399859,
+ 0.468537711563239270375665237462973542708,
+ 0.470979715218791012546897856056359251373,
+ 0.473415770016672131372578393236978550606,
+ 0.475845904869963914265209586304381412175,
+ 0.478270148481470280383546145497464809096,
+ 0.480688529345751907676618455448011551209,
+ 0.48310107575113582273837458485214554795,
+ 0.485507815781700807801791077190788900579,
+ 0.487908777319238973246173184132656942487,
+ 0.490303988045193838150346159645746860531,
+ 0.492693475442575255695076950020077845328,
+ 0.495077266797851514597964584842833665358,
+ 0.497455389202818942250859256731684928918,
+ 0.499827869556449329821331415247044141512,
+ 0.502194734566715494273584171951812573586,
+ 0.504556010752395287058308531738174929982,
+ 0.506911724444854354113196312660089270034,
+ 0.509261901789807946804074919228323824878,
+ 0.51160656874906207851888487520338193135,
+ 0.51394575110223431680100608827421759311,
+ 0.51627947444845449617281928478756106467,
+ 0.518607764208045632152976996364798698556,
+ 0.520930645624185312409809834659637709188,
+ 0.52324814376454783651680722493487084164,
+ 0.525560283522927371382427602307131424923,
+ 0.527867089620842385113892217778300963557,
+ 0.530168586609121617841419630845212405063,
+ 0.532464798869471843873923723460142242606,
+ 0.534755750616027675477923292032637111077,
+ 0.537041465896883654566729244153832299024,
+ 0.539321968595608874655355158077341155752,
+ 0.54159728243274437157654230390043409897,
+ 0.543867430967283517663338989065998323965,
+ 0.546132437598135650382397209231209163864,
+ 0.548392325565573162748150286179863158565,
+ 0.550647117952662279259948179204913460093,
+ 0.552896837686677737580717902230624314327,
+ 0.55514150754050159271548035951590405017,
+ 0.557381150134006357049816540361233647898,
+ 0.559615787935422686270888500526826593487,
+ 0.561845443262691817915664819160697456814,
+ 0.564070138284802966071384290090190711817,
+ 0.566289895023115872590849979337124343595,
+ 0.568504735352668712078738764866962263577,
+ 0.5707146810034715448536245647415894503,
+ 0.572919753561785509092756726626261068625,
+ 0.575119974471387940421742546569273429365,
+ 0.577315365034823604318112061519496401506,
+ 0.579505946414642223855274409488070989814,
+ 0.58169173963462248252061075372537234071,
+ 0.583872765580982679097413356975291104927,
+ 0.586049045003578208904119436287324349516,
+ 0.588220598517086043034868221609113995052,
+ 0.590387446602176374641916708123598757576,
+ 0.59254960960667159874199020959329739696,
+ 0.594707107746692789514343546529205333192,
+ 0.59685996110779383658731192302565801002,
+ 0.59900818964608339938160002446165150206,
+ 0.601151813189334836191674317068856441547,
+ 0.603290851438084262340585186661310605647,
+ 0.6054253239667168894375677681414899356,
+ 0.607555250224541795501085152791125371894,
+ 0.609680649536855273481833501660588408785,
+ 0.611801541105992903529889766428814783686,
+ 0.613917944012370492196929119645563790777,
+ 0.616029877215514019647565928196700650293,
+ 0.618137359555078733872689126674816271683,
+ 0.620240409751857528851494632567246856773,
+ 0.62233904640877874159710264120869663505,
+ 0.62443328801189350104253874405467311991,
+ 0.626523152931352759778820859734204069282,
+ 0.628608659422374137744308205774183639946,
+ 0.6306898256261987050837261409313532241,
+ 0.63276666957103782954578646850357975849,
+ 0.634839209173010211969493840510489008123,
+ 0.63690746223706923162049442718119919119,
+ 0.63897144645792072137962398326473680873,
+ 0.64103117942093129105560133440539254671,
+ 0.643086678603027315392053859585132960477,
+ 0.645137961373584701665228496134731905937,
+ 0.647185044995309550122320631377863036675,
+ 0.64922794662510981889083996990531112227,
+ 0.651266683314958103396333353349672108398,
+ 0.653301272012745638758615881210873884572,
+ 0.65533172956312763209494967856962559648,
+ 0.657358072708360030141890023245936165513,
+ 0.659380318089127826115336413370955804038,
+ 0.661398482245365008260235838709650938148,
+ 0.66341258161706625109695030429080128179,
+ 0.665422632545090448950092610006660181147,
+ 0.667428651271956189947234166318980478403,
+ 0.669430653942629267298885270929503510123,
+ 0.67142865660530232331713904200189252584,
+ 0.67342267521216672029796038880101726475,
+ 0.67541272562017673108090414397019748722,
+ 0.677398823591806140809682609997348298556,
+ 0.67938098479579735014710062847376425181,
+ 0.681359224807903068948071559568089441735,
+ 0.683333559111620688164363148387750369654,
+ 0.68530400309891941654404807896723298642,
+ 0.687270572070960267497006884394346103924,
+ 0.689233281238808980324914337814603903233,
+ 0.691192145724141958859604629216309755938,
+ 0.693147180559945309417232121458176568075
+ };
+ return log_table[128 + (int)m] + 2.0 * atanh_z;
+ }
+}
diff --git a/lib/malloc.c b/lib/malloc.c
index 7a6f3d106..109c65cd8 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* written by Jim Meyering and Bruno Haible */
diff --git a/lib/malloca.c b/lib/malloca.c
index eca55980e..2d4c47972 100644
--- a/lib/malloca.c
+++ b/lib/malloca.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#define _GL_USE_STDLIB_ALLOC 1
#include <config.h>
@@ -22,6 +21,8 @@
/* Specification. */
#include "malloca.h"
+#include <stdint.h>
+
#include "verify.h"
/* The speed critical point in this file is freea() applied to an alloca()
@@ -85,7 +86,7 @@ mmalloca (size_t n)
((int *) p)[-1] = MAGIC_NUMBER;
/* Enter p into the hash table. */
- slot = (unsigned long) p % HASH_TABLE_SIZE;
+ slot = (uintptr_t) p % HASH_TABLE_SIZE;
((struct header *) (p - HEADER_SIZE))->next = mmalloca_results[slot];
mmalloca_results[slot] = p;
@@ -118,7 +119,7 @@ freea (void *p)
{
/* Looks like a mmalloca() result. To see whether it really is one,
perform a lookup in the hash table. */
- size_t slot = (unsigned long) p % HASH_TABLE_SIZE;
+ size_t slot = (uintptr_t) p % HASH_TABLE_SIZE;
void **chain = &mmalloca_results[slot];
for (; *chain != NULL;)
{
diff --git a/lib/malloca.h b/lib/malloca.h
index cb39ceaf0..c9bc15b8c 100644
--- a/lib/malloca.h
+++ b/lib/malloca.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MALLOCA_H
#define _MALLOCA_H
diff --git a/lib/math.in.h b/lib/math.in.h
index 9d6260370..ee0fc9545 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -141,8 +141,64 @@ _NaN ()
/* Solaris 10 defines HUGE_VAL, but as a function pointer rather
than a floating point constant. */
#if @REPLACE_HUGE_VAL@
+# undef HUGE_VALF
+# define HUGE_VALF (1.0f / 0.0f)
# undef HUGE_VAL
# define HUGE_VAL (1.0 / 0.0)
+# undef HUGE_VALL
+# define HUGE_VALL (1.0L / 0.0L)
+#endif
+
+/* HUGE_VALF is a 'float' Infinity. */
+#ifndef HUGE_VALF
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. */
+# define HUGE_VALF (1e25f * 1e25f)
+# else
+# define HUGE_VALF (1.0f / 0.0f)
+# endif
+#endif
+
+/* HUGE_VAL is a 'double' Infinity. */
+#ifndef HUGE_VAL
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. */
+# define HUGE_VAL (1e250 * 1e250)
+# else
+# define HUGE_VAL (1.0 / 0.0)
+# endif
+#endif
+
+/* HUGE_VALL is a 'long double' Infinity. */
+#ifndef HUGE_VALL
+# if defined _MSC_VER
+/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. */
+# define HUGE_VALL (1e250L * 1e250L)
+# else
+# define HUGE_VALL (1.0L / 0.0L)
+# endif
+#endif
+
+
+/* Ensure FP_ILOGB0 and FP_ILOGBNAN are defined. */
+#if !(defined FP_ILOGB0 && defined FP_ILOGBNAN)
+# if defined __NetBSD__ || defined __sgi
+ /* NetBSD, IRIX 6.5: match what ilogb() does */
+# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
+# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# elif defined _AIX
+ /* AIX 5.1: match what ilogb() does in AIX >= 5.2 */
+# define FP_ILOGB0 (- 2147483647 - 1) /* INT_MIN */
+# define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# elif defined __sun
+ /* Solaris 9: match what ilogb() does */
+# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */
+# define FP_ILOGBNAN 2147483647 /* INT_MAX */
+# else
+ /* Gnulib defined values. */
+# define FP_ILOGB0 (- 2147483647) /* - INT_MAX */
+# define FP_ILOGBNAN (- 2147483647 - 1) /* INT_MIN */
+# endif
#endif
@@ -163,6 +219,7 @@ _GL_WARN_ON_USE (acosf, "acosf is unportable - "
#if @GNULIB_ACOSL@
# if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
+# undef acosl
_GL_FUNCDECL_SYS (acosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (acosl, long double, (long double x));
@@ -171,7 +228,7 @@ _GL_CXXALIASWARN (acosl);
# undef acosl
# if HAVE_RAW_DECL_ACOSL
_GL_WARN_ON_USE (acosl, "acosl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module acosl for portability");
# endif
#endif
@@ -193,6 +250,7 @@ _GL_WARN_ON_USE (asinf, "asinf is unportable - "
#if @GNULIB_ASINL@
# if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
+# undef asinl
_GL_FUNCDECL_SYS (asinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (asinl, long double, (long double x));
@@ -201,7 +259,7 @@ _GL_CXXALIASWARN (asinl);
# undef asinl
# if HAVE_RAW_DECL_ASINL
_GL_WARN_ON_USE (asinl, "asinl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module asinl for portability");
# endif
#endif
@@ -223,6 +281,7 @@ _GL_WARN_ON_USE (atanf, "atanf is unportable - "
#if @GNULIB_ATANL@
# if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
+# undef atanl
_GL_FUNCDECL_SYS (atanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (atanl, long double, (long double x));
@@ -231,7 +290,7 @@ _GL_CXXALIASWARN (atanl);
# undef atanl
# if HAVE_RAW_DECL_ATANL
_GL_WARN_ON_USE (atanl, "atanl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module atanl for portability");
# endif
#endif
@@ -252,6 +311,67 @@ _GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
#endif
+#if @GNULIB_CBRTF@
+# if @REPLACE_CBRTF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef cbrtf
+# define cbrtf rpl_cbrtf
+# endif
+_GL_FUNCDECL_RPL (cbrtf, float, (float x));
+_GL_CXXALIAS_RPL (cbrtf, float, (float x));
+# else
+# if !@HAVE_DECL_CBRTF@
+_GL_FUNCDECL_SYS (cbrtf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (cbrtf, float, (float x));
+# endif
+_GL_CXXALIASWARN (cbrtf);
+#elif defined GNULIB_POSIXCHECK
+# undef cbrtf
+# if HAVE_RAW_DECL_CBRTF
+_GL_WARN_ON_USE (cbrtf, "cbrtf is unportable - "
+ "use gnulib module cbrtf for portability");
+# endif
+#endif
+
+#if @GNULIB_CBRT@
+# if !@HAVE_CBRT@
+_GL_FUNCDECL_SYS (cbrt, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (cbrt, double, (double x));
+_GL_CXXALIASWARN (cbrt);
+#elif defined GNULIB_POSIXCHECK
+# undef cbrt
+# if HAVE_RAW_DECL_CBRT
+_GL_WARN_ON_USE (cbrt, "cbrt is unportable - "
+ "use gnulib module cbrt for portability");
+# endif
+#endif
+
+#if @GNULIB_CBRTL@
+# if @REPLACE_CBRTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef cbrtl
+# define cbrtl rpl_cbrtl
+# endif
+_GL_FUNCDECL_RPL (cbrtl, long double, (long double x));
+_GL_CXXALIAS_RPL (cbrtl, long double, (long double x));
+# else
+# if !@HAVE_DECL_CBRTL@
+_GL_FUNCDECL_SYS (cbrtl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (cbrtl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (cbrtl);
+#elif defined GNULIB_POSIXCHECK
+# undef cbrtl
+# if HAVE_RAW_DECL_CBRTL
+_GL_WARN_ON_USE (cbrtl, "cbrtl is unportable - "
+ "use gnulib module cbrtl for portability");
+# endif
+#endif
+
+
#if @GNULIB_CEILF@
# if @REPLACE_CEILF@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -262,6 +382,7 @@ _GL_FUNCDECL_RPL (ceilf, float, (float x));
_GL_CXXALIAS_RPL (ceilf, float, (float x));
# else
# if !@HAVE_DECL_CEILF@
+# undef ceilf
_GL_FUNCDECL_SYS (ceilf, float, (float x));
# endif
_GL_CXXALIAS_SYS (ceilf, float, (float x));
@@ -298,6 +419,7 @@ _GL_FUNCDECL_RPL (ceill, long double, (long double x));
_GL_CXXALIAS_RPL (ceill, long double, (long double x));
# else
# if !@HAVE_DECL_CEILL@
+# undef ceill
_GL_FUNCDECL_SYS (ceill, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (ceill, long double, (long double x));
@@ -313,7 +435,7 @@ _GL_WARN_ON_USE (ceill, "ceill is unportable - "
#if @GNULIB_COPYSIGNF@
-# if !@HAVE_COPYSIGNF@
+# if !@HAVE_DECL_COPYSIGNF@
_GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
# endif
_GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
@@ -372,6 +494,7 @@ _GL_WARN_ON_USE (cosf, "cosf is unportable - "
#if @GNULIB_COSL@
# if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
+# undef cosl
_GL_FUNCDECL_SYS (cosl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (cosl, long double, (long double x));
@@ -380,7 +503,7 @@ _GL_CXXALIASWARN (cosl);
# undef cosl
# if HAVE_RAW_DECL_COSL
_GL_WARN_ON_USE (cosl, "cosl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module cosl for portability");
# endif
#endif
@@ -418,6 +541,7 @@ _GL_WARN_ON_USE (expf, "expf is unportable - "
#if @GNULIB_EXPL@
# if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
+# undef expl
_GL_FUNCDECL_SYS (expl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (expl, long double, (long double x));
@@ -426,7 +550,131 @@ _GL_CXXALIASWARN (expl);
# undef expl
# if HAVE_RAW_DECL_EXPL
_GL_WARN_ON_USE (expl, "expl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module expl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXP2F@
+# if !@HAVE_DECL_EXP2F@
+_GL_FUNCDECL_SYS (exp2f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (exp2f, float, (float x));
+_GL_CXXALIASWARN (exp2f);
+#elif defined GNULIB_POSIXCHECK
+# undef exp2f
+# if HAVE_RAW_DECL_EXP2F
+_GL_WARN_ON_USE (exp2f, "exp2f is unportable - "
+ "use gnulib module exp2f for portability");
+# endif
+#endif
+
+#if @GNULIB_EXP2@
+# if @REPLACE_EXP2@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef exp2
+# define exp2 rpl_exp2
+# endif
+_GL_FUNCDECL_RPL (exp2, double, (double x));
+_GL_CXXALIAS_RPL (exp2, double, (double x));
+# else
+# if !@HAVE_DECL_EXP2@
+_GL_FUNCDECL_SYS (exp2, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (exp2, double, (double x));
+# endif
+_GL_CXXALIASWARN (exp2);
+#elif defined GNULIB_POSIXCHECK
+# undef exp2
+# if HAVE_RAW_DECL_EXP2
+_GL_WARN_ON_USE (exp2, "exp2 is unportable - "
+ "use gnulib module exp2 for portability");
+# endif
+#endif
+
+#if @GNULIB_EXP2L@
+# if @REPLACE_EXP2L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef exp2l
+# define exp2l rpl_exp2l
+# endif
+_GL_FUNCDECL_RPL (exp2l, long double, (long double x));
+_GL_CXXALIAS_RPL (exp2l, long double, (long double x));
+# else
+# if !@HAVE_DECL_EXP2L@
+# undef exp2l
+_GL_FUNCDECL_SYS (exp2l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (exp2l, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (exp2l);
+#elif defined GNULIB_POSIXCHECK
+# undef exp2l
+# if HAVE_RAW_DECL_EXP2L
+_GL_WARN_ON_USE (exp2l, "exp2l is unportable - "
+ "use gnulib module exp2l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_EXPM1F@
+# if @REPLACE_EXPM1F@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expm1f
+# define expm1f rpl_expm1f
+# endif
+_GL_FUNCDECL_RPL (expm1f, float, (float x));
+_GL_CXXALIAS_RPL (expm1f, float, (float x));
+# else
+# if !@HAVE_EXPM1F@
+_GL_FUNCDECL_SYS (expm1f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (expm1f, float, (float x));
+# endif
+_GL_CXXALIASWARN (expm1f);
+#elif defined GNULIB_POSIXCHECK
+# undef expm1f
+# if HAVE_RAW_DECL_EXPM1F
+_GL_WARN_ON_USE (expm1f, "expm1f is unportable - "
+ "use gnulib module expm1f for portability");
+# endif
+#endif
+
+#if @GNULIB_EXPM1@
+# if @REPLACE_EXPM1@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef expm1
+# define expm1 rpl_expm1
+# endif
+_GL_FUNCDECL_RPL (expm1, double, (double x));
+_GL_CXXALIAS_RPL (expm1, double, (double x));
+# else
+# if !@HAVE_EXPM1@
+_GL_FUNCDECL_SYS (expm1, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (expm1, double, (double x));
+# endif
+_GL_CXXALIASWARN (expm1);
+#elif defined GNULIB_POSIXCHECK
+# undef expm1
+# if HAVE_RAW_DECL_EXPM1
+_GL_WARN_ON_USE (expm1, "expm1 is unportable - "
+ "use gnulib module expm1 for portability");
+# endif
+#endif
+
+#if @GNULIB_EXPM1L@
+# if !@HAVE_DECL_EXPM1L@
+# undef expm1l
+_GL_FUNCDECL_SYS (expm1l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (expm1l, long double, (long double x));
+_GL_CXXALIASWARN (expm1l);
+#elif defined GNULIB_POSIXCHECK
+# undef expm1l
+# if HAVE_RAW_DECL_EXPM1L
+_GL_WARN_ON_USE (expm1l, "expm1l is unportable - "
+ "use gnulib module expm1l for portability");
# endif
#endif
@@ -446,6 +694,30 @@ _GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
# endif
#endif
+#if @GNULIB_FABSL@
+# if @REPLACE_FABSL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fabsl
+# define fabsl rpl_fabsl
+# endif
+_GL_FUNCDECL_RPL (fabsl, long double, (long double x));
+_GL_CXXALIAS_RPL (fabsl, long double, (long double x));
+# else
+# if !@HAVE_FABSL@
+# undef fabsl
+_GL_FUNCDECL_SYS (fabsl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (fabsl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (fabsl);
+#elif defined GNULIB_POSIXCHECK
+# undef fabsl
+# if HAVE_RAW_DECL_FABSL
+_GL_WARN_ON_USE (fabsl, "fabsl is unportable - "
+ "use gnulib module fabsl for portability");
+# endif
+#endif
+
#if @GNULIB_FLOORF@
# if @REPLACE_FLOORF@
@@ -457,6 +729,7 @@ _GL_FUNCDECL_RPL (floorf, float, (float x));
_GL_CXXALIAS_RPL (floorf, float, (float x));
# else
# if !@HAVE_DECL_FLOORF@
+# undef floorf
_GL_FUNCDECL_SYS (floorf, float, (float x));
# endif
_GL_CXXALIAS_SYS (floorf, float, (float x));
@@ -493,6 +766,7 @@ _GL_FUNCDECL_RPL (floorl, long double, (long double x));
_GL_CXXALIAS_RPL (floorl, long double, (long double x));
# else
# if !@HAVE_DECL_FLOORL@
+# undef floorl
_GL_FUNCDECL_SYS (floorl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (floorl, long double, (long double x));
@@ -565,6 +839,7 @@ _GL_CXXALIAS_RPL (fmal, long double,
(long double x, long double y, long double z));
# else
# if !@HAVE_FMAL@
+# undef fmal
_GL_FUNCDECL_SYS (fmal, long double,
(long double x, long double y, long double z));
# endif
@@ -582,11 +857,20 @@ _GL_WARN_ON_USE (fmal, "fmal is unportable - "
#if @GNULIB_FMODF@
-# if !@HAVE_FMODF@
-# undef fmodf
+# if @REPLACE_FMODF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fmodf
+# define fmodf rpl_fmodf
+# endif
+_GL_FUNCDECL_RPL (fmodf, float, (float x, float y));
+_GL_CXXALIAS_RPL (fmodf, float, (float x, float y));
+# else
+# if !@HAVE_FMODF@
+# undef fmodf
_GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
-# endif
+# endif
_GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
+# endif
_GL_CXXALIASWARN (fmodf);
#elif defined GNULIB_POSIXCHECK
# undef fmodf
@@ -596,6 +880,50 @@ _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
# endif
#endif
+#if @GNULIB_FMOD@
+# if @REPLACE_FMOD@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fmod
+# define fmod rpl_fmod
+# endif
+_GL_FUNCDECL_RPL (fmod, double, (double x, double y));
+_GL_CXXALIAS_RPL (fmod, double, (double x, double y));
+# else
+_GL_CXXALIAS_SYS (fmod, double, (double x, double y));
+# endif
+_GL_CXXALIASWARN (fmod);
+#elif defined GNULIB_POSIXCHECK
+# undef fmod
+# if HAVE_RAW_DECL_FMOD
+_GL_WARN_ON_USE (fmod, "fmod has portability problems - "
+ "use gnulib module fmod for portability");
+# endif
+#endif
+
+#if @GNULIB_FMODL@
+# if @REPLACE_FMODL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef fmodl
+# define fmodl rpl_fmodl
+# endif
+_GL_FUNCDECL_RPL (fmodl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (fmodl, long double, (long double x, long double y));
+# else
+# if !@HAVE_FMODL@
+# undef fmodl
+_GL_FUNCDECL_SYS (fmodl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIAS_SYS (fmodl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIASWARN (fmodl);
+#elif defined GNULIB_POSIXCHECK
+# undef fmodl
+# if HAVE_RAW_DECL_FMODL
+_GL_WARN_ON_USE (fmodl, "fmodl is unportable - "
+ "use gnulib module fmodl for portability");
+# endif
+#endif
+
/* Write x as
x = mantissa * 2^exp
@@ -689,6 +1017,137 @@ _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
#endif
+/* Return sqrt(x^2+y^2). */
+#if @GNULIB_HYPOTF@
+# if @REPLACE_HYPOTF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef hypotf
+# define hypotf rpl_hypotf
+# endif
+_GL_FUNCDECL_RPL (hypotf, float, (float x, float y));
+_GL_CXXALIAS_RPL (hypotf, float, (float x, float y));
+# else
+# if !@HAVE_HYPOTF@
+_GL_FUNCDECL_SYS (hypotf, float, (float x, float y));
+# endif
+_GL_CXXALIAS_SYS (hypotf, float, (float x, float y));
+# endif
+_GL_CXXALIASWARN (hypotf);
+#elif defined GNULIB_POSIXCHECK
+# undef hypotf
+# if HAVE_RAW_DECL_HYPOTF
+_GL_WARN_ON_USE (hypotf, "hypotf is unportable - "
+ "use gnulib module hypotf for portability");
+# endif
+#endif
+
+/* Return sqrt(x^2+y^2). */
+#if @GNULIB_HYPOT@
+# if @REPLACE_HYPOT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef hypot
+# define hypot rpl_hypot
+# endif
+_GL_FUNCDECL_RPL (hypot, double, (double x, double y));
+_GL_CXXALIAS_RPL (hypot, double, (double x, double y));
+# else
+_GL_CXXALIAS_SYS (hypot, double, (double x, double y));
+# endif
+_GL_CXXALIASWARN (hypot);
+#elif defined GNULIB_POSIXCHECK
+# undef hypot
+# if HAVE_RAW_DECL_HYPOT
+_GL_WARN_ON_USE (hypotf, "hypot has portability problems - "
+ "use gnulib module hypot for portability");
+# endif
+#endif
+
+/* Return sqrt(x^2+y^2). */
+#if @GNULIB_HYPOTL@
+# if @REPLACE_HYPOTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef hypotl
+# define hypotl rpl_hypotl
+# endif
+_GL_FUNCDECL_RPL (hypotl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (hypotl, long double, (long double x, long double y));
+# else
+# if !@HAVE_HYPOTL@
+_GL_FUNCDECL_SYS (hypotl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIAS_SYS (hypotl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIASWARN (hypotl);
+#elif defined GNULIB_POSIXCHECK
+# undef hypotl
+# if HAVE_RAW_DECL_HYPOTL
+_GL_WARN_ON_USE (hypotl, "hypotl is unportable - "
+ "use gnulib module hypotl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_ILOGBF@
+# if @REPLACE_ILOGBF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ilogbf
+# define ilogbf rpl_ilogbf
+# endif
+_GL_FUNCDECL_RPL (ilogbf, int, (float x));
+_GL_CXXALIAS_RPL (ilogbf, int, (float x));
+# else
+# if !@HAVE_ILOGBF@
+_GL_FUNCDECL_SYS (ilogbf, int, (float x));
+# endif
+_GL_CXXALIAS_SYS (ilogbf, int, (float x));
+# endif
+_GL_CXXALIASWARN (ilogbf);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbf
+# if HAVE_RAW_DECL_ILOGBF
+_GL_WARN_ON_USE (ilogbf, "ilogbf is unportable - "
+ "use gnulib module ilogbf for portability");
+# endif
+#endif
+
+#if @GNULIB_ILOGB@
+# if @REPLACE_ILOGB@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ilogb
+# define ilogb rpl_ilogb
+# endif
+_GL_FUNCDECL_RPL (ilogb, int, (double x));
+_GL_CXXALIAS_RPL (ilogb, int, (double x));
+# else
+# if !@HAVE_ILOGB@
+_GL_FUNCDECL_SYS (ilogb, int, (double x));
+# endif
+_GL_CXXALIAS_SYS (ilogb, int, (double x));
+# endif
+_GL_CXXALIASWARN (ilogb);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogb
+# if HAVE_RAW_DECL_ILOGB
+_GL_WARN_ON_USE (ilogb, "ilogb is unportable - "
+ "use gnulib module ilogb for portability");
+# endif
+#endif
+
+#if @GNULIB_ILOGBL@
+# if !@HAVE_ILOGBL@
+_GL_FUNCDECL_SYS (ilogbl, int, (long double x));
+# endif
+_GL_CXXALIAS_SYS (ilogbl, int, (long double x));
+_GL_CXXALIASWARN (ilogbl);
+#elif defined GNULIB_POSIXCHECK
+# undef ilogbl
+# if HAVE_RAW_DECL_ILOGBL
+_GL_WARN_ON_USE (ilogbl, "ilogbl is unportable - "
+ "use gnulib module ilogbl for portability");
+# endif
+#endif
+
+
/* Return x * 2^exp. */
#if @GNULIB_LDEXPF@
# if !@HAVE_LDEXPF@
@@ -733,25 +1192,21 @@ _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
#endif
-#if @GNULIB_LOGB@
-# if !@HAVE_DECL_LOGB@
-_GL_EXTERN_C double logb (double x);
-# endif
-#elif defined GNULIB_POSIXCHECK
-# undef logb
-# if HAVE_RAW_DECL_LOGB
-_GL_WARN_ON_USE (logb, "logb is unportable - "
- "use gnulib module logb for portability");
-# endif
-#endif
-
-
#if @GNULIB_LOGF@
-# if !@HAVE_LOGF@
-# undef logf
+# if @REPLACE_LOGF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef logf
+# define logf rpl_logf
+# endif
+_GL_FUNCDECL_RPL (logf, float, (float x));
+_GL_CXXALIAS_RPL (logf, float, (float x));
+# else
+# if !@HAVE_LOGF@
+# undef logf
_GL_FUNCDECL_SYS (logf, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (logf, float, (float x));
+# endif
_GL_CXXALIASWARN (logf);
#elif defined GNULIB_POSIXCHECK
# undef logf
@@ -761,27 +1216,66 @@ _GL_WARN_ON_USE (logf, "logf is unportable - "
# endif
#endif
+#if @GNULIB_LOG@
+# if @REPLACE_LOG@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log
+# define log rpl_log
+# endif
+_GL_FUNCDECL_RPL (log, double, (double x));
+_GL_CXXALIAS_RPL (log, double, (double x));
+# else
+_GL_CXXALIAS_SYS (log, double, (double x));
+# endif
+_GL_CXXALIASWARN (log);
+#elif defined GNULIB_POSIXCHECK
+# undef log
+# if HAVE_RAW_DECL_LOG
+_GL_WARN_ON_USE (log, "log has portability problems - "
+ "use gnulib module log for portability");
+# endif
+#endif
+
#if @GNULIB_LOGL@
-# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
+# if @REPLACE_LOGL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef logl
+# define logl rpl_logl
+# endif
+_GL_FUNCDECL_RPL (logl, long double, (long double x));
+_GL_CXXALIAS_RPL (logl, long double, (long double x));
+# else
+# if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
+# undef logl
_GL_FUNCDECL_SYS (logl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (logl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (logl);
#elif defined GNULIB_POSIXCHECK
# undef logl
# if HAVE_RAW_DECL_LOGL
_GL_WARN_ON_USE (logl, "logl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module logl for portability");
# endif
#endif
#if @GNULIB_LOG10F@
-# if !@HAVE_LOG10F@
-# undef log10f
+# if @REPLACE_LOG10F@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log10f
+# define log10f rpl_log10f
+# endif
+_GL_FUNCDECL_RPL (log10f, float, (float x));
+_GL_CXXALIAS_RPL (log10f, float, (float x));
+# else
+# if !@HAVE_LOG10F@
+# undef log10f
_GL_FUNCDECL_SYS (log10f, float, (float x));
-# endif
+# endif
_GL_CXXALIAS_SYS (log10f, float, (float x));
+# endif
_GL_CXXALIASWARN (log10f);
#elif defined GNULIB_POSIXCHECK
# undef log10f
@@ -791,13 +1285,278 @@ _GL_WARN_ON_USE (log10f, "log10f is unportable - "
# endif
#endif
+#if @GNULIB_LOG10@
+# if @REPLACE_LOG10@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log10
+# define log10 rpl_log10
+# endif
+_GL_FUNCDECL_RPL (log10, double, (double x));
+_GL_CXXALIAS_RPL (log10, double, (double x));
+# else
+_GL_CXXALIAS_SYS (log10, double, (double x));
+# endif
+_GL_CXXALIASWARN (log10);
+#elif defined GNULIB_POSIXCHECK
+# undef log10
+# if HAVE_RAW_DECL_LOG10
+_GL_WARN_ON_USE (log10, "log10 has portability problems - "
+ "use gnulib module log10 for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG10L@
+# if @REPLACE_LOG10L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log10l
+# define log10l rpl_log10l
+# endif
+_GL_FUNCDECL_RPL (log10l, long double, (long double x));
+_GL_CXXALIAS_RPL (log10l, long double, (long double x));
+# else
+# if !@HAVE_LOG10L@ || !@HAVE_DECL_LOG10L@
+# undef log10l
+_GL_FUNCDECL_SYS (log10l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (log10l, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (log10l);
+#elif defined GNULIB_POSIXCHECK
+# undef log10l
+# if HAVE_RAW_DECL_LOG10L
+_GL_WARN_ON_USE (log10l, "log10l is unportable - "
+ "use gnulib module log10l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOG1PF@
+# if @REPLACE_LOG1PF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log1pf
+# define log1pf rpl_log1pf
+# endif
+_GL_FUNCDECL_RPL (log1pf, float, (float x));
+_GL_CXXALIAS_RPL (log1pf, float, (float x));
+# else
+# if !@HAVE_LOG1PF@
+_GL_FUNCDECL_SYS (log1pf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (log1pf, float, (float x));
+# endif
+_GL_CXXALIASWARN (log1pf);
+#elif defined GNULIB_POSIXCHECK
+# undef log1pf
+# if HAVE_RAW_DECL_LOG1PF
+_GL_WARN_ON_USE (log1pf, "log1pf is unportable - "
+ "use gnulib module log1pf for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG1P@
+# if @REPLACE_LOG1P@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log1p
+# define log1p rpl_log1p
+# endif
+_GL_FUNCDECL_RPL (log1p, double, (double x));
+_GL_CXXALIAS_RPL (log1p, double, (double x));
+# else
+# if !@HAVE_LOG1P@
+_GL_FUNCDECL_SYS (log1p, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (log1p, double, (double x));
+# endif
+_GL_CXXALIASWARN (log1p);
+#elif defined GNULIB_POSIXCHECK
+# undef log1p
+# if HAVE_RAW_DECL_LOG1P
+_GL_WARN_ON_USE (log1p, "log1p has portability problems - "
+ "use gnulib module log1p for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG1PL@
+# if @REPLACE_LOG1PL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log1pl
+# define log1pl rpl_log1pl
+# endif
+_GL_FUNCDECL_RPL (log1pl, long double, (long double x));
+_GL_CXXALIAS_RPL (log1pl, long double, (long double x));
+# else
+# if !@HAVE_LOG1PL@
+_GL_FUNCDECL_SYS (log1pl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (log1pl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (log1pl);
+#elif defined GNULIB_POSIXCHECK
+# undef log1pl
+# if HAVE_RAW_DECL_LOG1PL
+_GL_WARN_ON_USE (log1pl, "log1pl has portability problems - "
+ "use gnulib module log1pl for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOG2F@
+# if @REPLACE_LOG2F@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log2f
+# define log2f rpl_log2f
+# endif
+_GL_FUNCDECL_RPL (log2f, float, (float x));
+_GL_CXXALIAS_RPL (log2f, float, (float x));
+# else
+# if !@HAVE_DECL_LOG2F@
+# undef log2f
+_GL_FUNCDECL_SYS (log2f, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (log2f, float, (float x));
+# endif
+_GL_CXXALIASWARN (log2f);
+#elif defined GNULIB_POSIXCHECK
+# undef log2f
+# if HAVE_RAW_DECL_LOG2F
+_GL_WARN_ON_USE (log2f, "log2f is unportable - "
+ "use gnulib module log2f for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG2@
+# if @REPLACE_LOG2@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log2
+# define log2 rpl_log2
+# endif
+_GL_FUNCDECL_RPL (log2, double, (double x));
+_GL_CXXALIAS_RPL (log2, double, (double x));
+# else
+# if !@HAVE_DECL_LOG2@
+# undef log2
+_GL_FUNCDECL_SYS (log2, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (log2, double, (double x));
+# endif
+_GL_CXXALIASWARN (log2);
+#elif defined GNULIB_POSIXCHECK
+# undef log2
+# if HAVE_RAW_DECL_LOG2
+_GL_WARN_ON_USE (log2, "log2 is unportable - "
+ "use gnulib module log2 for portability");
+# endif
+#endif
+
+#if @GNULIB_LOG2L@
+# if @REPLACE_LOG2L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef log2l
+# define log2l rpl_log2l
+# endif
+_GL_FUNCDECL_RPL (log2l, long double, (long double x));
+_GL_CXXALIAS_RPL (log2l, long double, (long double x));
+# else
+# if !@HAVE_DECL_LOG2L@
+_GL_FUNCDECL_SYS (log2l, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (log2l, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (log2l);
+#elif defined GNULIB_POSIXCHECK
+# undef log2l
+# if HAVE_RAW_DECL_LOG2L
+_GL_WARN_ON_USE (log2l, "log2l is unportable - "
+ "use gnulib module log2l for portability");
+# endif
+#endif
+
+
+#if @GNULIB_LOGBF@
+# if @REPLACE_LOGBF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef logbf
+# define logbf rpl_logbf
+# endif
+_GL_FUNCDECL_RPL (logbf, float, (float x));
+_GL_CXXALIAS_RPL (logbf, float, (float x));
+# else
+# if !@HAVE_LOGBF@
+_GL_FUNCDECL_SYS (logbf, float, (float x));
+# endif
+_GL_CXXALIAS_SYS (logbf, float, (float x));
+# endif
+_GL_CXXALIASWARN (logbf);
+#elif defined GNULIB_POSIXCHECK
+# undef logbf
+# if HAVE_RAW_DECL_LOGBF
+_GL_WARN_ON_USE (logbf, "logbf is unportable - "
+ "use gnulib module logbf for portability");
+# endif
+#endif
+
+#if @GNULIB_LOGB@
+# if @REPLACE_LOGB@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef logb
+# define logb rpl_logb
+# endif
+_GL_FUNCDECL_RPL (logb, double, (double x));
+_GL_CXXALIAS_RPL (logb, double, (double x));
+# else
+# if !@HAVE_DECL_LOGB@
+_GL_FUNCDECL_SYS (logb, double, (double x));
+# endif
+_GL_CXXALIAS_SYS (logb, double, (double x));
+# endif
+_GL_CXXALIASWARN (logb);
+#elif defined GNULIB_POSIXCHECK
+# undef logb
+# if HAVE_RAW_DECL_LOGB
+_GL_WARN_ON_USE (logb, "logb is unportable - "
+ "use gnulib module logb for portability");
+# endif
+#endif
+
+#if @GNULIB_LOGBL@
+# if @REPLACE_LOGBL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef logbl
+# define logbl rpl_logbl
+# endif
+_GL_FUNCDECL_RPL (logbl, long double, (long double x));
+_GL_CXXALIAS_RPL (logbl, long double, (long double x));
+# else
+# if !@HAVE_LOGBL@
+_GL_FUNCDECL_SYS (logbl, long double, (long double x));
+# endif
+_GL_CXXALIAS_SYS (logbl, long double, (long double x));
+# endif
+_GL_CXXALIASWARN (logbl);
+#elif defined GNULIB_POSIXCHECK
+# undef logbl
+# if HAVE_RAW_DECL_LOGBL
+_GL_WARN_ON_USE (logbl, "logbl is unportable - "
+ "use gnulib module logbl for portability");
+# endif
+#endif
+
#if @GNULIB_MODFF@
-# if !@HAVE_MODFF@
-# undef modff
+# if @REPLACE_MODFF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef modff
+# define modff rpl_modff
+# endif
+_GL_FUNCDECL_RPL (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modff, float, (float x, float *iptr));
+# else
+# if !@HAVE_MODFF@
+# undef modff
_GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
-# endif
+# endif
_GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
+# endif
_GL_CXXALIASWARN (modff);
#elif defined GNULIB_POSIXCHECK
# undef modff
@@ -807,6 +1566,52 @@ _GL_WARN_ON_USE (modff, "modff is unportable - "
# endif
#endif
+#if @GNULIB_MODF@
+# if @REPLACE_MODF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef modf
+# define modf rpl_modf
+# endif
+_GL_FUNCDECL_RPL (modf, double, (double x, double *iptr) _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modf, double, (double x, double *iptr));
+# else
+_GL_CXXALIAS_SYS (modf, double, (double x, double *iptr));
+# endif
+_GL_CXXALIASWARN (modf);
+#elif defined GNULIB_POSIXCHECK
+# undef modf
+# if HAVE_RAW_DECL_MODF
+_GL_WARN_ON_USE (modf, "modf has portability problems - "
+ "use gnulib module modf for portability");
+# endif
+#endif
+
+#if @GNULIB_MODFL@
+# if @REPLACE_MODFL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef modfl
+# define modfl rpl_modfl
+# endif
+_GL_FUNCDECL_RPL (modfl, long double, (long double x, long double *iptr)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (modfl, long double, (long double x, long double *iptr));
+# else
+# if !@HAVE_MODFL@
+# undef modfl
+_GL_FUNCDECL_SYS (modfl, long double, (long double x, long double *iptr)
+ _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (modfl, long double, (long double x, long double *iptr));
+# endif
+_GL_CXXALIASWARN (modfl);
+#elif defined GNULIB_POSIXCHECK
+# undef modfl
+# if HAVE_RAW_DECL_MODFL
+_GL_WARN_ON_USE (modfl, "modfl is unportable - "
+ "use gnulib module modfl for portability");
+# endif
+#endif
+
#if @GNULIB_POWF@
# if !@HAVE_POWF@
@@ -824,8 +1629,79 @@ _GL_WARN_ON_USE (powf, "powf is unportable - "
#endif
+#if @GNULIB_REMAINDERF@
+# if @REPLACE_REMAINDERF@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef remainderf
+# define remainderf rpl_remainderf
+# endif
+_GL_FUNCDECL_RPL (remainderf, float, (float x, float y));
+_GL_CXXALIAS_RPL (remainderf, float, (float x, float y));
+# else
+# if !@HAVE_REMAINDERF@
+_GL_FUNCDECL_SYS (remainderf, float, (float x, float y));
+# endif
+_GL_CXXALIAS_SYS (remainderf, float, (float x, float y));
+# endif
+_GL_CXXALIASWARN (remainderf);
+#elif defined GNULIB_POSIXCHECK
+# undef remainderf
+# if HAVE_RAW_DECL_REMAINDERF
+_GL_WARN_ON_USE (remainderf, "remainderf is unportable - "
+ "use gnulib module remainderf for portability");
+# endif
+#endif
+
+#if @GNULIB_REMAINDER@
+# if @REPLACE_REMAINDER@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef remainder
+# define remainder rpl_remainder
+# endif
+_GL_FUNCDECL_RPL (remainder, double, (double x, double y));
+_GL_CXXALIAS_RPL (remainder, double, (double x, double y));
+# else
+# if !@HAVE_REMAINDER@ || !@HAVE_DECL_REMAINDER@
+_GL_FUNCDECL_SYS (remainder, double, (double x, double y));
+# endif
+_GL_CXXALIAS_SYS (remainder, double, (double x, double y));
+# endif
+_GL_CXXALIASWARN (remainder);
+#elif defined GNULIB_POSIXCHECK
+# undef remainder
+# if HAVE_RAW_DECL_REMAINDER
+_GL_WARN_ON_USE (remainder, "remainder is unportable - "
+ "use gnulib module remainder for portability");
+# endif
+#endif
+
+#if @GNULIB_REMAINDERL@
+# if @REPLACE_REMAINDERL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef remainderl
+# define remainderl rpl_remainderl
+# endif
+_GL_FUNCDECL_RPL (remainderl, long double, (long double x, long double y));
+_GL_CXXALIAS_RPL (remainderl, long double, (long double x, long double y));
+# else
+# if !@HAVE_DECL_REMAINDERL@
+# undef remainderl
+_GL_FUNCDECL_SYS (remainderl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIAS_SYS (remainderl, long double, (long double x, long double y));
+# endif
+_GL_CXXALIASWARN (remainderl);
+#elif defined GNULIB_POSIXCHECK
+# undef remainderl
+# if HAVE_RAW_DECL_REMAINDERL
+_GL_WARN_ON_USE (remainderl, "remainderl is unportable - "
+ "use gnulib module remainderl for portability");
+# endif
+#endif
+
+
#if @GNULIB_RINTF@
-# if !@HAVE_RINTF@
+# if !@HAVE_DECL_RINTF@
_GL_FUNCDECL_SYS (rintf, float, (float x));
# endif
_GL_CXXALIAS_SYS (rintf, float, (float x));
@@ -923,6 +1799,7 @@ _GL_FUNCDECL_RPL (roundl, long double, (long double x));
_GL_CXXALIAS_RPL (roundl, long double, (long double x));
# else
# if !@HAVE_DECL_ROUNDL@
+# undef roundl
_GL_FUNCDECL_SYS (roundl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (roundl, long double, (long double x));
@@ -954,6 +1831,7 @@ _GL_WARN_ON_USE (sinf, "sinf is unportable - "
#if @GNULIB_SINL@
# if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
+# undef sinl
_GL_FUNCDECL_SYS (sinl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (sinl, long double, (long double x));
@@ -962,7 +1840,7 @@ _GL_CXXALIASWARN (sinl);
# undef sinl
# if HAVE_RAW_DECL_SINL
_GL_WARN_ON_USE (sinl, "sinl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module sinl for portability");
# endif
#endif
@@ -999,16 +1877,26 @@ _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
#endif
#if @GNULIB_SQRTL@
-# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
+# if @REPLACE_SQRTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef sqrtl
+# define sqrtl rpl_sqrtl
+# endif
+_GL_FUNCDECL_RPL (sqrtl, long double, (long double x));
+_GL_CXXALIAS_RPL (sqrtl, long double, (long double x));
+# else
+# if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
+# undef sqrtl
_GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
-# endif
+# endif
_GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
+# endif
_GL_CXXALIASWARN (sqrtl);
#elif defined GNULIB_POSIXCHECK
# undef sqrtl
# if HAVE_RAW_DECL_SQRTL
_GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module sqrtl for portability");
# endif
#endif
@@ -1030,6 +1918,7 @@ _GL_WARN_ON_USE (tanf, "tanf is unportable - "
#if @GNULIB_TANL@
# if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
+# undef tanl
_GL_FUNCDECL_SYS (tanl, long double, (long double x));
# endif
_GL_CXXALIAS_SYS (tanl, long double, (long double x));
@@ -1038,7 +1927,7 @@ _GL_CXXALIASWARN (tanl);
# undef tanl
# if HAVE_RAW_DECL_TANL
_GL_WARN_ON_USE (tanl, "tanl is unportable - "
- "use gnulib module mathl for portability");
+ "use gnulib module tanl for portability");
# endif
#endif
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 05fb14847..5f2ec0704 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -128,7 +128,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
{
const char *encoding = locale_charset ();
- if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
+ if (STREQ_OPT (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
{
/* Cf. unistr/u8-mblen.c. */
unsigned char c = (unsigned char) p[0];
@@ -185,7 +185,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
/* As a reference for this code, you can use the GNU libiconv
implementation. Look for uses of the RET_TOOFEW macro. */
- if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
+ if (STREQ_OPT (encoding,
+ "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
{
if (m == 1)
{
@@ -208,9 +209,12 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
- if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
- || STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
- || STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
+ if (STREQ_OPT (encoding,
+ "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+ || STREQ_OPT (encoding,
+ "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
+ || STREQ_OPT (encoding,
+ "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
{
if (m == 1)
{
@@ -221,7 +225,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
- if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
+ if (STREQ_OPT (encoding,
+ "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
{
if (m == 1)
{
@@ -239,7 +244,8 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
- if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
+ if (STREQ_OPT (encoding,
+ "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
{
if (m == 1)
{
@@ -272,7 +278,7 @@ mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
}
goto invalid;
}
- if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
+ if (STREQ_OPT (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
{
if (m == 1)
{
diff --git a/lib/msvc-inval.c b/lib/msvc-inval.c
index 4efa61174..7da354128 100644
--- a/lib/msvc-inval.c
+++ b/lib/msvc-inval.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h
index bb78aac67..ce6fceebd 100644
--- a/lib/msvc-inval.h
+++ b/lib/msvc-inval.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MSVC_INVAL_H
#define _MSVC_INVAL_H
diff --git a/lib/msvc-nothrow.c b/lib/msvc-nothrow.c
index 71983116b..3e791c3a0 100644
--- a/lib/msvc-nothrow.c
+++ b/lib/msvc-nothrow.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h
index beb3ac97c..573bc8e10 100644
--- a/lib/msvc-nothrow.h
+++ b/lib/msvc-nothrow.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _MSVC_NOTHROW_H
#define _MSVC_NOTHROW_H
diff --git a/lib/netdb.in.h b/lib/netdb.in.h
index cdf356a5a..63ebd2d62 100644
--- a/lib/netdb.in.h
+++ b/lib/netdb.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <netdb.h>.
It is intended to provide definitions and prototypes needed by an
diff --git a/lib/netinet_in.in.h b/lib/netinet_in.in.h
index 8bf37a659..a93dcdf47 100644
--- a/lib/netinet_in.in.h
+++ b/lib/netinet_in.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_NETINET_IN_H
diff --git a/lib/nproc.c b/lib/nproc.c
index 6932ac98e..c4b151a2c 100644
--- a/lib/nproc.c
+++ b/lib/nproc.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */
@@ -257,7 +256,7 @@ num_processors (enum nproc_query query)
}
#if defined _SC_NPROCESSORS_ONLN
- { /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
+ { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_ONLN);
if (nprocs > 0)
@@ -268,7 +267,7 @@ num_processors (enum nproc_query query)
else /* query == NPROC_ALL */
{
#if defined _SC_NPROCESSORS_CONF
- { /* This works on glibc, MacOS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
+ { /* This works on glibc, Mac OS X 10.5, FreeBSD, AIX, OSF/1, Solaris,
Cygwin, Haiku. */
long int nprocs = sysconf (_SC_NPROCESSORS_CONF);
@@ -333,7 +332,7 @@ num_processors (enum nproc_query query)
NPROC_CURRENT and NPROC_ALL. */
#if HAVE_SYSCTL && defined HW_NCPU
- { /* This works on MacOS X, FreeBSD, NetBSD, OpenBSD. */
+ { /* This works on Mac OS X, FreeBSD, NetBSD, OpenBSD. */
int nprocs;
size_t len = sizeof (nprocs);
static int mib[2] = { CTL_HW, HW_NCPU };
diff --git a/lib/nproc.h b/lib/nproc.h
index ac2ddd5c0..c5f632215 100644
--- a/lib/nproc.h
+++ b/lib/nproc.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Glen Lenker and Bruno Haible. */
diff --git a/lib/pathmax.h b/lib/pathmax.h
index 4d643a7a3..23613217f 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PATHMAX_H
# define _PATHMAX_H
diff --git a/lib/pipe2.c b/lib/pipe2.c
index 12a5a8aee..2c018d5f2 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/printf-args.c b/lib/printf-args.c
index bddbf6d34..c768883fe 100644
--- a/lib/printf-args.c
+++ b/lib/printf-args.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
diff --git a/lib/printf-args.h b/lib/printf-args.h
index 0fdfaa514..0bc75ca17 100644
--- a/lib/printf-args.h
+++ b/lib/printf-args.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PRINTF_ARGS_H
#define _PRINTF_ARGS_H
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index 6aded7c68..fcc302f4b 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
CHAR_T The element type of the format string.
@@ -402,7 +401,7 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
cp++;
}
#if defined __APPLE__ && defined __MACH__
- /* On MacOS X 10.3, PRIdMAX is defined as "qd".
+ /* On Mac OS X 10.3, PRIdMAX is defined as "qd".
We cannot change it to "lld" because PRIdMAX must also
be understood by the system's printf routines. */
else if (*cp == 'q')
diff --git a/lib/printf-parse.h b/lib/printf-parse.h
index c6a083ca6..94883c642 100644
--- a/lib/printf-parse.h
+++ b/lib/printf-parse.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _PRINTF_PARSE_H
#define _PRINTF_PARSE_H
diff --git a/lib/ref-add.sin b/lib/ref-add.sin
index 2aa782631..8c1a7d0bd 100644
--- a/lib/ref-add.sin
+++ b/lib/ref-add.sin
@@ -13,8 +13,7 @@
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
-# with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Written by Bruno Haible <haible@clisp.cons.org>.
#
diff --git a/lib/ref-del.sin b/lib/ref-del.sin
index a2ad6ad64..fd8758898 100644
--- a/lib/ref-del.sin
+++ b/lib/ref-del.sin
@@ -13,8 +13,7 @@
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License along
-# with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# with this program; if not, see <http://www.gnu.org/licenses/>.
#
# Written by Bruno Haible <haible@clisp.cons.org>.
#
diff --git a/lib/regcomp.c b/lib/regcomp.c
index ac1330779..76947c24e 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -14,8 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern,
size_t length, reg_syntax_t syntax);
@@ -273,7 +272,7 @@ int
re_compile_fastmap (bufp)
struct re_pattern_buffer *bufp;
{
- re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
+ re_dfa_t *dfa = bufp->buffer;
char *fastmap = bufp->fastmap;
memset (fastmap, '\0', sizeof (char) * SBC_MAX);
@@ -307,7 +306,7 @@ static void
re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
char *fastmap)
{
- re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
+ re_dfa_t *dfa = bufp->buffer;
Idx node_cnt;
bool icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
for (node_cnt = 0; node_cnt < init_state->nodes.nelem; ++node_cnt)
@@ -586,19 +585,23 @@ weak_alias (__regerror, regerror)
static const bitset_t utf8_sb_map =
{
/* Set the first 128 bits. */
-# if 4 * BITSET_WORD_BITS < ASCII_CHARS
-# error "bitset_word_t is narrower than 32 bits"
-# elif 3 * BITSET_WORD_BITS < ASCII_CHARS
+# ifdef __GNUC__
+ [0 ... 0x80 / BITSET_WORD_BITS - 1] = BITSET_WORD_MAX
+# else
+# if 4 * BITSET_WORD_BITS < ASCII_CHARS
+# error "bitset_word_t is narrower than 32 bits"
+# elif 3 * BITSET_WORD_BITS < ASCII_CHARS
BITSET_WORD_MAX, BITSET_WORD_MAX, BITSET_WORD_MAX,
-# elif 2 * BITSET_WORD_BITS < ASCII_CHARS
+# elif 2 * BITSET_WORD_BITS < ASCII_CHARS
BITSET_WORD_MAX, BITSET_WORD_MAX,
-# elif 1 * BITSET_WORD_BITS < ASCII_CHARS
+# elif 1 * BITSET_WORD_BITS < ASCII_CHARS
BITSET_WORD_MAX,
-# endif
+# endif
(BITSET_WORD_MAX
>> (SBC_MAX % BITSET_WORD_BITS == 0
? 0
: BITSET_WORD_BITS - SBC_MAX % BITSET_WORD_BITS))
+# endif
};
#endif
@@ -657,7 +660,7 @@ void
regfree (preg)
regex_t *preg;
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
if (BE (dfa != NULL, 1))
free_dfa_content (dfa);
preg->buffer = NULL;
@@ -764,7 +767,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
preg->regs_allocated = REGS_UNALLOCATED;
/* Initialize the dfa. */
- dfa = (re_dfa_t *) preg->buffer;
+ dfa = preg->buffer;
if (BE (preg->allocated < sizeof (re_dfa_t), 0))
{
/* If zero allocated, but buffer is non-null, try to realloc
@@ -775,7 +778,7 @@ re_compile_internal (regex_t *preg, const char * pattern, size_t length,
if (dfa == NULL)
return REG_ESPACE;
preg->allocated = sizeof (re_dfa_t);
- preg->buffer = (unsigned char *) dfa;
+ preg->buffer = dfa;
}
preg->used = sizeof (re_dfa_t);
@@ -850,7 +853,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
{
__re_size_t table_size;
#ifndef _LIBC
- char *codeset_name;
+ const char *codeset_name;
#endif
#ifdef RE_ENABLE_I18N
size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
@@ -873,7 +876,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
calculation below, and for similar doubling calculations
elsewhere. And it's <= rather than <, because some of the
doubling calculations add 1 afterwards. */
- if (BE (SIZE_MAX / max_object_size / 2 <= pat_len, 0))
+ if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) / 2 <= pat_len, 0))
return REG_ESPACE;
dfa->nodes_alloc = pat_len + 1;
@@ -896,8 +899,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
!= 0);
#else
codeset_name = nl_langinfo (CODESET);
- if (strcasecmp (codeset_name, "UTF-8") == 0
- || strcasecmp (codeset_name, "UTF8") == 0)
+ if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
+ && (codeset_name[1] == 'T' || codeset_name[1] == 't')
+ && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
+ && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
dfa->is_utf8 = 1;
/* We check exhaustively in the loop below if this charset is a
@@ -947,9 +952,43 @@ static void
internal_function
init_word_char (re_dfa_t *dfa)
{
- int i, j, ch;
dfa->word_ops_used = 1;
- for (i = 0, ch = 0; i < BITSET_WORDS; ++i)
+ int i = 0;
+ int j;
+ int ch = 0;
+ if (BE (dfa->map_notascii == 0, 1))
+ {
+ bitset_word_t bits0 = 0x00000000;
+ bitset_word_t bits1 = 0x03ff0000;
+ bitset_word_t bits2 = 0x87fffffe;
+ bitset_word_t bits3 = 0x07fffffe;
+ if (BITSET_WORD_BITS == 64)
+ {
+ dfa->word_char[0] = bits1 << 31 << 1 | bits0;
+ dfa->word_char[1] = bits3 << 31 << 1 | bits2;
+ i = 2;
+ }
+ else if (BITSET_WORD_BITS == 32)
+ {
+ dfa->word_char[0] = bits0;
+ dfa->word_char[1] = bits1;
+ dfa->word_char[2] = bits2;
+ dfa->word_char[3] = bits3;
+ i = 4;
+ }
+ else
+ goto general_case;
+ ch = 128;
+
+ if (BE (dfa->is_utf8, 1))
+ {
+ memset (&dfa->word_char[i], '\0', (SBC_MAX - ch) / 8);
+ return;
+ }
+ }
+
+ general_case:
+ for (; i < BITSET_WORDS; ++i)
for (j = 0; j < BITSET_WORD_BITS; ++j, ++ch)
if (isalnum (ch) || ch == '_')
dfa->word_char[i] |= (bitset_word_t) 1 << j;
@@ -960,7 +999,7 @@ init_word_char (re_dfa_t *dfa)
static void
free_workarea_compile (regex_t *preg)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_storage_t *storage, *next;
for (storage = dfa->str_tree_storage; storage; storage = next)
{
@@ -1144,7 +1183,7 @@ optimize_utf8 (re_dfa_t *dfa)
static reg_errcode_t
analyze (regex_t *preg)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
reg_errcode_t ret;
/* Allocate arrays. */
@@ -1325,7 +1364,7 @@ lower_subexps (void *extra, bin_tree_t *node)
static bin_tree_t *
lower_subexp (reg_errcode_t *err, regex_t *preg, bin_tree_t *node)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_t *body = node->left;
bin_tree_t *op, *cls, *tree1, *tree;
@@ -2092,7 +2131,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
/* Entry point of the parser.
Parse the regular expression REGEXP and return the structure tree.
- If an error is occured, ERR is set by error code, and return NULL.
+ If an error occurs, ERR is set by error code, and return NULL.
This function build the following tree, from regular expression <reg_exp>:
CAT
/ \
@@ -2106,7 +2145,7 @@ static bin_tree_t *
parse (re_string_t *regexp, regex_t *preg, reg_syntax_t syntax,
reg_errcode_t *err)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree, *eor, *root;
re_token_t current_token;
dfa->syntax = syntax;
@@ -2140,7 +2179,7 @@ static bin_tree_t *
parse_reg_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree, *branch = NULL;
tree = parse_branch (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0))
@@ -2182,7 +2221,7 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
bin_tree_t *tree, *expr;
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
tree = parse_expression (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && tree == NULL, 0))
return NULL;
@@ -2193,16 +2232,21 @@ parse_branch (re_string_t *regexp, regex_t *preg, re_token_t *token,
expr = parse_expression (regexp, preg, token, syntax, nest, err);
if (BE (*err != REG_NOERROR && expr == NULL, 0))
{
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
return NULL;
}
if (tree != NULL && expr != NULL)
{
- tree = create_tree (dfa, tree, expr, CONCAT);
- if (tree == NULL)
+ bin_tree_t *newtree = create_tree (dfa, tree, expr, CONCAT);
+ if (newtree == NULL)
{
+ postorder (expr, free_tree, NULL);
+ postorder (tree, free_tree, NULL);
*err = REG_ESPACE;
return NULL;
}
+ tree = newtree;
}
else if (tree == NULL)
tree = expr;
@@ -2221,7 +2265,7 @@ static bin_tree_t *
parse_expression (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree;
switch (token->type)
{
@@ -2437,7 +2481,7 @@ static bin_tree_t *
parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
reg_syntax_t syntax, Idx nest, reg_errcode_t *err)
{
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
bin_tree_t *tree;
size_t cur_nsub;
cur_nsub = preg->re_nsub++;
@@ -2451,7 +2495,11 @@ parse_sub_exp (re_string_t *regexp, regex_t *preg, re_token_t *token,
{
tree = parse_reg_exp (regexp, preg, token, syntax, nest, err);
if (BE (*err == REG_NOERROR && token->type != OP_CLOSE_SUBEXP, 0))
- *err = REG_EPAREN;
+ {
+ if (tree != NULL)
+ postorder (tree, free_tree, NULL);
+ *err = REG_EPAREN;
+ }
if (BE (*err != REG_NOERROR, 0))
return NULL;
}
@@ -2529,6 +2577,12 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
*err = REG_BADBR;
return NULL;
}
+
+ if (BE (RE_DUP_MAX < (end == REG_MISSING ? start : end), 0))
+ {
+ *err = REG_ESIZE;
+ return NULL;
+ }
}
else
{
@@ -2569,7 +2623,10 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
old_tree = NULL;
if (elem->token.type == SUBEXP)
- postorder (elem, mark_opt_subexp, (void *) (long) elem->token.opr.idx);
+ {
+ uintptr_t subidx = elem->token.opr.idx;
+ postorder (elem, mark_opt_subexp, (void *) subidx);
+ }
tree = create_tree (dfa, elem, NULL,
(end == REG_MISSING ? OP_DUP_ASTERISK : OP_ALT));
@@ -2615,7 +2672,7 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
- mbcset->range_ends, is a pointer argument sinse we may
+ mbcset->range_ends, is a pointer argument since we may
update it. */
static reg_errcode_t
@@ -2749,11 +2806,12 @@ build_range_exp (const reg_syntax_t syntax,
static reg_errcode_t
internal_function
-build_collating_symbol (bitset_t sbcset,
# ifdef RE_ENABLE_I18N
- re_charset_t *mbcset, Idx *coll_sym_alloc,
-# endif
- const unsigned char *name)
+build_collating_symbol (bitset_t sbcset, re_charset_t *mbcset,
+ Idx *coll_sym_alloc, const unsigned char *name)
+# else /* not RE_ENABLE_I18N */
+build_collating_symbol (bitset_t sbcset, const unsigned char *name)
+# endif /* not RE_ENABLE_I18N */
{
size_t name_len = strlen ((const char *) name);
if (BE (name_len != 1, 0))
@@ -2781,8 +2839,8 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
const int32_t *symb_table;
const unsigned char *extra;
- /* Local function for parse_bracket_exp used in _LIBC environement.
- Seek the collating symbol entry correspondings to NAME.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
+ Seek the collating symbol entry corresponding to NAME.
Return the index of the symbol in the SYMB_TABLE. */
auto inline int32_t
@@ -2885,11 +2943,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return UINT_MAX;
}
- /* Local function for parse_bracket_exp used in _LIBC environement.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
RANGE_ALLOC is the allocated size of mbcset->range_starts, and
- mbcset->range_ends, is a pointer argument sinse we may
+ mbcset->range_ends, is a pointer argument since we may
update it. */
auto inline reg_errcode_t
@@ -2969,11 +3027,11 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
return REG_NOERROR;
}
- /* Local function for parse_bracket_exp used in _LIBC environement.
+ /* Local function for parse_bracket_exp used in _LIBC environment.
Build the collating element which is represented by NAME.
The result are written to MBCSET and SBCSET.
COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a
- pointer argument sinse we may update it. */
+ pointer argument since we may update it. */
auto inline reg_errcode_t
__attribute ((always_inline))
@@ -3075,6 +3133,10 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
if (BE (sbcset == NULL, 0))
#endif /* RE_ENABLE_I18N */
{
+ re_free (sbcset);
+#ifdef RE_ENABLE_I18N
+ re_free (mbcset);
+#endif
*err = REG_ESPACE;
return NULL;
}
@@ -3413,7 +3475,7 @@ parse_bracket_symbol (bracket_elem_t *elem, re_string_t *regexp,
Build the equivalence class which is represented by NAME.
The result are written to MBCSET and SBCSET.
EQUIV_CLASS_ALLOC is the allocated size of mbcset->equiv_classes,
- is a pointer argument sinse we may update it. */
+ is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
@@ -3444,19 +3506,18 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
_NL_COLLATE_EXTRAMB);
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
- idx1 = findidx (&cp);
- if (BE (idx1 == 0 || cp < name + strlen ((const char *) name), 0))
+ idx1 = findidx (&cp, -1);
+ if (BE (idx1 == 0 || *cp != '\0', 0))
/* This isn't a valid character. */
return REG_ECOLLATE;
- /* Build single byte matcing table for this equivalence class. */
- char_buf[1] = (unsigned char) '\0';
+ /* Build single byte matching table for this equivalence class. */
len = weights[idx1 & 0xffffff];
for (ch = 0; ch < SBC_MAX; ++ch)
{
char_buf[0] = ch;
cp = char_buf;
- idx2 = findidx (&cp);
+ idx2 = findidx (&cp, 1);
/*
idx2 = table[ch];
*/
@@ -3509,7 +3570,7 @@ build_equiv_class (bitset_t sbcset, const unsigned char *name)
Build the character class which is represented by NAME.
The result are written to MBCSET and SBCSET.
CHAR_CLASS_ALLOC is the allocated size of mbcset->char_classes,
- is a pointer argument sinse we may update it. */
+ is a pointer argument since we may update it. */
static reg_errcode_t
#ifdef RE_ENABLE_I18N
@@ -3705,6 +3766,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
/* This is intended for the expressions like "a{1,3}".
Fetch a number from 'input', and return the number.
Return REG_MISSING if the number field is empty like "{,1}".
+ Return RE_DUP_MAX + 1 if the number field is too large.
Return REG_ERROR if an error occurred. */
static Idx
@@ -3723,8 +3785,9 @@ fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
num = ((token->type != CHARACTER || c < '0' || '9' < c
|| num == REG_ERROR)
? REG_ERROR
- : ((num == REG_MISSING) ? c - '0' : num * 10 + c - '0'));
- num = (num > RE_DUP_MAX) ? REG_ERROR : num;
+ : num == REG_MISSING
+ ? c - '0'
+ : MIN (RE_DUP_MAX + 1, num * 10 + c - '0'));
}
return num;
}
@@ -3798,7 +3861,7 @@ create_token_tree (re_dfa_t *dfa, bin_tree_t *left, bin_tree_t *right,
static reg_errcode_t
mark_opt_subexp (void *extra, bin_tree_t *node)
{
- Idx idx = (Idx) (long) extra;
+ Idx idx = (uintptr_t) extra;
if (node->token.type == SUBEXP && node->token.opr.idx == idx)
node->token.opt_subexp = 1;
diff --git a/lib/regex.c b/lib/regex.c
index 6e0f752b3..c578852c2 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -14,12 +14,20 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
-#include <config.h>
+#ifndef _LIBC
+# include <config.h>
-/* Make sure noone compiles this code with a C++ compiler. */
+# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
+# endif
+# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wtype-limits"
+# endif
+#endif
+
+/* Make sure no one compiles this code with a C++ compiler. */
#if defined __cplusplus && defined _LIBC
# error "This is C code, use a C compiler"
#endif
@@ -53,7 +61,6 @@
GNU regex allows. Include it before <regex.h>, which correctly
#undefs RE_DUP_MAX and sets it to the right value. */
#include <limits.h>
-#include <strings.h>
#include <regex.h>
#include "regex_internal.h"
diff --git a/lib/regex.h b/lib/regex.h
index b612adbf5..07c1b3da3 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,6 +1,6 @@
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2006, 2009-2012
+ Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,8 +15,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _REGEX_H
#define _REGEX_H 1
@@ -28,13 +27,10 @@
extern "C" {
#endif
-/* Define __USE_GNU_REGEX to declare GNU extensions that violate the
+/* Define __USE_GNU to declare GNU extensions that violate the
POSIX name space rules. */
-#undef __USE_GNU_REGEX
-#if (defined _GNU_SOURCE \
- || (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \
- && !defined _XOPEN_SOURCE))
-# define __USE_GNU_REGEX 1
+#ifdef _GNU_SOURCE
+# define __USE_GNU 1
#endif
#ifdef _REGEX_LARGE_OFFSETS
@@ -45,16 +41,6 @@ extern "C" {
supported within glibc itself, and glibc users should not define
_REGEX_LARGE_OFFSETS. */
-/* The type of the offset of a byte within a string.
- For historical reasons POSIX 1003.1-2004 requires that regoff_t be
- at least as wide as off_t. However, many common POSIX platforms set
- regoff_t to the more-sensible ssize_t and the Open Group has
- signalled its intention to change the requirement to be that
- regoff_t be at least as wide as ptrdiff_t and ssize_t; see XBD ERN
- 60 (2005-08-25). We don't know of any hosts where ssize_t or
- ptrdiff_t is wider than ssize_t, so ssize_t is safe. */
-typedef ssize_t regoff_t;
-
/* The type of nonnegative object indexes. Traditionally, GNU regex
uses 'int' for these. Code that uses __re_idx_t should work
regardless of whether the type is signed. */
@@ -69,10 +55,8 @@ typedef size_t __re_long_size_t;
#else
-/* Use types that are binary-compatible with the traditional GNU regex
- implementation, which mishandles strings longer than INT_MAX. */
-
-typedef int regoff_t;
+/* The traditional GNU regex implementation mishandles strings longer
+ than INT_MAX. */
typedef int __re_idx_t;
typedef unsigned int __re_size_t;
typedef unsigned long int __re_long_size_t;
@@ -93,8 +77,7 @@ typedef unsigned long int active_reg_t;
add or remove a bit, only one other definition need change. */
typedef unsigned long int reg_syntax_t;
-#ifdef __USE_GNU_REGEX
-
+#ifdef __USE_GNU
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
@@ -225,8 +208,7 @@ typedef unsigned long int reg_syntax_t;
/* If this bit is set, then no_sub will be set to 1 during
re_compile_pattern. */
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
-
-#endif /* defined __USE_GNU_REGEX */
+#endif
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
@@ -234,7 +216,7 @@ typedef unsigned long int reg_syntax_t;
already-compiled regexps. */
extern reg_syntax_t re_syntax_options;
-#ifdef __USE_GNU_REGEX
+#ifdef __USE_GNU
/* Define combinations of the above bits for the standard possibilities.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
@@ -246,16 +228,19 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
+ | RE_CHAR_CLASSES \
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
# define RE_SYNTAX_GNU_AWK \
- ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
- & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
- | RE_CONTEXT_INVALID_OPS ))
+ ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
+ | RE_INVALID_INTERVAL_ORD) \
+ & ~(RE_DOT_NOT_NULL | RE_CONTEXT_INDEP_OPS \
+ | RE_CONTEXT_INVALID_OPS ))
# define RE_SYNTAX_POSIX_AWK \
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
- | RE_INTERVALS | RE_NO_GNU_OPS)
+ | RE_INTERVALS | RE_NO_GNU_OPS \
+ | RE_INVALID_INTERVAL_ORD)
# define RE_SYNTAX_GREP \
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
@@ -306,13 +291,12 @@ extern reg_syntax_t re_syntax_options;
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
/* [[[end syntaxes]]] */
-#endif /* defined __USE_GNU_REGEX */
-
-#ifdef __USE_GNU_REGEX
-
/* Maximum number of duplicates an interval can allow. POSIX-conforming
systems might define this in <limits.h>, but we want our
value, so remove any previous define. */
+# ifdef _REGEX_INCLUDE_LIMITS_H
+# include <limits.h>
+# endif
# ifdef RE_DUP_MAX
# undef RE_DUP_MAX
# endif
@@ -320,13 +304,12 @@ extern reg_syntax_t re_syntax_options;
/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
the counter as a 2-byte signed integer. This is no longer true, so
RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
- ((SIZE_MAX - 2) / 10 - 1) if _REGEX_LARGE_OFFSETS is defined.
+ ((SIZE_MAX - 9) / 10) if _REGEX_LARGE_OFFSETS is defined.
However, there would be a huge performance problem if someone
actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
its historical value. */
# define RE_DUP_MAX (0x7fff)
-
-#endif /* defined __USE_GNU_REGEX */
+#endif
/* POSIX 'cflags' bits (i.e., information for 'regcomp'). */
@@ -392,11 +375,11 @@ typedef enum
/* Error codes we've added. */
_REG_EEND, /* Premature end. */
- _REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
+ _REG_ESIZE, /* Too large (e.g., repeat count too large). */
_REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
} reg_errcode_t;
-#ifdef _XOPEN_SOURCE
+#if defined _XOPEN_SOURCE || defined __USE_XOPEN2K
# define REG_ENOSYS _REG_ENOSYS
#endif
#define REG_NOERROR _REG_NOERROR
@@ -417,62 +400,50 @@ typedef enum
#define REG_ESIZE _REG_ESIZE
#define REG_ERPAREN _REG_ERPAREN
-/* struct re_pattern_buffer normally uses member names like 'buffer'
- that POSIX does not allow. In POSIX mode these members have names
- with leading 're_' (e.g., 're_buffer'). */
-#ifdef __USE_GNU_REGEX
-# define _REG_RE_NAME(id) id
-# define _REG_RM_NAME(id) id
-#else
-# define _REG_RE_NAME(id) re_##id
-# define _REG_RM_NAME(id) rm_##id
+/* This data structure represents a compiled pattern. Before calling
+ the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
+ and 'translate' can be set. After the pattern has been compiled,
+ the fields 're_nsub', 'not_bol' and 'not_eol' are available. All
+ other fields are private to the regex routines. */
+
+#ifndef RE_TRANSLATE_TYPE
+# define __RE_TRANSLATE_TYPE unsigned char *
+# ifdef __USE_GNU
+# define RE_TRANSLATE_TYPE __RE_TRANSLATE_TYPE
+# endif
#endif
-/* The user can specify the type of the re_translate member by
- defining the macro RE_TRANSLATE_TYPE, which defaults to unsigned
- char *. This pollutes the POSIX name space, so in POSIX mode just
- use unsigned char *. */
-#ifdef __USE_GNU_REGEX
-# ifndef RE_TRANSLATE_TYPE
-# define RE_TRANSLATE_TYPE unsigned char *
-# endif
-# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE
+#ifdef __USE_GNU
+# define __REPB_PREFIX(name) name
#else
-# define REG_TRANSLATE_TYPE unsigned char *
+# define __REPB_PREFIX(name) __##name
#endif
-/* This data structure represents a compiled pattern. Before calling
- the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
- 'translate', and 'no_sub' can be set. After the pattern has been
- compiled, the 're_nsub' field is available. All other fields are
- private to the regex routines. */
-
struct re_pattern_buffer
{
- /* Space that holds the compiled pattern. It is declared as
- 'unsigned char *' because its elements are sometimes used as
- array indexes. */
- unsigned char *_REG_RE_NAME (buffer);
+ /* Space that holds the compiled pattern. The type
+ 'struct re_dfa_t' is private and is not declared here. */
+ struct re_dfa_t *__REPB_PREFIX(buffer);
/* Number of bytes to which 'buffer' points. */
- __re_long_size_t _REG_RE_NAME (allocated);
+ __re_long_size_t __REPB_PREFIX(allocated);
/* Number of bytes actually used in 'buffer'. */
- __re_long_size_t _REG_RE_NAME (used);
+ __re_long_size_t __REPB_PREFIX(used);
/* Syntax setting with which the pattern was compiled. */
- reg_syntax_t _REG_RE_NAME (syntax);
+ reg_syntax_t __REPB_PREFIX(syntax);
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
fastmap, if there is one, to skip over impossible starting points
for matches. */
- char *_REG_RE_NAME (fastmap);
+ char *__REPB_PREFIX(fastmap);
/* Either a translate table to apply to all characters before
comparing them, or zero for no translation. The translation is
applied to a pattern when it is compiled and to a string when it
is matched. */
- REG_TRANSLATE_TYPE _REG_RE_NAME (translate);
+ __RE_TRANSLATE_TYPE __REPB_PREFIX(translate);
/* Number of subexpressions found by the compiler. */
size_t re_nsub;
@@ -481,57 +452,70 @@ struct re_pattern_buffer
Well, in truth it's used only in 're_search_2', to see whether or
not we should use the fastmap, so we don't set this absolutely
perfectly; see 're_compile_fastmap' (the "duplicate" case). */
- unsigned int _REG_RE_NAME (can_be_null) : 1;
+ unsigned __REPB_PREFIX(can_be_null) : 1;
/* If REGS_UNALLOCATED, allocate space in the 'regs' structure
for 'max (RE_NREGS, re_nsub + 1)' groups.
If REGS_REALLOCATE, reallocate space if necessary.
If REGS_FIXED, use what's there. */
-#ifdef __USE_GNU_REGEX
+#ifdef __USE_GNU
# define REGS_UNALLOCATED 0
# define REGS_REALLOCATE 1
# define REGS_FIXED 2
#endif
- unsigned int _REG_RE_NAME (regs_allocated) : 2;
+ unsigned __REPB_PREFIX(regs_allocated) : 2;
/* Set to zero when 're_compile_pattern' compiles a pattern; set to
one by 're_compile_fastmap' if it updates the fastmap. */
- unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
+ unsigned __REPB_PREFIX(fastmap_accurate) : 1;
/* If set, 're_match_2' does not return information about
subexpressions. */
- unsigned int _REG_RE_NAME (no_sub) : 1;
+ unsigned __REPB_PREFIX(no_sub) : 1;
/* If set, a beginning-of-line anchor doesn't match at the beginning
of the string. */
- unsigned int _REG_RE_NAME (not_bol) : 1;
+ unsigned __REPB_PREFIX(not_bol) : 1;
/* Similarly for an end-of-line anchor. */
- unsigned int _REG_RE_NAME (not_eol) : 1;
+ unsigned __REPB_PREFIX(not_eol) : 1;
/* If true, an anchor at a newline matches. */
- unsigned int _REG_RE_NAME (newline_anchor) : 1;
-
-/* [[[end pattern_buffer]]] */
+ unsigned __REPB_PREFIX(newline_anchor) : 1;
};
typedef struct re_pattern_buffer regex_t;
+/* Type for byte offsets within the string. POSIX mandates this. */
+#ifdef _REGEX_LARGE_OFFSETS
+/* POSIX 1003.1-2008 requires that regoff_t be at least as wide as
+ ptrdiff_t and ssize_t. We don't know of any hosts where ptrdiff_t
+ is wider than ssize_t, so ssize_t is safe. */
+typedef ssize_t regoff_t;
+#else
+/* The traditional GNU regex implementation mishandles strings longer
+ than INT_MAX. */
+typedef int regoff_t;
+#endif
+
+
+#ifdef __USE_GNU
/* This is the structure we store register match data in. See
regex.texinfo for a full description of what registers match. */
struct re_registers
{
- __re_size_t _REG_RM_NAME (num_regs);
- regoff_t *_REG_RM_NAME (start);
- regoff_t *_REG_RM_NAME (end);
+ __re_size_t num_regs;
+ regoff_t *start;
+ regoff_t *end;
};
/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
're_match_2' returns information about at least this many registers
the first time a 'regs' structure is passed. */
-#if !defined RE_NREGS && defined __USE_GNU_REGEX
-# define RE_NREGS 30
+# ifndef RE_NREGS
+# define RE_NREGS 30
+# endif
#endif
@@ -546,13 +530,19 @@ typedef struct
/* Declarations for routines. */
+#ifdef __USE_GNU
/* Sets the current default syntax to SYNTAX, and return the old syntax.
You can also simply assign to the 're_syntax_options' variable. */
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
/* Compile the regular expression PATTERN, with length LENGTH
and syntax given by the global 're_syntax_options', into the buffer
- BUFFER. Return NULL if successful, and an error string if not. */
+ BUFFER. Return NULL if successful, and an error string if not.
+
+ To free the allocated storage, you must call 'regfree' on BUFFER.
+ Note that the translate table must either have been initialised by
+ 'regcomp', with a malloc'ed value, or set to NULL before calling
+ 'regfree'. */
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
struct re_pattern_buffer *__buffer);
@@ -609,14 +599,15 @@ extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
register data.
Unless this function is called, the first search or match using
- BUFFER will allocate its own register data, without freeing the old
- data. */
+ BUFFER will allocate its own register data, without
+ freeing the old data. */
extern void re_set_registers (struct re_pattern_buffer *__buffer,
struct re_registers *__regs,
__re_size_t __num_regs,
regoff_t *__starts, regoff_t *__ends);
+#endif /* Use GNU */
-#if defined _REGEX_RE_COMP || defined _LIBC
+#if defined _REGEX_RE_COMP || (defined _LIBC && defined __USE_BSD)
# ifndef _CRAY
/* 4.2 bsd compatibility. */
extern char *re_comp (const char *);
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index c029c23a9..71ee41e92 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -14,8 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
static void re_string_construct_common (const char *str, Idx len,
re_string_t *pstr,
@@ -134,9 +133,9 @@ re_string_realloc_buffers (re_string_t *pstr, Idx new_buf_len)
{
wint_t *new_wcs;
- /* Avoid overflow. */
- size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
- if (BE (SIZE_MAX / max_object_size < new_buf_len, 0))
+ /* Avoid overflow in realloc. */
+ const size_t max_object_size = MAX (sizeof (wint_t), sizeof (Idx));
+ if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_buf_len, 0))
return REG_ESPACE;
new_wcs = re_realloc (pstr->wcs, wint_t, new_buf_len);
@@ -236,13 +235,8 @@ build_wcs_buffer (re_string_t *pstr)
else
p = (const char *) pstr->raw_mbs + pstr->raw_mbs_idx + byte_idx;
mbclen = __mbrtowc (&wc, p, remain_len, &pstr->cur_state);
- if (BE (mbclen == (size_t) -2, 0))
- {
- /* The buffer doesn't have enough space, finish to build. */
- pstr->cur_state = prev_st;
- break;
- }
- else if (BE (mbclen == (size_t) -1 || mbclen == 0, 0))
+ if (BE (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len), 0))
{
/* We treat these cases as a singlebyte character. */
mbclen = 1;
@@ -251,6 +245,12 @@ build_wcs_buffer (re_string_t *pstr)
wc = pstr->trans[wc];
pstr->cur_state = prev_st;
}
+ else if (BE (mbclen == (size_t) -2, 0))
+ {
+ /* The buffer doesn't have enough space, finish to build. */
+ pstr->cur_state = prev_st;
+ break;
+ }
/* Write wide character and padding. */
pstr->wcs[byte_idx++] = wc;
@@ -333,9 +333,11 @@ build_wcs_upper_buffer (re_string_t *pstr)
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
- else if (mbclen == (size_t) -1 || mbclen == 0)
+ else if (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
- /* It is an invalid character or '\0'. Just use the byte. */
+ /* It is an invalid character, an incomplete character
+ at the end of the string, or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + byte_idx];
pstr->mbs[byte_idx] = ch;
/* And also cast it to wide char. */
@@ -448,7 +450,8 @@ build_wcs_upper_buffer (re_string_t *pstr)
for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;)
pstr->wcs[byte_idx++] = WEOF;
}
- else if (mbclen == (size_t) -1 || mbclen == 0)
+ else if (mbclen == (size_t) -1 || mbclen == 0
+ || (mbclen == (size_t) -2 && pstr->bufs_len >= pstr->len))
{
/* It is an invalid character or '\0'. Just use the byte. */
int ch = pstr->raw_mbs[pstr->raw_mbs_idx + src_idx];
@@ -495,8 +498,7 @@ re_string_skip_chars (re_string_t *pstr, Idx new_raw_idx, wint_t *last_wc)
rawbuf_idx < new_raw_idx;)
{
wchar_t wc2;
- Idx remain_len;
- remain_len = pstr->len - rawbuf_idx;
+ Idx remain_len = pstr->raw_len - rawbuf_idx;
prev_st = pstr->cur_state;
mbclen = __mbrtowc (&wc2, (const char *) pstr->raw_mbs + rawbuf_idx,
remain_len, &pstr->cur_state);
@@ -732,21 +734,21 @@ re_string_reconstruct (re_string_t *pstr, Idx idx, int eflags)
mbstate_t cur_state;
wchar_t wc2;
Idx mlen = raw + pstr->len - p;
+ unsigned char buf[6];
size_t mbclen;
-#if 0 /* dead code: buf is set but never used */
- unsigned char buf[6];
+ const unsigned char *pp = p;
if (BE (pstr->trans != NULL, 0))
{
int i = mlen < 6 ? mlen : 6;
while (--i >= 0)
buf[i] = pstr->trans[p[i]];
+ pp = buf;
}
-#endif
/* XXX Don't use mbrtowc, we know which conversion
to use (UTF-8 -> UCS4). */
memset (&cur_state, 0, sizeof (cur_state));
- mbclen = __mbrtowc (&wc2, (const char *) p, mlen,
+ mbclen = __mbrtowc (&wc2, (const char *) pp, mlen,
&cur_state);
if (raw + offset - p <= mbclen
&& mbclen < (size_t) -2)
@@ -868,7 +870,7 @@ re_string_peek_byte_case (const re_string_t *pstr, Idx idx)
}
static unsigned char
-internal_function __attribute ((pure))
+internal_function
re_string_fetch_byte_case (re_string_t *pstr)
{
if (BE (!pstr->mbs_allocated, 1))
@@ -1412,13 +1414,12 @@ re_dfa_add_node (re_dfa_t *dfa, re_token_t token)
Idx *new_nexts, *new_indices;
re_node_set *new_edests, *new_eclosures;
re_token_t *new_nodes;
- size_t max_object_size =
- MAX (sizeof (re_token_t),
- MAX (sizeof (re_node_set),
- sizeof (Idx)));
- /* Avoid overflows. */
- if (BE (SIZE_MAX / 2 / max_object_size < dfa->nodes_alloc, 0))
+ /* Avoid overflows in realloc. */
+ const size_t max_object_size = MAX (sizeof (re_token_t),
+ MAX (sizeof (re_node_set),
+ sizeof (Idx)));
+ if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < new_nodes_alloc, 0))
return REG_MISSING;
new_nodes = re_realloc (dfa->nodes, re_token_t, new_nodes_alloc);
@@ -1579,7 +1580,7 @@ register_state (const re_dfa_t *dfa, re_dfastate_t *newstate,
{
Idx elem = newstate->nodes.elems[i];
if (!IS_EPSILON_NODE (dfa->nodes[elem].type))
- if (BE (! re_node_set_insert_last (&newstate->non_eps_nodes, elem), 0))
+ if (! re_node_set_insert_last (&newstate->non_eps_nodes, elem))
return REG_ESPACE;
}
@@ -1614,7 +1615,7 @@ free_state (re_dfastate_t *state)
re_free (state);
}
-/* Create the new state which is independ of contexts.
+/* Create the new state which is independent of contexts.
Return the new state if succeeded, otherwise return NULL. */
static re_dfastate_t *
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 726119203..fd331b117 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -14,15 +14,13 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _REGEX_INTERNAL_H
#define _REGEX_INTERNAL_H 1
#include <assert.h>
#include <ctype.h>
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -32,13 +30,14 @@
# include "localcharset.h"
#endif
#include <locale.h>
-
#include <wchar.h>
#include <wctype.h>
+#include <stdbool.h>
#include <stdint.h>
#if defined _LIBC
# include <bits/libc-lock.h>
#else
+# define __libc_lock_define(CLASS,NAME)
# define __libc_lock_init(NAME) do { } while (0)
# define __libc_lock_lock(NAME) do { } while (0)
# define __libc_lock_unlock(NAME) do { } while (0)
@@ -76,11 +75,6 @@
# define gettext_noop(String) String
#endif
-/* For loser systems without the definition. */
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
-
#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
# define RE_ENABLE_I18N
#endif
@@ -111,8 +105,8 @@
# define __wctype wctype
# define __iswctype iswctype
# define __btowc btowc
-# define __wcrtomb wcrtomb
# define __mbrtowc mbrtowc
+# define __wcrtomb wcrtomb
# define __regfree regfree
# define attribute_hidden
#endif /* not _LIBC */
@@ -124,6 +118,11 @@
#endif
typedef __re_idx_t Idx;
+#ifdef _REGEX_LARGE_OFFSETS
+# define IDX_MAX (SIZE_MAX - 2)
+#else
+# define IDX_MAX INT_MAX
+#endif
/* Special return value for failure to match. */
#define REG_MISSING ((Idx) -1)
@@ -418,19 +417,21 @@ typedef struct re_dfa_t re_dfa_t;
# define internal_function
#endif
+#ifndef NOT_IN_libc
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
Idx new_buf_len)
internal_function;
-#ifdef RE_ENABLE_I18N
+# ifdef RE_ENABLE_I18N
static void build_wcs_buffer (re_string_t *pstr) internal_function;
static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
- internal_function;
-#endif /* RE_ENABLE_I18N */
+ internal_function;
+# endif /* RE_ENABLE_I18N */
static void build_upper_buffer (re_string_t *pstr) internal_function;
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
int eflags)
internal_function __attribute ((pure));
+#endif
#define re_string_peek_byte(pstr, offset) \
((pstr)->mbs[(pstr)->cur_idx + offset])
#define re_string_fetch_byte(pstr) \
@@ -468,6 +469,9 @@ static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
#ifndef MAX
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
+#ifndef MIN
+# define MIN(a,b) ((a) < (b) ? (a) : (b))
+#endif
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
@@ -692,9 +696,7 @@ struct re_dfa_t
#ifdef DEBUG
char* re_str;
#endif
-#ifdef _LIBC
__libc_lock_define (, lock)
-#endif
};
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
@@ -818,15 +820,15 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
return (wint_t) pstr->wcs[idx];
}
+# ifndef NOT_IN_libc
static int
internal_function __attribute ((pure))
re_string_elem_size_at (const re_string_t *pstr, Idx idx)
{
-# ifdef _LIBC
+# ifdef _LIBC
const unsigned char *p, *extra;
const int32_t *table, *indirect;
- int32_t tmp;
-# include <locale/weight.h>
+# include <locale/weight.h>
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
if (nrules != 0)
@@ -837,13 +839,14 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_INDIRECTMB);
p = pstr->mbs + idx;
- tmp = findidx (&p);
+ findidx (&p, pstr->len - idx);
return p - pstr->mbs - idx;
}
else
-# endif /* _LIBC */
+# endif /* _LIBC */
return 1;
}
+# endif
#endif /* RE_ENABLE_I18N */
#ifndef __GNUC_PREREQ
diff --git a/lib/regexec.c b/lib/regexec.c
index 7130f2a92..b2c174f05 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -14,8 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags,
Idx n) internal_function;
@@ -51,9 +50,8 @@ static regoff_t re_search_stub (struct re_pattern_buffer *bufp,
regoff_t range, Idx stop,
struct re_registers *regs,
bool ret_len) internal_function;
-static unsigned int re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
- Idx nregs, int regs_allocated)
- internal_function;
+static unsigned re_copy_regs (struct re_registers *regs, regmatch_t *pmatch,
+ Idx nregs, int regs_allocated) internal_function;
static reg_errcode_t prune_impossible_nodes (re_match_context_t *mctx)
internal_function;
static Idx check_matching (re_match_context_t *mctx, bool fl_longest_match,
@@ -230,7 +228,7 @@ regexec (preg, string, nmatch, pmatch, eflags)
reg_errcode_t err;
Idx start, length;
#ifdef _LIBC
- re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
+ re_dfa_t *dfa = preg->buffer;
#endif
if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND))
@@ -365,7 +363,6 @@ weak_alias (__re_search_2, re_search_2)
#endif
static regoff_t
-internal_function
re_search_2_stub (struct re_pattern_buffer *bufp,
const char *string1, Idx length1,
const char *string2, Idx length2,
@@ -413,7 +410,6 @@ re_search_2_stub (struct re_pattern_buffer *bufp,
otherwise the position of the match is returned. */
static regoff_t
-internal_function
re_search_stub (struct re_pattern_buffer *bufp,
const char *string, Idx length,
Idx start, regoff_t range, Idx stop, struct re_registers *regs,
@@ -425,7 +421,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
regoff_t rval;
int eflags = 0;
#ifdef _LIBC
- re_dfa_t *dfa = (re_dfa_t *) bufp->buffer;
+ re_dfa_t *dfa = bufp->buffer;
#endif
Idx last_start = start + range;
@@ -477,9 +473,9 @@ re_search_stub (struct re_pattern_buffer *bufp,
rval = 0;
- /* I hope we needn't fill ther regs with -1's when no match was found. */
+ /* I hope we needn't fill their regs with -1's when no match was found. */
if (result != REG_NOERROR)
- rval = -1;
+ rval = result == REG_NOMATCH ? -1 : -2;
else if (regs != NULL)
{
/* If caller wants register contents data back, copy them. */
@@ -505,8 +501,7 @@ re_search_stub (struct re_pattern_buffer *bufp,
return rval;
}
-static unsigned int
-internal_function
+static unsigned
re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, Idx nregs,
int regs_allocated)
{
@@ -636,7 +631,7 @@ re_exec (s)
(0 <= LAST_START && LAST_START <= LENGTH) */
static reg_errcode_t
-internal_function __attribute_warn_unused_result__
+__attribute_warn_unused_result__
re_search_internal (const regex_t *preg,
const char *string, Idx length,
Idx start, Idx last_start, Idx stop,
@@ -644,7 +639,7 @@ re_search_internal (const regex_t *preg,
int eflags)
{
reg_errcode_t err;
- const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
+ const re_dfa_t *dfa = preg->buffer;
Idx left_lim, right_lim;
int incr;
bool fl_longest_match;
@@ -719,7 +714,8 @@ re_search_internal (const regex_t *preg,
if (nmatch > 1 || dfa->has_mb_node)
{
/* Avoid overflow. */
- if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= mctx.input.bufs_len, 0))
+ if (BE ((MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *))
+ <= mctx.input.bufs_len), 0))
{
err = REG_ESPACE;
goto free_return;
@@ -921,7 +917,7 @@ re_search_internal (const regex_t *preg,
goto free_return;
}
- /* At last, add the offset to the each registers, since we slided
+ /* At last, add the offset to each register, since we slid
the buffers so that we could assume that the matching starts
from 0. */
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
@@ -971,7 +967,7 @@ re_search_internal (const regex_t *preg,
}
static reg_errcode_t
-internal_function __attribute_warn_unused_result__
+__attribute_warn_unused_result__
prune_impossible_nodes (re_match_context_t *mctx)
{
const re_dfa_t *const dfa = mctx->dfa;
@@ -987,7 +983,7 @@ prune_impossible_nodes (re_match_context_t *mctx)
halt_node = mctx->last_node;
/* Avoid overflow. */
- if (BE (SIZE_MAX / sizeof (re_dfastate_t *) <= match_last, 0))
+ if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) <= match_last, 0))
return REG_ESPACE;
sifted_states = re_malloc (re_dfastate_t *, match_last + 1);
@@ -1105,7 +1101,7 @@ acquire_init_state_context (reg_errcode_t *err, const re_match_context_t *mctx,
FL_LONGEST_MATCH means we want the POSIX longest matching.
If P_MATCH_FIRST is not NULL, and the match fails, it is set to the
next place where we may want to try matching.
- Note that the matcher assume that the maching starts from the current
+ Note that the matcher assumes that the matching starts from the current
index of the buffer. */
static Idx
@@ -1174,7 +1170,8 @@ check_matching (re_match_context_t *mctx, bool fl_longest_match,
re_dfastate_t *old_state = cur_state;
Idx next_char_idx = re_string_cur_idx (&mctx->input) + 1;
- if (BE (next_char_idx >= mctx->input.bufs_len, 0)
+ if ((BE (next_char_idx >= mctx->input.bufs_len, 0)
+ && mctx->input.bufs_len < mctx->input.len)
|| (BE (next_char_idx >= mctx->input.valid_len, 0)
&& mctx->input.valid_len < mctx->input.len))
{
@@ -1435,7 +1432,7 @@ internal_function __attribute_warn_unused_result__
set_regs (const regex_t *preg, const re_match_context_t *mctx, size_t nmatch,
regmatch_t *pmatch, bool fl_backtrack)
{
- const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer;
+ const re_dfa_t *dfa = preg->buffer;
Idx idx, cur_node;
re_node_set eps_via_nodes;
struct re_fail_stack_t *fs;
@@ -1752,7 +1749,8 @@ clean_state_log_if_needed (re_match_context_t *mctx, Idx next_state_log_idx)
{
Idx top = mctx->state_log_top;
- if (next_state_log_idx >= mctx->input.bufs_len
+ if ((next_state_log_idx >= mctx->input.bufs_len
+ && mctx->input.bufs_len < mctx->input.len)
|| (next_state_log_idx >= mctx->input.valid_len
&& mctx->input.valid_len < mctx->input.len))
{
@@ -2456,7 +2454,7 @@ find_recover_state (reg_errcode_t *err, re_match_context_t *mctx)
/* From the node set CUR_NODES, pick up the nodes whose types are
OP_OPEN_SUBEXP and which have corresponding back references in the regular
expression. And register them to use them later for evaluating the
- correspoding back references. */
+ corresponding back references. */
static reg_errcode_t
internal_function
@@ -2936,9 +2934,12 @@ check_arrival (re_match_context_t *mctx, state_array_t *path, Idx top_node,
{
re_dfastate_t **new_array;
Idx old_alloc = path->alloc;
- Idx new_alloc = old_alloc + last_str + mctx->max_mb_elem_len + 1;
- if (BE (new_alloc < old_alloc, 0)
- || BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0))
+ Idx incr_alloc = last_str + mctx->max_mb_elem_len + 1;
+ Idx new_alloc;
+ if (BE (IDX_MAX - old_alloc < incr_alloc, 0))
+ return REG_ESPACE;
+ new_alloc = old_alloc + incr_alloc;
+ if (BE (SIZE_MAX / sizeof (re_dfastate_t *) < new_alloc, 0))
return REG_ESPACE;
new_array = re_realloc (path->array, re_dfastate_t *, new_alloc);
if (BE (new_array == NULL, 0))
@@ -3387,7 +3388,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
dests_node = dests_alloc->dests_node;
dests_ch = dests_alloc->dests_ch;
- /* Initialize transiton table. */
+ /* Initialize transition table. */
state->word_trtable = state->trtable = NULL;
/* At first, group all nodes belonging to 'state' into several
@@ -3397,6 +3398,7 @@ build_trtable (const re_dfa_t *dfa, re_dfastate_t *state)
{
if (dests_node_malloced)
free (dests_alloc);
+ /* Return false in case of an error, true otherwise. */
if (ndests == 0)
{
state->trtable = (re_dfastate_t **)
@@ -3896,7 +3898,6 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
const int32_t *table, *indirect;
const unsigned char *weights, *extra;
const char *collseqwc;
- int32_t idx;
/* This #include defines a local function! */
# include <locale/weight.h>
@@ -3954,7 +3955,7 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx node_idx,
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
indirect = (const int32_t *)
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB);
- int32_t idx = findidx (&cp);
+ int32_t idx = findidx (&cp, elem_len);
if (idx > 0)
for (i = 0; i < cset->nequiv_classes; ++i)
{
@@ -4066,7 +4067,7 @@ find_collation_sequence_value (const unsigned char *mbs, size_t mbs_len)
/* Skip the collation sequence value. */
idx += sizeof (uint32_t);
/* Skip the wide char sequence of the collating element. */
- idx = idx + sizeof (uint32_t) * (extra[idx] + 1);
+ idx = idx + sizeof (uint32_t) * (*(int32_t *) (extra + idx) + 1);
/* If we found the entry, return the sequence value. */
if (found)
return *(uint32_t *) (extra + idx);
@@ -4140,11 +4141,12 @@ extend_buffers (re_match_context_t *mctx)
re_string_t *pstr = &mctx->input;
/* Avoid overflow. */
- if (BE (SIZE_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
+ if (BE (MIN (IDX_MAX, SIZE_MAX / sizeof (re_dfastate_t *)) / 2
+ <= pstr->bufs_len, 0))
return REG_ESPACE;
- /* Double the lengthes of the buffers. */
- ret = re_string_realloc_buffers (pstr, pstr->bufs_len * 2);
+ /* Double the lengths of the buffers. */
+ ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
if (BE (ret != REG_NOERROR, 0))
return ret;
@@ -4207,7 +4209,7 @@ match_ctx_init (re_match_context_t *mctx, int eflags, Idx n)
size_t max_object_size =
MAX (sizeof (struct re_backref_cache_entry),
sizeof (re_sub_match_top_t *));
- if (BE (SIZE_MAX / max_object_size < n, 0))
+ if (BE (MIN (IDX_MAX, SIZE_MAX / max_object_size) < n, 0))
return REG_ESPACE;
mctx->bkref_ents = re_malloc (struct re_backref_cache_entry, n);
diff --git a/lib/round.c b/lib/round.c
new file mode 100644
index 000000000..53dfe84ea
--- /dev/null
+++ b/lib/round.c
@@ -0,0 +1,174 @@
+/* Round toward nearest, breaking ties away from zero.
+ Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License along
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+/* Written by Ben Pfaff <blp@gnu.org>, 2007.
+ Based heavily on code by Bruno Haible. */
+
+#if ! defined USE_LONG_DOUBLE
+# include <config.h>
+#endif
+
+/* Specification. */
+#include <math.h>
+
+#include <float.h>
+
+#undef MIN
+
+#ifdef USE_LONG_DOUBLE
+# define ROUND roundl
+# define FLOOR floorl
+# define CEIL ceill
+# define DOUBLE long double
+# define MANT_DIG LDBL_MANT_DIG
+# define MIN LDBL_MIN
+# define L_(literal) literal##L
+# define HAVE_FLOOR_AND_CEIL HAVE_FLOORL_AND_CEILL
+#elif ! defined USE_FLOAT
+# define ROUND round
+# define FLOOR floor
+# define CEIL ceil
+# define DOUBLE double
+# define MANT_DIG DBL_MANT_DIG
+# define MIN DBL_MIN
+# define L_(literal) literal
+# define HAVE_FLOOR_AND_CEIL 1
+#else /* defined USE_FLOAT */
+# define ROUND roundf
+# define FLOOR floorf
+# define CEIL ceilf
+# define DOUBLE float
+# define MANT_DIG FLT_MANT_DIG
+# define MIN FLT_MIN
+# define L_(literal) literal##f
+# define HAVE_FLOOR_AND_CEIL HAVE_FLOORF_AND_CEILF
+#endif
+
+/* -0.0. See minus-zero.h. */
+#if defined __hpux || defined __sgi || defined __ICC
+# define MINUS_ZERO (-MIN * MIN)
+#else
+# define MINUS_ZERO L_(-0.0)
+#endif
+
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
+/* If we're being included from test-round2[f].c, it already defined names for
+ our round implementations. Otherwise, pick the preferred implementation for
+ this machine. */
+#if !defined FLOOR_BASED_ROUND && !defined FLOOR_FREE_ROUND
+# if HAVE_FLOOR_AND_CEIL
+# define FLOOR_BASED_ROUND ROUND
+# else
+# define FLOOR_FREE_ROUND ROUND
+# endif
+#endif
+
+#ifdef FLOOR_BASED_ROUND
+/* An implementation of the C99 round function based on floor and ceil. We use
+ this when floor and ceil are available, on the assumption that they are
+ faster than the open-coded versions below. */
+DOUBLE
+FLOOR_BASED_ROUND (DOUBLE x)
+{
+ if (x >= L_(0.0))
+ {
+ DOUBLE y = FLOOR (x);
+ if (x - y >= L_(0.5))
+ y += L_(1.0);
+ return y;
+ }
+ else
+ {
+ DOUBLE y = CEIL (x);
+ if (y - x >= L_(0.5))
+ y -= L_(1.0);
+ return y;
+ }
+}
+#endif /* FLOOR_BASED_ROUND */
+
+#ifdef FLOOR_FREE_ROUND
+/* An implementation of the C99 round function without floor or ceil.
+ We use this when floor or ceil is missing. */
+DOUBLE
+FLOOR_FREE_ROUND (DOUBLE x)
+{
+ /* 2^(MANT_DIG-1). */
+ static const DOUBLE TWO_MANT_DIG =
+ /* Assume MANT_DIG <= 5 * 31.
+ Use the identity
+ n = floor(n/5) + floor((n+1)/5) + ... + floor((n+4)/5). */
+ (DOUBLE) (1U << ((MANT_DIG - 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 1) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 2) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 3) / 5))
+ * (DOUBLE) (1U << ((MANT_DIG - 1 + 4) / 5));
+
+ /* The use of 'volatile' guarantees that excess precision bits are dropped at
+ each addition step and before the following comparison at the caller's
+ site. It is necessary on x86 systems where double-floats are not IEEE
+ compliant by default, to avoid that the results become platform and
+ compiler option dependent. 'volatile' is a portable alternative to gcc's
+ -ffloat-store option. */
+ volatile DOUBLE y = x;
+ volatile DOUBLE z = y;
+
+ if (z > L_(0.0))
+ {
+ /* Avoid rounding error for x = 0.5 - 2^(-MANT_DIG-1). */
+ if (z < L_(0.5))
+ z = L_(0.0);
+ /* Avoid rounding errors for values near 2^k, where k >= MANT_DIG-1. */
+ else if (z < TWO_MANT_DIG)
+ {
+ /* Add 0.5 to the absolute value. */
+ y = z += L_(0.5);
+ /* Round to the next integer (nearest or up or down, doesn't
+ matter). */
+ z += TWO_MANT_DIG;
+ z -= TWO_MANT_DIG;
+ /* Enforce rounding down. */
+ if (z > y)
+ z -= L_(1.0);
+ }
+ }
+ else if (z < L_(0.0))
+ {
+ /* Avoid rounding error for x = -(0.5 - 2^(-MANT_DIG-1)). */
+ if (z > - L_(0.5))
+ z = MINUS_ZERO;
+ /* Avoid rounding errors for values near -2^k, where k >= MANT_DIG-1. */
+ else if (z > -TWO_MANT_DIG)
+ {
+ /* Add 0.5 to the absolute value. */
+ y = z -= L_(0.5);
+ /* Round to the next integer (nearest or up or down, doesn't
+ matter). */
+ z -= TWO_MANT_DIG;
+ z += TWO_MANT_DIG;
+ /* Enforce rounding up. */
+ if (z < y)
+ z += L_(1.0);
+ }
+ }
+ return z;
+}
+#endif /* FLOOR_FREE_ROUND */
diff --git a/lib/safe-read.h b/lib/safe-read.h
index fccc20001..dc739229b 100644
--- a/lib/safe-read.h
+++ b/lib/safe-read.h
@@ -17,7 +17,7 @@
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
- types Ctrl-Z) on some platforms: MacOS X.
+ types Ctrl-Z) on some platforms: Mac OS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.
diff --git a/lib/safe-write.h b/lib/safe-write.h
index 84bc36d42..3a7f5091c 100644
--- a/lib/safe-write.h
+++ b/lib/safe-write.h
@@ -17,7 +17,7 @@
/* Some system calls may be interrupted and fail with errno = EINTR in the
following situations:
- The process is stopped and restarted (signal SIGSTOP and SIGCONT, user
- types Ctrl-Z) on some platforms: MacOS X.
+ types Ctrl-Z) on some platforms: Mac OS X.
- The process receives a signal for which a signal handler was installed
with sigaction() with an sa_flags field that does not contain
SA_RESTART.
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 2e195a0cd..627ae17af 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -55,7 +55,7 @@
#ifndef _@GUARD_PREFIX@_SIGNAL_H
#define _@GUARD_PREFIX@_SIGNAL_H
-/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
+/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
pthread_sigmask in <pthread.h>, not in <signal.h>.
But avoid namespace pollution on glibc systems.*/
#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
@@ -197,7 +197,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
/* Test whether a given signal is contained in a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X. */
+/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigismember
# endif
@@ -210,7 +210,7 @@ _GL_CXXALIASWARN (sigismember);
/* Initialize a signal set to the empty set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X. */
+/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigemptyset
# endif
@@ -222,7 +222,7 @@ _GL_CXXALIASWARN (sigemptyset);
/* Add a signal to a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X. */
+/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigaddset
# endif
@@ -235,7 +235,7 @@ _GL_CXXALIASWARN (sigaddset);
/* Remove a signal from a signal set. */
# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X. */
+/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigdelset
# endif
@@ -248,7 +248,7 @@ _GL_CXXALIASWARN (sigdelset);
/* Fill a signal set with all possible signals. */
# if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X. */
+/* This function is defined as a macro on Mac OS X. */
# if defined __cplusplus && defined GNULIB_NAMESPACE
# undef sigfillset
# endif
diff --git a/lib/size_max.h b/lib/size_max.h
index d470807d7..60d50f1d2 100644
--- a/lib/size_max.h
+++ b/lib/size_max.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef GNULIB_SIZE_MAX_H
#define GNULIB_SIZE_MAX_H
diff --git a/lib/snprintf.c b/lib/snprintf.c
index 731cc2f9c..eb27f5d0f 100644
--- a/lib/snprintf.c
+++ b/lib/snprintf.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
diff --git a/lib/stat.c b/lib/stat.c
index a18d5773d..f46e31d9b 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -27,6 +27,21 @@
#include <sys/stat.h>
#undef __need_system_sys_stat_h
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# if _GL_WINDOWS_64_BIT_ST_SIZE
+# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
+# define stat _stati64
+# define REPLACE_FUNC_STAT_DIR 1
+# undef REPLACE_FUNC_STAT_FILE
+# elif REPLACE_FUNC_STAT_FILE
+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
+ Bypass it. */
+# define stat _stat
+# define REPLACE_FUNC_STAT_DIR 1
+# undef REPLACE_FUNC_STAT_FILE
+# endif
+#endif
+
static inline int
orig_stat (const char *filename, struct stat *buf)
{
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index 41dd14328..e04387175 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert and Bruno Haible. */
diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h
index cbf3ea1b1..6ea7f7001 100644
--- a/lib/stdbool.in.h
+++ b/lib/stdbool.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _GL_STDBOOL_H
#define _GL_STDBOOL_H
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 4d5763733..e17ef24c2 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 691040162..3a73abff8 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/*
* ISO C 99 <stdint.h> for platforms that lack it.
@@ -34,6 +33,16 @@
<inttypes.h>. */
#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
+/* On Android (Bionic libc), <sys/types.h> includes this file before
+ having defined 'time_t'. Therefore in this case avoid including
+ other system header files; just include the system's <stdint.h>.
+ Ideally we should test __BIONIC__ here, but it is only defined after
+ <sys/cdefs.h> has been included; hence test __ANDROID__ instead. */
+#if defined __ANDROID__ \
+ && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#else
+
/* Get those types that are already defined in other system include
files, so that we can "#define int8_t signed char" below without
worrying about a later system include file containing a "typedef
@@ -74,14 +83,15 @@
/* <sys/types.h> defines some of the stdint.h types as well, on glibc,
IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
AIX 5.2 <sys/types.h> isn't needed and causes troubles.
- MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+ Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
relies on the system <stdint.h> definitions, so include
<sys/types.h> after @NEXT_STDINT_H@. */
#if @HAVE_SYS_TYPES_H@ && ! defined _AIX
# include <sys/types.h>
#endif
-/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */
+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
+ LONG_MIN, LONG_MAX, ULONG_MAX. */
#include <limits.h>
#if @HAVE_INTTYPES_H@
@@ -237,8 +247,9 @@ typedef unsigned long long int gl_uint64_t;
/* Here we assume a standard architecture where the hardware integer
types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
- are taken from the same list of types. Assume that 'long int'
- is fast enough for all narrower integers. */
+ are taken from the same list of types. The following code normally
+ uses types consistent with glibc, as that lessens the chance of
+ incompatibility with older GNU hosts. */
#undef int_fast8_t
#undef uint_fast8_t
@@ -248,12 +259,21 @@ typedef unsigned long long int gl_uint64_t;
#undef uint_fast32_t
#undef int_fast64_t
#undef uint_fast64_t
-typedef long int gl_int_fast8_t;
-typedef unsigned long int gl_uint_fast8_t;
-typedef long int gl_int_fast16_t;
-typedef unsigned long int gl_uint_fast16_t;
+typedef signed char gl_int_fast8_t;
+typedef unsigned char gl_uint_fast8_t;
+
+#ifdef __sun
+/* Define types compatible with SunOS 5.10, so that code compiled under
+ earlier SunOS versions works with code compiled under SunOS 5.10. */
+typedef int gl_int_fast32_t;
+typedef unsigned int gl_uint_fast32_t;
+#else
typedef long int gl_int_fast32_t;
typedef unsigned long int gl_uint_fast32_t;
+#endif
+typedef gl_int_fast32_t gl_int_fast16_t;
+typedef gl_uint_fast32_t gl_uint_fast16_t;
+
#define int_fast8_t gl_int_fast8_t
#define uint_fast8_t gl_uint_fast8_t
#define int_fast16_t gl_int_fast16_t
@@ -409,23 +429,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#undef INT_FAST8_MIN
#undef INT_FAST8_MAX
#undef UINT_FAST8_MAX
-#define INT_FAST8_MIN LONG_MIN
-#define INT_FAST8_MAX LONG_MAX
-#define UINT_FAST8_MAX ULONG_MAX
+#define INT_FAST8_MIN SCHAR_MIN
+#define INT_FAST8_MAX SCHAR_MAX
+#define UINT_FAST8_MAX UCHAR_MAX
#undef INT_FAST16_MIN
#undef INT_FAST16_MAX
#undef UINT_FAST16_MAX
-#define INT_FAST16_MIN LONG_MIN
-#define INT_FAST16_MAX LONG_MAX
-#define UINT_FAST16_MAX ULONG_MAX
+#define INT_FAST16_MIN INT_FAST32_MIN
+#define INT_FAST16_MAX INT_FAST32_MAX
+#define UINT_FAST16_MAX UINT_FAST32_MAX
#undef INT_FAST32_MIN
#undef INT_FAST32_MAX
#undef UINT_FAST32_MAX
-#define INT_FAST32_MIN LONG_MIN
-#define INT_FAST32_MAX LONG_MAX
-#define UINT_FAST32_MAX ULONG_MAX
+#ifdef __sun
+# define INT_FAST32_MIN INT_MIN
+# define INT_FAST32_MAX INT_MAX
+# define UINT_FAST32_MAX UINT_MAX
+#else
+# define INT_FAST32_MIN LONG_MIN
+# define INT_FAST32_MAX LONG_MAX
+# define UINT_FAST32_MAX ULONG_MAX
+#endif
#undef INT_FAST64_MIN
#undef INT_FAST64_MAX
@@ -606,4 +632,5 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
#endif
#endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !(defined __ANDROID__ && ...) */
#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 7e4d59359..f7e06ad87 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -53,7 +52,8 @@
#include <stddef.h>
/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8
- and eglibc 2.11.2. */
+ and eglibc 2.11.2.
+ May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* The __attribute__ feature is available in gcc versions 2.5 and later.
@@ -699,22 +699,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
# endif
#endif
-#if @GNULIB_GETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-# undef gets
-# define gets rpl_gets
-# endif
-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gets, char *, (char *s));
-# else
-_GL_CXXALIAS_SYS (gets, char *, (char *s));
-# undef gets
-# endif
-_GL_CXXALIASWARN (gets);
/* It is very rare that the developer ever has full control of stdin,
- so any use of gets warrants an unconditional warning. Assume it is
- always declared, since it is required by C89. */
+ so any use of gets warrants an unconditional warning; besides, C11
+ removed it. */
+#undef gets
+#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
@@ -779,7 +768,7 @@ _GL_CXXALIASWARN (pclose);
#elif defined GNULIB_POSIXCHECK
# undef pclose
# if HAVE_RAW_DECL_PCLOSE
-_GL_WARN_ON_USE (pclose, "popen is unportable - "
+_GL_WARN_ON_USE (pclose, "pclose is unportable - "
"use gnulib module pclose for more portability");
# endif
#endif
@@ -1054,9 +1043,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
# endif
#endif
-/* Some people would argue that sprintf should be handled like gets
- (for example, OpenBSD issues a link warning for both functions),
- since both can cause security holes due to buffer overruns.
+/* Some people would argue that all sprintf uses should be warned about
+ (for example, OpenBSD issues a link warning for it),
+ since it can cause security holes due to buffer overruns.
However, we believe that sprintf can be used safely, and is more
efficient than snprintf in those safe cases; and as proof of our
belief, we use sprintf in several gnulib modules. So this header
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index c90626a2b..72c9dd1ca 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -87,13 +87,21 @@ struct random_data
#endif
#if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp. */
-/* On MacOS X 10.5, only <unistd.h> declares mkstemps. */
+/* On Mac OS X 10.3, only <unistd.h> declares mkstemp. */
+/* On Mac OS X 10.5, only <unistd.h> declares mkstemps. */
/* On Cygwin 1.7.1, only <unistd.h> declares getsubopt. */
/* But avoid namespace pollution on glibc systems and native Windows. */
# include <unistd.h>
#endif
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
/* The definition of _Noreturn is copied here. */
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -138,7 +146,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
/* Parse a signed decimal integer.
Returns the value of the integer. Errors are not detected. */
# if !@HAVE_ATOLL@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (atoll, long long, (const char *string));
_GL_CXXALIASWARN (atoll);
diff --git a/lib/strcasecmp.c b/lib/strcasecmp.c
deleted file mode 100644
index 1ed517531..000000000
--- a/lib/strcasecmp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Case-insensitive string comparison function.
- Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-#include <ctype.h>
-#include <limits.h>
-
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
-
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
- greater than zero if S1 is lexicographically less than, equal to or greater
- than S2.
- Note: This function does not work with multibyte strings! */
-
-int
-strcasecmp (const char *s1, const char *s2)
-{
- const unsigned char *p1 = (const unsigned char *) s1;
- const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2)
- return 0;
-
- do
- {
- c1 = TOLOWER (*p1);
- c2 = TOLOWER (*p2);
-
- if (c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
diff --git a/lib/streq.h b/lib/streq.h
index b64941116..7fd07c810 100644
--- a/lib/streq.h
+++ b/lib/streq.h
@@ -21,8 +21,8 @@
#include <string.h>
-/* STREQ allows to optimize string comparison with a small literal string.
- STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
+/* STREQ_OPT allows to optimize string comparison with a small literal string.
+ STREQ_OPT (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
is semantically equivalent to
strcmp (s, "EUC-KR") == 0
just faster. */
@@ -163,12 +163,12 @@ streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23,
return 0;
}
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
#else
-#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
+#define STREQ_OPT(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
(strcmp (s1, s2) == 0)
#endif
diff --git a/lib/strftime.c b/lib/strftime.c
index 7743f5256..f5fc3c997 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -40,7 +40,7 @@
extern char *tzname[];
#endif
-/* Do multibyte processing if multibytes are supported, unless
+/* Do multibyte processing if multibyte encodings are supported, unless
multibyte sequences are safe in formats. Multibyte sequences are
safe if they cannot contain byte sequences that look like format
conversion specifications. The multibyte encodings used by the
diff --git a/lib/string.in.h b/lib/string.in.h
index ab9cd1946..0c2352673 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _@GUARD_PREFIX@_STRING_H
@@ -725,10 +724,14 @@ _GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - "
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# define mbslen rpl_mbslen
# endif
-_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string)
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string));
# else
-_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string)
+ _GL_ATTRIBUTE_PURE
+ _GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string));
# endif
_GL_CXXALIASWARN (mbslen);
@@ -738,6 +741,7 @@ _GL_CXXALIASWARN (mbslen);
/* Return the number of multibyte characters in the character string starting
at STRING and ending at STRING + LEN. */
_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1));
#endif
@@ -751,10 +755,12 @@ _GL_EXTERN_C size_t mbsnlen (const char *string, size_t len)
# define mbschr rpl_mbschr /* avoid collision with HP-UX function */
# endif
_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c));
# else
_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c));
# endif
@@ -771,10 +777,12 @@ _GL_CXXALIASWARN (mbschr);
# define mbsrchr rpl_mbsrchr /* avoid collision with system function */
# endif
_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c));
# else
_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c));
# endif
@@ -787,6 +795,7 @@ _GL_CXXALIASWARN (mbsrchr);
Unlike strstr(), this function works correctly in multibyte locales with
encodings different from UTF-8. */
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -798,6 +807,7 @@ _GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
different lengths!
Unlike strcasecmp(), this function works correctly in multibyte locales. */
_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -812,6 +822,7 @@ _GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2)
Unlike strncasecmp(), this function works correctly in multibyte locales.
But beware that N is not a byte count but a character count! */
_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -825,6 +836,7 @@ _GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n)
Unlike strncasecmp(), this function works correctly in multibyte
locales. */
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -835,6 +847,7 @@ _GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
strlen (haystack) < strlen (needle) !
Unlike strcasestr(), this function works correctly in multibyte locales. */
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -845,6 +858,7 @@ _GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
if none exists.
Unlike strcspn(), this function works correctly in multibyte locales. */
_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -858,10 +872,12 @@ _GL_EXTERN_C size_t mbscspn (const char *string, const char *accept)
# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */
# endif
_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept));
# else
_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept));
# endif
@@ -875,6 +891,7 @@ _GL_CXXALIASWARN (mbspbrk);
if none exists.
Unlike strspn(), this function works correctly in multibyte locales. */
_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
#endif
@@ -994,6 +1011,7 @@ _GL_WARN_ON_USE (strsignal, "strsignal is unportable - "
#if @GNULIB_STRVERSCMP@
# if !@HAVE_STRVERSCMP@
_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *)
+ _GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2)));
# endif
_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *));
diff --git a/lib/strings.in.h b/lib/strings.in.h
deleted file mode 100644
index fc60919b7..000000000
--- a/lib/strings.in.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* A substitute <strings.h>.
-
- Copyright (C) 2007-2012 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef _@GUARD_PREFIX@_STRINGS_H
-
-#if __GNUC__ >= 3
-@PRAGMA_SYSTEM_HEADER@
-#endif
-@PRAGMA_COLUMNS@
-
-/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
- But avoid namespace pollution on glibc systems. */
-#if defined __minix && !defined __GLIBC__
-# include <sys/types.h>
-#endif
-
-/* The include_next requires a split double-inclusion guard. */
-#if @HAVE_STRINGS_H@
-# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
-#endif
-
-#ifndef _@GUARD_PREFIX@_STRINGS_H
-#define _@GUARD_PREFIX@_STRINGS_H
-
-#if ! @HAVE_DECL_STRNCASECMP@
-/* Get size_t. */
-# include <stddef.h>
-#endif
-
-
-/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
-
-/* The definition of _GL_ARG_NONNULL is copied here. */
-
-/* The definition of _GL_WARN_ON_USE is copied here. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
- /* Find the index of the least-significant set bit. */
-#if @GNULIB_FFS@
-# if !@HAVE_FFS@
-_GL_FUNCDECL_SYS (ffs, int, (int i));
-# endif
-_GL_CXXALIAS_SYS (ffs, int, (int i));
-_GL_CXXALIASWARN (ffs);
-#elif defined GNULIB_POSIXCHECK
-# undef ffs
-# if HAVE_RAW_DECL_FFS
-_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
-# endif
-#endif
-
-/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
- greater than zero if S1 is lexicographically less than, equal to or greater
- than S2.
- Note: This function does not work in multibyte locales. */
-#if ! @HAVE_STRCASECMP@
-extern int strcasecmp (char const *s1, char const *s2)
- _GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strcasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strcasecmp
-# if HAVE_RAW_DECL_STRCASECMP
-_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
- "strings in multibyte locales - "
- "use mbscasecmp if you care about "
- "internationalization, or use c_strcasecmp , "
- "gnulib module c-strcase) if you want a locale "
- "independent function");
-# endif
-#endif
-
-/* Compare no more than N bytes of strings S1 and S2, ignoring case,
- returning less than, equal to or greater than zero if S1 is
- lexicographically less than, equal to or greater than S2.
- Note: This function cannot work correctly in multibyte locales. */
-#if ! @HAVE_DECL_STRNCASECMP@
-extern int strncasecmp (char const *s1, char const *s2, size_t n)
- _GL_ARG_NONNULL ((1, 2));
-#endif
-#if defined GNULIB_POSIXCHECK
-/* strncasecmp() does not work with multibyte strings:
- POSIX says that it operates on "strings", and "string" in POSIX is defined
- as a sequence of bytes, not of characters. */
-# undef strncasecmp
-# if HAVE_RAW_DECL_STRNCASECMP
-_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
- "strings in multibyte locales - "
- "use mbsncasecmp or mbspcasecmp if you care about "
- "internationalization, or use c_strncasecmp , "
- "gnulib module c-strcase) if you want a locale "
- "independent function");
-# endif
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _@GUARD_PREFIX@_STRING_H */
-#endif /* _@GUARD_PREFIX@_STRING_H */
diff --git a/lib/strncasecmp.c b/lib/strncasecmp.c
deleted file mode 100644
index d330ff678..000000000
--- a/lib/strncasecmp.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* strncasecmp.c -- case insensitive string comparator
- Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <config.h>
-
-/* Specification. */
-#include <string.h>
-
-#include <ctype.h>
-#include <limits.h>
-
-#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
-
-/* Compare no more than N bytes of strings S1 and S2, ignoring case,
- returning less than, equal to or greater than zero if S1 is
- lexicographically less than, equal to or greater than S2.
- Note: This function cannot work correctly in multibyte locales. */
-
-int
-strncasecmp (const char *s1, const char *s2, size_t n)
-{
- register const unsigned char *p1 = (const unsigned char *) s1;
- register const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
-
- if (p1 == p2 || n == 0)
- return 0;
-
- do
- {
- c1 = TOLOWER (*p1);
- c2 = TOLOWER (*p2);
-
- if (--n == 0 || c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- if (UCHAR_MAX <= INT_MAX)
- return c1 - c2;
- else
- /* On machines where 'char' and 'int' are types of the same size, the
- difference of two 'unsigned char' values - including the sign bit -
- doesn't fit in an 'int'. */
- return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
-}
diff --git a/lib/sys_file.in.h b/lib/sys_file.in.h
index bbc551a82..476f2f616 100644
--- a/lib/sys_file.in.h
+++ b/lib/sys_file.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Richard W.M. Jones. */
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index e238a7666..a0bcffb5f 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -14,8 +14,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file is supposed to be used on platforms that lack <sys/socket.h>,
on platforms where <sys/socket.h> cannot be included standalone, and on
@@ -143,7 +142,7 @@ struct sockaddr_storage
that you can influence which definitions you get by setting the
WINVER symbol before including these two files. For example,
getaddrinfo is only available if _WIN32_WINNT >= 0x0501 (that
- symbol is set indiriectly through WINVER). You can set this by
+ symbol is set indirectly through WINVER). You can set this by
adding AC_DEFINE(WINVER, 0x0501) to configure.ac. Note that your
code may not run on older Windows releases then. My Windows 2000
box was not able to run the code, for example. The situation is
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 7d24a3f4c..97fb3c4ce 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */
@@ -36,7 +35,8 @@
#ifndef _@GUARD_PREFIX@_SYS_STAT_H
-/* Get nlink_t. */
+/* Get nlink_t.
+ May also define off_t to a 64-bit type on native Windows. */
#include <sys/types.h>
/* Get struct timespec. */
@@ -67,6 +67,11 @@
# include <io.h>
#endif
+/* Large File Support on native Windows. */
+#if @WINDOWS_64_BIT_ST_SIZE@
+# define stat _stati64
+#endif
+
#ifndef S_IFIFO
# ifdef _S_IFIFO
# define S_IFIFO _S_IFIFO
@@ -336,6 +341,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
# endif
_GL_CXXALIASWARN (fstat);
+#elif @WINDOWS_64_BIT_ST_SIZE@
+/* Above, we define stat to _stati64. */
+# define fstat _fstati64
#elif defined GNULIB_POSIXCHECK
# undef fstat
# if HAVE_RAW_DECL_FSTAT
@@ -616,14 +624,55 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
/* We can't use the object-like #define stat rpl_stat, because of
struct stat. This means that rpl_stat will not be used if the user
does (stat)(a,b). Oh well. */
-# undef stat
-# ifdef _LARGE_FILES
+# if defined _AIX && defined stat && defined _LARGE_FILES
/* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
so we have to replace stat64() instead of stat(). */
-# define stat stat64
# undef stat64
# define stat64(name, st) rpl_stat (name, st)
-# else /* !_LARGE_FILES */
+# elif @WINDOWS_64_BIT_ST_SIZE@
+ /* Above, we define stat to _stati64. */
+# if defined __MINGW32__ && defined _stati64
+# ifndef _USE_32BIT_TIME_T
+ /* The system headers define _stati64 to _stat64. */
+# undef _stat64
+# define _stat64(name, st) rpl_stat (name, st)
+# endif
+# elif defined _MSC_VER && defined _stati64
+# ifdef _USE_32BIT_TIME_T
+ /* The system headers define _stati64 to _stat32i64. */
+# undef _stat32i64
+# define _stat32i64(name, st) rpl_stat (name, st)
+# else
+ /* The system headers define _stati64 to _stat64. */
+# undef _stat64
+# define _stat64(name, st) rpl_stat (name, st)
+# endif
+# else
+# undef _stati64
+# define _stati64(name, st) rpl_stat (name, st)
+# endif
+# elif defined __MINGW32__ && defined stat
+# ifdef _USE_32BIT_TIME_T
+ /* The system headers define stat to _stat32i64. */
+# undef _stat32i64
+# define _stat32i64(name, st) rpl_stat (name, st)
+# else
+ /* The system headers define stat to _stat64. */
+# undef _stat64
+# define _stat64(name, st) rpl_stat (name, st)
+# endif
+# elif defined _MSC_VER && defined stat
+# ifdef _USE_32BIT_TIME_T
+ /* The system headers define stat to _stat32. */
+# undef _stat32
+# define _stat32(name, st) rpl_stat (name, st)
+# else
+ /* The system headers define stat to _stat64i32. */
+# undef _stat64i32
+# define _stat64i32(name, st) rpl_stat (name, st)
+# endif
+# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
+# undef stat
# define stat(name, st) rpl_stat (name, st)
# endif /* !_LARGE_FILES */
_GL_EXTERN_C int stat (const char *name, struct stat *buf)
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index d1f9541aa..3dbbf91e5 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
@@ -40,9 +39,11 @@
# include <time.h>
# endif
-/* On native Windows with MSVC:
- Get the 'struct timeval' type. */
-# if defined _MSC_VER && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
+/* On native Windows with MSVC, get the 'struct timeval' type.
+ Also, on native Windows with a 64-bit time_t, where we are overriding the
+ 'struct timeval' type, get all declarations of system functions whose
+ signature contains 'struct timeval'. */
+# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
# define _GL_INCLUDING_WINSOCK2_H
# include <winsock2.h>
# undef _GL_INCLUDING_WINSOCK2_H
@@ -58,7 +59,11 @@
extern "C" {
# endif
-# if ! @HAVE_STRUCT_TIMEVAL@
+# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
+
+# if @REPLACE_STRUCT_TIMEVAL@
+# define timeval rpl_timeval
+# endif
# if !GNULIB_defined_struct_timeval
struct timeval
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 615993ac5..6eedaeb41 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -29,6 +28,18 @@
#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
#define _@GUARD_PREFIX@_SYS_TYPES_H
+/* Override off_t if Large File Support is requested on native Windows. */
+#if @WINDOWS_64_BIT_OFF_T@
+/* Same as int64_t in <stdint.h>. */
+# if defined _MSC_VER
+# define off_t __int64
+# else
+# define off_t long long int
+# endif
+/* Indicator, for gnulib internal purposes. */
+# define _GL_WINDOWS_64_BIT_OFF_T 1
+#endif
+
/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>. */
/* But avoid namespace pollution on glibc systems. */
#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
diff --git a/lib/sys_uio.in.h b/lib/sys_uio.in.h
index 0abc597d1..73c34be96 100644
--- a/lib/sys_uio.in.h
+++ b/lib/sys_uio.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
# if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/time.in.h b/lib/time.in.h
index 448466c22..11c6ca1b9 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
diff --git a/lib/time_r.c b/lib/time_r.c
index b25f6a66f..267c18d70 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Paul Eggert. */
diff --git a/lib/trunc.c b/lib/trunc.c
index 76627fbb9..3b86ef014 100644
--- a/lib/trunc.c
+++ b/lib/trunc.c
@@ -54,6 +54,12 @@
# define MINUS_ZERO L_(-0.0)
#endif
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+ contain floating-point operations. Pacify this compiler. */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
/* 2^(MANT_DIG-1). */
static const DOUBLE TWO_MANT_DIG =
/* Assume MANT_DIG <= 5 * 31.
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index e6e65cb26..e96a39c26 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
@@ -108,8 +107,9 @@
# include <netdb.h>
#endif
-/* MSVC defines off_t in <sys/types.h>. */
-#if !@HAVE_UNISTD_H@
+/* MSVC defines off_t in <sys/types.h>.
+ May also define off_t to a 64-bit type on native Windows. */
+#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
/* Get off_t. */
# include <sys/types.h>
#endif
@@ -563,10 +563,19 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
Return 0 if successful, otherwise -1 and errno set.
See the POSIX:2008 specification
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>. */
-# if !@HAVE_FTRUNCATE@
+# if @REPLACE_FTRUNCATE@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ftruncate
+# define ftruncate rpl_ftruncate
+# endif
+_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
+# else
+# if !@HAVE_FTRUNCATE@
_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
-# endif
+# endif
_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+# endif
_GL_CXXALIASWARN (ftruncate);
#elif defined GNULIB_POSIXCHECK
# undef ftruncate
@@ -1309,7 +1318,7 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
_GL_ARG_NONNULL ((1)));
# endif
-/* Need to cast, because on Solaris 11 2011-10, MacOS X 10.5, IRIX 6.5
+/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
and FreeBSD 6.4 the second parameter is int. On Solaris 11
2011-10, the first parameter is not const. */
_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index 83aeeee68..27067898e 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -66,17 +66,20 @@ extern "C" {
/* Check whether an UTF-8 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint8_t *
- u8_check (const uint8_t *s, size_t n);
+ u8_check (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Check whether an UTF-16 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint16_t *
- u16_check (const uint16_t *s, size_t n);
+ u16_check (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Check whether an UCS-4 string is well-formed.
Return NULL if valid, or a pointer to the first invalid unit otherwise. */
extern const uint32_t *
- u32_check (const uint32_t *s, size_t n);
+ u32_check (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Elementary string conversions. */
@@ -119,11 +122,14 @@ extern uint16_t *
failure. */
/* Similar to mblen(), except that s must not be NULL. */
extern int
- u8_mblen (const uint8_t *s, size_t n);
+ u8_mblen (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_mblen (const uint16_t *s, size_t n);
+ u16_mblen (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_mblen (const uint32_t *s, size_t n);
+ u32_mblen (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd,
@@ -400,38 +406,50 @@ extern uint32_t *
/* Compare S1 and S2, each of length N. */
/* Similar to memcmp(). */
extern int
- u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n);
+ u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n);
+ u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n);
+ u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Compare S1 and S2. */
/* Similar to the gnulib function memcmp2(). */
extern int
- u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2);
+ u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2);
+ u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2);
+ u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2)
+ _UC_ATTRIBUTE_PURE;
/* Search the string at S for UC. */
/* Similar to memchr(). */
extern uint8_t *
- u8_chr (const uint8_t *s, size_t n, ucs4_t uc);
+ u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_chr (const uint16_t *s, size_t n, ucs4_t uc);
+ u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_chr (const uint32_t *s, size_t n, ucs4_t uc);
+ u32_chr (const uint32_t *s, size_t n, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* Count the number of Unicode characters in the N units from S. */
/* Similar to mbsnlen(). */
extern size_t
- u8_mbsnlen (const uint8_t *s, size_t n);
+ u8_mbsnlen (const uint8_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_mbsnlen (const uint16_t *s, size_t n);
+ u16_mbsnlen (const uint16_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_mbsnlen (const uint32_t *s, size_t n);
+ u32_mbsnlen (const uint32_t *s, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Elementary string functions with memory allocation. */
@@ -448,11 +466,14 @@ extern uint32_t *
/* Return the length (number of units) of the first character in S.
Return 0 if it is the NUL character. Return -1 upon failure. */
extern int
- u8_strmblen (const uint8_t *s);
+ u8_strmblen (const uint8_t *s)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_strmblen (const uint16_t *s);
+ u16_strmblen (const uint16_t *s)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_strmblen (const uint32_t *s);
+ u32_strmblen (const uint32_t *s)
+ _UC_ATTRIBUTE_PURE;
/* Return the length (number of units) of the first character in S, putting
its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL
@@ -487,20 +508,26 @@ extern const uint32_t *
/* Return the number of units in S. */
/* Similar to strlen(), wcslen(). */
extern size_t
- u8_strlen (const uint8_t *s);
+ u8_strlen (const uint8_t *s)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strlen (const uint16_t *s);
+ u16_strlen (const uint16_t *s)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strlen (const uint32_t *s);
+ u32_strlen (const uint32_t *s)
+ _UC_ATTRIBUTE_PURE;
/* Return the number of units in S, but at most MAXLEN. */
/* Similar to strnlen(), wcsnlen(). */
extern size_t
- u8_strnlen (const uint8_t *s, size_t maxlen);
+ u8_strnlen (const uint8_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strnlen (const uint16_t *s, size_t maxlen);
+ u16_strnlen (const uint16_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strnlen (const uint32_t *s, size_t maxlen);
+ u32_strnlen (const uint32_t *s, size_t maxlen)
+ _UC_ATTRIBUTE_PURE;
/* Copy SRC to DEST. */
/* Similar to strcpy(), wcscpy(). */
@@ -562,16 +589,20 @@ extern uint32_t *
#ifdef __sun
/* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */
extern int
- u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2);
+ u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2)
+ _UC_ATTRIBUTE_PURE;
# define u8_strcmp u8_strcmp_gnu
#else
extern int
- u8_strcmp (const uint8_t *s1, const uint8_t *s2);
+ u8_strcmp (const uint8_t *s1, const uint8_t *s2)
+ _UC_ATTRIBUTE_PURE;
#endif
extern int
- u16_strcmp (const uint16_t *s1, const uint16_t *s2);
+ u16_strcmp (const uint16_t *s1, const uint16_t *s2)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_strcmp (const uint32_t *s1, const uint32_t *s2);
+ u32_strcmp (const uint32_t *s1, const uint32_t *s2)
+ _UC_ATTRIBUTE_PURE;
/* Compare S1 and S2 using the collation rules of the current locale.
Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2.
@@ -587,11 +618,14 @@ extern int
/* Compare no more than N units of S1 and S2. */
/* Similar to strncmp(), wcsncmp(). */
extern int
- u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n);
+ u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n);
+ u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
extern int
- u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n);
+ u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
+ _UC_ATTRIBUTE_PURE;
/* Duplicate S, returning an identical malloc'd string. */
/* Similar to strdup(), wcsdup(). */
@@ -605,74 +639,98 @@ extern uint32_t *
/* Find the first occurrence of UC in STR. */
/* Similar to strchr(), wcschr(). */
extern uint8_t *
- u8_strchr (const uint8_t *str, ucs4_t uc);
+ u8_strchr (const uint8_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strchr (const uint16_t *str, ucs4_t uc);
+ u16_strchr (const uint16_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strchr (const uint32_t *str, ucs4_t uc);
+ u32_strchr (const uint32_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* Find the last occurrence of UC in STR. */
/* Similar to strrchr(), wcsrchr(). */
extern uint8_t *
- u8_strrchr (const uint8_t *str, ucs4_t uc);
+ u8_strrchr (const uint8_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strrchr (const uint16_t *str, ucs4_t uc);
+ u16_strrchr (const uint16_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strrchr (const uint32_t *str, ucs4_t uc);
+ u32_strrchr (const uint32_t *str, ucs4_t uc)
+ _UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters not in REJECT. */
/* Similar to strcspn(), wcscspn(). */
extern size_t
- u8_strcspn (const uint8_t *str, const uint8_t *reject);
+ u8_strcspn (const uint8_t *str, const uint8_t *reject)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strcspn (const uint16_t *str, const uint16_t *reject);
+ u16_strcspn (const uint16_t *str, const uint16_t *reject)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strcspn (const uint32_t *str, const uint32_t *reject);
+ u32_strcspn (const uint32_t *str, const uint32_t *reject)
+ _UC_ATTRIBUTE_PURE;
/* Return the length of the initial segment of STR which consists entirely
of Unicode characters in ACCEPT. */
/* Similar to strspn(), wcsspn(). */
extern size_t
- u8_strspn (const uint8_t *str, const uint8_t *accept);
+ u8_strspn (const uint8_t *str, const uint8_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u16_strspn (const uint16_t *str, const uint16_t *accept);
+ u16_strspn (const uint16_t *str, const uint16_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern size_t
- u32_strspn (const uint32_t *str, const uint32_t *accept);
+ u32_strspn (const uint32_t *str, const uint32_t *accept)
+ _UC_ATTRIBUTE_PURE;
/* Find the first occurrence in STR of any character in ACCEPT. */
/* Similar to strpbrk(), wcspbrk(). */
extern uint8_t *
- u8_strpbrk (const uint8_t *str, const uint8_t *accept);
+ u8_strpbrk (const uint8_t *str, const uint8_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strpbrk (const uint16_t *str, const uint16_t *accept);
+ u16_strpbrk (const uint16_t *str, const uint16_t *accept)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strpbrk (const uint32_t *str, const uint32_t *accept);
+ u32_strpbrk (const uint32_t *str, const uint32_t *accept)
+ _UC_ATTRIBUTE_PURE;
/* Find the first occurrence of NEEDLE in HAYSTACK. */
/* Similar to strstr(), wcsstr(). */
extern uint8_t *
- u8_strstr (const uint8_t *haystack, const uint8_t *needle);
+ u8_strstr (const uint8_t *haystack, const uint8_t *needle)
+ _UC_ATTRIBUTE_PURE;
extern uint16_t *
- u16_strstr (const uint16_t *haystack, const uint16_t *needle);
+ u16_strstr (const uint16_t *haystack, const uint16_t *needle)
+ _UC_ATTRIBUTE_PURE;
extern uint32_t *
- u32_strstr (const uint32_t *haystack, const uint32_t *needle);
+ u32_strstr (const uint32_t *haystack, const uint32_t *needle)
+ _UC_ATTRIBUTE_PURE;
/* Test whether STR starts with PREFIX. */
extern bool
- u8_startswith (const uint8_t *str, const uint8_t *prefix);
+ u8_startswith (const uint8_t *str, const uint8_t *prefix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u16_startswith (const uint16_t *str, const uint16_t *prefix);
+ u16_startswith (const uint16_t *str, const uint16_t *prefix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u32_startswith (const uint32_t *str, const uint32_t *prefix);
+ u32_startswith (const uint32_t *str, const uint32_t *prefix)
+ _UC_ATTRIBUTE_PURE;
/* Test whether STR ends with SUFFIX. */
extern bool
- u8_endswith (const uint8_t *str, const uint8_t *suffix);
+ u8_endswith (const uint8_t *str, const uint8_t *suffix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u16_endswith (const uint16_t *str, const uint16_t *suffix);
+ u16_endswith (const uint16_t *str, const uint16_t *suffix)
+ _UC_ATTRIBUTE_PURE;
extern bool
- u32_endswith (const uint32_t *str, const uint32_t *suffix);
+ u32_endswith (const uint32_t *str, const uint32_t *suffix)
+ _UC_ATTRIBUTE_PURE;
/* Divide STR into tokens separated by characters in DELIM.
This interface is actually more similar to wcstok than to strtok. */
diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h
index c1204e13a..c58858946 100644
--- a/lib/unitypes.in.h
+++ b/lib/unitypes.in.h
@@ -1,4 +1,4 @@
-/* Elementary types for the GNU UniString library.
+/* Elementary types and macros for the GNU UniString library.
Copyright (C) 2002, 2005-2006, 2009-2012 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify it
@@ -23,4 +23,24 @@
/* Type representing a Unicode character. */
typedef uint32_t ucs4_t;
+/* Attribute of a function whose result depends only on the arguments
+ (not pointers!) and which has no side effects. */
+#ifndef _UC_ATTRIBUTE_CONST
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define _UC_ATTRIBUTE_CONST __attribute__ ((__const__))
+# else
+# define _UC_ATTRIBUTE_CONST
+# endif
+#endif
+
+/* Attribute of a function whose result depends only on the arguments
+ (possibly pointers) and global memory, and which has no side effects. */
+#ifndef _UC_ATTRIBUTE_PURE
+# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define _UC_ATTRIBUTE_PURE
+# endif
+#endif
+
#endif /* _UNITYPES_H */
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 3a94d2f5c..1da25f5f1 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
VASNPRINTF The name of the function being defined.
@@ -276,7 +275,7 @@ decimal_point_char (void)
{
const char *point;
/* Determine it in a multithread-safe way. We know nl_langinfo is
- multithread-safe on glibc systems and MacOS X systems, but is not required
+ multithread-safe on glibc systems and Mac OS X systems, but is not required
to be multithread-safe by POSIX. sprintf(), however, is multithread-safe.
localeconv() is rarely multithread-safe. */
# if HAVE_NL_LANGINFO && (__GLIBC__ || defined __UCLIBC__ || (defined __APPLE__ && defined __MACH__))
@@ -2814,7 +2813,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
if (has_width)
{
# if ENABLE_UNISTDIO
- /* Outside POSIX, it's preferrable to compare the width
+ /* Outside POSIX, it's preferable to compare the width
against the number of _characters_ of the converted
value. */
w = DCHAR_MBSNLEN (result + length, characters);
@@ -5417,7 +5416,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *lengthp,
{
size_t w;
# if ENABLE_UNISTDIO
- /* Outside POSIX, it's preferrable to compare the width
+ /* Outside POSIX, it's preferable to compare the width
against the number of _characters_ of the converted
value. */
w = DCHAR_MBSNLEN (result + length, count);
diff --git a/lib/vasnprintf.h b/lib/vasnprintf.h
index dac6f50f6..277f2707d 100644
--- a/lib/vasnprintf.h
+++ b/lib/vasnprintf.h
@@ -12,8 +12,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _VASNPRINTF_H
#define _VASNPRINTF_H
diff --git a/lib/vsnprintf.c b/lib/vsnprintf.c
index c59ce0c69..1d8db4e24 100644
--- a/lib/vsnprintf.c
+++ b/lib/vsnprintf.c
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
- with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
# include <config.h>
diff --git a/lib/w32sock.h b/lib/w32sock.h
index 5c1af6b37..b397115ac 100644
--- a/lib/w32sock.h
+++ b/lib/w32sock.h
@@ -1,4 +1,4 @@
-/* w32sock.h --- internal auxilliary functions for Windows socket functions
+/* w32sock.h --- internal auxiliary functions for Windows socket functions
Copyright (C) 2008-2012 Free Software Foundation, Inc.
@@ -29,7 +29,7 @@
#include "msvc-nothrow.h"
#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd)))
-#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY))
+#define SOCKET_TO_FD(fh) (_open_osfhandle ((intptr_t) (fh), O_RDWR | O_BINARY))
static inline void
set_winsock_errno (void)
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 1928729ec..5c93616b6 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Eric Blake. */
@@ -84,6 +83,14 @@
#ifndef _@GUARD_PREFIX@_WCHAR_H
#define _@GUARD_PREFIX@_WCHAR_H
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+ The attribute __pure__ was added in gcc 2.96. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_ARG_NONNULL is copied here. */
@@ -136,11 +143,11 @@ typedef int rpl_mbstate_t;
# undef btowc
# define btowc rpl_btowc
# endif
-_GL_FUNCDECL_RPL (btowc, wint_t, (int c));
+_GL_FUNCDECL_RPL (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (btowc, wint_t, (int c));
# else
# if !@HAVE_BTOWC@
-_GL_FUNCDECL_SYS (btowc, wint_t, (int c));
+_GL_FUNCDECL_SYS (btowc, wint_t, (int c) _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (btowc, wint_t, (int c));
# endif
@@ -161,12 +168,12 @@ _GL_WARN_ON_USE (btowc, "btowc is unportable - "
# undef wctob
# define wctob rpl_wctob
# endif
-_GL_FUNCDECL_RPL (wctob, int, (wint_t wc));
+_GL_FUNCDECL_RPL (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wctob, int, (wint_t wc));
# else
# if !defined wctob && !@HAVE_DECL_WCTOB@
/* wctob is provided by gnulib, or wctob exists but is not declared. */
-_GL_FUNCDECL_SYS (wctob, int, (wint_t wc));
+_GL_FUNCDECL_SYS (wctob, int, (wint_t wc) _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wctob, int, (wint_t wc));
# endif
@@ -427,12 +434,12 @@ _GL_WARN_ON_USE (wcsnrtombs, "wcsnrtombs is unportable - "
# undef wcwidth
# define wcwidth rpl_wcwidth
# endif
-_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t));
+_GL_FUNCDECL_RPL (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcwidth, int, (wchar_t));
# else
# if !@HAVE_DECL_WCWIDTH@
/* wcwidth exists but is not declared. */
-_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t));
+_GL_FUNCDECL_SYS (wcwidth, int, (wchar_t) _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcwidth, int, (wchar_t));
# endif
@@ -449,7 +456,8 @@ _GL_WARN_ON_USE (wcwidth, "wcwidth is unportable - "
/* Search N wide characters of S for C. */
#if @GNULIB_WMEMCHR@
# if !@HAVE_WMEMCHR@
-_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n));
+_GL_FUNCDECL_SYS (wmemchr, wchar_t *, (const wchar_t *s, wchar_t c, size_t n)
+ _GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" {
@@ -480,7 +488,8 @@ _GL_WARN_ON_USE (wmemchr, "wmemchr is unportable - "
#if @GNULIB_WMEMCMP@
# if !@HAVE_WMEMCMP@
_GL_FUNCDECL_SYS (wmemcmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
+ (const wchar_t *s1, const wchar_t *s2, size_t n)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wmemcmp, int,
(const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -550,7 +559,7 @@ _GL_WARN_ON_USE (wmemset, "wmemset is unportable - "
/* Return the number of wide characters in S. */
#if @GNULIB_WCSLEN@
# if !@HAVE_WCSLEN@
-_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s));
+_GL_FUNCDECL_SYS (wcslen, size_t, (const wchar_t *s) _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcslen, size_t, (const wchar_t *s));
_GL_CXXALIASWARN (wcslen);
@@ -566,7 +575,8 @@ _GL_WARN_ON_USE (wcslen, "wcslen is unportable - "
/* Return the number of wide characters in S, but at most MAXLEN. */
#if @GNULIB_WCSNLEN@
# if !@HAVE_WCSNLEN@
-_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
+_GL_FUNCDECL_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsnlen, size_t, (const wchar_t *s, size_t maxlen));
_GL_CXXALIASWARN (wcsnlen);
@@ -685,7 +695,8 @@ _GL_WARN_ON_USE (wcsncat, "wcsncat is unportable - "
/* Compare S1 and S2. */
#if @GNULIB_WCSCMP@
# if !@HAVE_WCSCMP@
-_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_FUNCDECL_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscmp, int, (const wchar_t *s1, const wchar_t *s2));
_GL_CXXALIASWARN (wcscmp);
@@ -702,7 +713,8 @@ _GL_WARN_ON_USE (wcscmp, "wcscmp is unportable - "
#if @GNULIB_WCSNCMP@
# if !@HAVE_WCSNCMP@
_GL_FUNCDECL_SYS (wcsncmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
+ (const wchar_t *s1, const wchar_t *s2, size_t n)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsncmp, int,
(const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -719,7 +731,8 @@ _GL_WARN_ON_USE (wcsncmp, "wcsncmp is unportable - "
/* Compare S1 and S2, ignoring case. */
#if @GNULIB_WCSCASECMP@
# if !@HAVE_WCSCASECMP@
-_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
+_GL_FUNCDECL_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscasecmp, int, (const wchar_t *s1, const wchar_t *s2));
_GL_CXXALIASWARN (wcscasecmp);
@@ -736,7 +749,8 @@ _GL_WARN_ON_USE (wcscasecmp, "wcscasecmp is unportable - "
#if @GNULIB_WCSNCASECMP@
# if !@HAVE_WCSNCASECMP@
_GL_FUNCDECL_SYS (wcsncasecmp, int,
- (const wchar_t *s1, const wchar_t *s2, size_t n));
+ (const wchar_t *s1, const wchar_t *s2, size_t n)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsncasecmp, int,
(const wchar_t *s1, const wchar_t *s2, size_t n));
@@ -804,7 +818,8 @@ _GL_WARN_ON_USE (wcsdup, "wcsdup is unportable - "
/* Find the first occurrence of WC in WCS. */
#if @GNULIB_WCSCHR@
# if !@HAVE_WCSCHR@
-_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_FUNCDECL_SYS (wcschr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+ _GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" {
@@ -833,7 +848,8 @@ _GL_WARN_ON_USE (wcschr, "wcschr is unportable - "
/* Find the last occurrence of WC in WCS. */
#if @GNULIB_WCSRCHR@
# if !@HAVE_WCSRCHR@
-_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc));
+_GL_FUNCDECL_SYS (wcsrchr, wchar_t *, (const wchar_t *wcs, wchar_t wc)
+ _GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" {
@@ -863,7 +879,8 @@ _GL_WARN_ON_USE (wcsrchr, "wcsrchr is unportable - "
of wide characters not in REJECT. */
#if @GNULIB_WCSCSPN@
# if !@HAVE_WCSCSPN@
-_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
+_GL_FUNCDECL_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcscspn, size_t, (const wchar_t *wcs, const wchar_t *reject));
_GL_CXXALIASWARN (wcscspn);
@@ -880,7 +897,8 @@ _GL_WARN_ON_USE (wcscspn, "wcscspn is unportable - "
of wide characters in ACCEPT. */
#if @GNULIB_WCSSPN@
# if !@HAVE_WCSSPN@
-_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
+_GL_FUNCDECL_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcsspn, size_t, (const wchar_t *wcs, const wchar_t *accept));
_GL_CXXALIASWARN (wcsspn);
@@ -897,7 +915,8 @@ _GL_WARN_ON_USE (wcsspn, "wcsspn is unportable - "
#if @GNULIB_WCSPBRK@
# if !@HAVE_WCSPBRK@
_GL_FUNCDECL_SYS (wcspbrk, wchar_t *,
- (const wchar_t *wcs, const wchar_t *accept));
+ (const wchar_t *wcs, const wchar_t *accept)
+ _GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" {
@@ -929,7 +948,8 @@ _GL_WARN_ON_USE (wcspbrk, "wcspbrk is unportable - "
#if @GNULIB_WCSSTR@
# if !@HAVE_WCSSTR@
_GL_FUNCDECL_SYS (wcsstr, wchar_t *,
- (const wchar_t *haystack, const wchar_t *needle));
+ (const wchar_t *haystack, const wchar_t *needle)
+ _GL_ATTRIBUTE_PURE);
# endif
/* On some systems, this function is defined as an overloaded function:
extern "C++" {
@@ -983,11 +1003,13 @@ _GL_WARN_ON_USE (wcstok, "wcstok is unportable - "
# undef wcswidth
# define wcswidth rpl_wcswidth
# endif
-_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_FUNCDECL_RPL (wcswidth, int, (const wchar_t *s, size_t n)
+ _GL_ATTRIBUTE_PURE);
_GL_CXXALIAS_RPL (wcswidth, int, (const wchar_t *s, size_t n));
# else
# if !@HAVE_WCSWIDTH@
-_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n));
+_GL_FUNCDECL_SYS (wcswidth, int, (const wchar_t *s, size_t n)
+ _GL_ATTRIBUTE_PURE);
# endif
_GL_CXXALIAS_SYS (wcswidth, int, (const wchar_t *s, size_t n));
# endif
diff --git a/lib/wctype.in.h b/lib/wctype.in.h
index f25ad30e2..e819d44d2 100644
--- a/lib/wctype.in.h
+++ b/lib/wctype.in.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
/* Written by Bruno Haible and Paul Eggert. */
diff --git a/lib/xsize.h b/lib/xsize.h
index 42799d91d..38d1afd3f 100644
--- a/lib/xsize.h
+++ b/lib/xsize.h
@@ -13,8 +13,7 @@
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
- along with this program; if not, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
#ifndef _XSIZE_H
#define _XSIZE_H