Bruno Haible [Mon, 27 Feb 2012 11:28:29 +0000 (12:28 +0100)]
fmod-ieee: Work around test failures on OSF/1, mingw.
* m4/fmod-ieee.m4: New file.
* m4/fmod.m4 (gl_FUNC_FMOD): If gl_FUNC_FMOD_IEEE is present, test
whether fmod works with zero arguments. Replace it if not.
* lib/math.in.h (fmod): New declaration.
* lib/fmod.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether fmod is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_FMOD, REPLACE_FMOD.
* modules/math (Makefile.am): Substitute GNULIB_FMOD, REPLACE_FMOD.
* modules/fmod (Files): Add lib/fmod.c.
(Depends-on): Add math, isinf, trunc, fma.
(configure.ac): Arrange to compile lib/fmod.c if needed.
* modules/fmod-ieee (Files): Add m4/fmod-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_FMOD_IEEE.
* tests/test-math-c++.cc: Check the declaration of fmod.
* doc/posix-functions/fmod.texi: Mention the fmod-ieee module.
Paul Eggert [Mon, 27 Feb 2012 07:09:05 +0000 (23:09 -0800)]
regex: re_search etc. should return -2 when memory exhausted
This bug was uncovered when testing 'grep'. Without the fix,
re_search and friends return -1 when memory is exhausted, but -1
means no match, and this causes grep to falsely report no-match
instead of memory-exhaustion. See
<http://sources.redhat.com/bugzilla/show_bug.cgi?id=13762>.
* lib/regexec.c (re_search_stub): Return -2 (not -1) if there is
trouble; this can occur if re_search_internal ran out of memory.
Bruno Haible [Mon, 27 Feb 2012 00:44:57 +0000 (01:44 +0100)]
modf-ieee: Work around test failures on *BSD, IRIX, OSF/1, Cygwin.
* m4/modf-ieee.m4: New file.
* m4/modf.m4 (gl_FUNC_MODF): If gl_FUNC_MODF_IEEE is present, test
whether modf works with NaN and Inf. Replace it if not.
* lib/math.in.h (modf): New declaration.
* lib/modf.c: New file.
* m4/math_h.m4 (gl_MATH_H): Test whether modf is declared.
(gl_MATH_H_DEFAULTS): Initialize GNULIB_MODF, REPLACE_MODF.
* modules/math (Makefile.am): Substitute GNULIB_MODF, REPLACE_MODF.
* modules/modf (Files): Add lib/modf.c.
(Depends-on): Add math, isfinite, trunc, isinf.
(configure.ac): Addrange to compile lib/modf.c if needed.
* modules/modf-ieee (Files): Add m4/modf-ieee.m4, m4/minus-zero.m4,
m4/signbit.m4.
(configure.ac): Invoke gl_FUNC_MODF_IEEE.
* tests/test-math-c++.cc: Check the declaration of modf.
* doc/posix-functions/modf.texi: Mention the modf-ieee module.
Bruno Haible [Sat, 25 Feb 2012 23:36:01 +0000 (00:36 +0100)]
fmodl, remainder*: Avoid wrong results due to rounding errors.
* lib/fmodl.c (fmodl): Correct the result if it is not within the
expected bounds.
* lib/remainderf.c (remainderf): Likewise.
* lib/remainder.c (remainder): Likewise.
* lib/remainderl.c (remainderl): Likewise.
Bruno Haible [Sat, 25 Feb 2012 12:13:59 +0000 (13:13 +0100)]
fabs tests: More tests.
* tests/test-fabs.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabs-tests (Files): Add tests/minus-zero.h.
Bruno Haible [Sat, 25 Feb 2012 12:13:10 +0000 (13:13 +0100)]
fabsf tests: More tests.
* tests/test-fabsf.c: Include <string.h>, minus-zero.h.
(zero): New variable.
(main): Add tests for signed zero.
* modules/fabsf-tests (Files): Add tests/minus-zero.h.
Bruno Haible [Sat, 25 Feb 2012 00:45:18 +0000 (01:45 +0100)]
atanl: Provide function definition on MSVC.
* m4/atanl.m4 (gl_FUNC_ATANL): Test also whether atanl can be used as a
function pointer.
* lib/math.in.h (atanl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:42:45 +0000 (01:42 +0100)]
acosl: Provide function definition on MSVC.
* m4/acosl.m4 (gl_FUNC_ACOSL): Test also whether acosl can be used as a
function pointer.
* lib/math.in.h (acosl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:39:34 +0000 (01:39 +0100)]
asinl: Provide function definition on MSVC.
* m4/asinl.m4 (gl_FUNC_ASINL): Test also whether asinl can be used as a
function pointer.
* lib/math.in.h (asinl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:36:41 +0000 (01:36 +0100)]
tanl: Provide function definition on MSVC.
* m4/tanl.m4 (gl_FUNC_TANL): Test also whether tanl can be used as a
function pointer.
* lib/math.in.h (tanl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:31:58 +0000 (01:31 +0100)]
cosl: Provide function definition on MSVC.
* m4/cosl.m4 (gl_FUNC_COSL): Test also whether cosl can be used as a
function pointer.
* lib/math.in.h (cosl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:30:14 +0000 (01:30 +0100)]
sinl: Provide function definition on MSVC.
* m4/sinl.m4 (gl_FUNC_SINL): Test also whether sinl can be used as a
function pointer.
* lib/math.in.h (sinl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:27:00 +0000 (01:27 +0100)]
logl: Provide function definition on MSVC.
* m4/logl.m4 (gl_FUNC_LOGL): Test also whether logl can be used as a
function pointer.
* lib/math.in.h (logl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:24:28 +0000 (01:24 +0100)]
expl: Provide function definition on MSVC.
* m4/expl.m4 (gl_FUNC_EXPL): Test also whether expl can be used as a
function pointer.
* lib/math.in.h (expl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:10:38 +0000 (01:10 +0100)]
sqrtl: Provide function definition on MSVC.
* m4/sqrtl.m4 (gl_FUNC_SQRTL): Test also whether sqrtl can be used as
a function pointer.
* lib/math.in.h (sqrtl): Undefine if it does not exist as a function.
Bruno Haible [Sat, 25 Feb 2012 00:17:22 +0000 (01:17 +0100)]
ceill: Provide function definition on MSVC.
* m4/ceill.m4 (gl_FUNC_CEILL_LIBS): Test also whether ceill can be
used as a function pointer.
* lib/math.in.h (ceill): Undefine if it is not declared as a function.
Bruno Haible [Sat, 25 Feb 2012 00:15:03 +0000 (01:15 +0100)]
floorl: Provide function definition on MSVC.
* m4/floorl.m4 (gl_FUNC_FLOORL_LIBS): Test also whether floorl can be
used as a function pointer.
* lib/math.in.h (floorl): Undefine if it is not declared as a function.
Bruno Haible [Sat, 25 Feb 2012 00:09:12 +0000 (01:09 +0100)]
ceilf: Provide function definition on MSVC.
* m4/ceilf.m4 (gl_FUNC_CEILF_LIBS): Test also whether ceilf can be
used as a function pointer.
* lib/math.in.h (ceilf): Undefine if it is not declared as a function.
Bruno Haible [Sat, 25 Feb 2012 00:07:19 +0000 (01:07 +0100)]
floorf: Provide function definition on MSVC.
* m4/floorf.m4 (gl_FUNC_FLOORF_LIBS): Test also whether floorf can be
used as a function pointer.
* lib/math.in.h (floorf): Undefine if it is not declared as a function.
Stanislav Brabec [Fri, 24 Feb 2012 20:24:44 +0000 (12:24 -0800)]
regex: fix false multibyte matches in some regular expressions
See <http://sourceware.org/bugzilla/show_bug.cgi?id=13637>
and <http://sourceware.org/ml/libc-alpha/2012-02/msg00521.html>.
* lib/regex_internal.c (re_string_skip_chars):
Fix miscomputation of remain_len that may cause incomplete
multi-byte character and false match.