mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
memchr: Avoid a possible C++ test error.
This commit is contained in:
@@ -1,3 +1,12 @@
|
|||||||
|
2010-04-05 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
|
memchr: Avoid a possible C++ test error.
|
||||||
|
* lib/string.in.h (memchr): Provide declaration if function is missing.
|
||||||
|
* m4/memchr.m4 (gl_FUNC_MEMCHR): If the function is missing, set
|
||||||
|
HAVE_MEMCHR to 0, not REPLACE_MEMCHR to 1.
|
||||||
|
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Initialize HAVE_MEMCHR.
|
||||||
|
* modules/string (Makefile.am): Substitute HAVE_MEMCHR.
|
||||||
|
|
||||||
2010-04-05 Bruno Haible <bruno@clisp.org>
|
2010-04-05 Bruno Haible <bruno@clisp.org>
|
||||||
|
|
||||||
strtok_r: Improve idiom.
|
strtok_r: Improve idiom.
|
||||||
|
@@ -66,6 +66,11 @@ _GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n)
|
|||||||
_GL_ARG_NONNULL ((1)));
|
_GL_ARG_NONNULL ((1)));
|
||||||
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
|
_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n));
|
||||||
# else
|
# else
|
||||||
|
# if ! @HAVE_MEMCHR@
|
||||||
|
_GL_FUNCDECL_SYS (memchr, void *, (void const *__s, int __c, size_t __n)
|
||||||
|
__attribute__ ((__pure__))
|
||||||
|
_GL_ARG_NONNULL ((1)));
|
||||||
|
# endif
|
||||||
/* On some systems, this function is defined as an overloaded function:
|
/* On some systems, this function is defined as an overloaded function:
|
||||||
extern "C" { const void * std::memchr (const void *, int, size_t); }
|
extern "C" { const void * std::memchr (const void *, int, size_t); }
|
||||||
extern "C++" { void * std::memchr (void *, int, size_t); } */
|
extern "C++" { void * std::memchr (void *, int, size_t); } */
|
||||||
|
17
m4/memchr.m4
17
m4/memchr.m4
@@ -1,4 +1,4 @@
|
|||||||
# memchr.m4 serial 7
|
# memchr.m4 serial 8
|
||||||
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
|
dnl Copyright (C) 2002-2004, 2009-2010 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
dnl gives unlimited permission to copy and/or distribute it,
|
dnl gives unlimited permission to copy and/or distribute it,
|
||||||
@@ -13,12 +13,7 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||||||
|
|
||||||
dnl These days, we assume memchr is present. But just in case...
|
dnl These days, we assume memchr is present. But just in case...
|
||||||
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
||||||
AC_REPLACE_FUNCS([memchr])
|
AC_CHECK_FUNCS_ONCE([memchr])
|
||||||
if test $ac_cv_func_memchr = no; then
|
|
||||||
gl_PREREQ_MEMCHR
|
|
||||||
REPLACE_MEMCHR=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $ac_cv_func_memchr = yes; then
|
if test $ac_cv_func_memchr = yes; then
|
||||||
# Detect platform-specific bugs in some versions of glibc:
|
# Detect platform-specific bugs in some versions of glibc:
|
||||||
# memchr should not dereference anything with length 0
|
# memchr should not dereference anything with length 0
|
||||||
@@ -73,10 +68,14 @@ AC_DEFUN_ONCE([gl_FUNC_MEMCHR],
|
|||||||
[dnl Be pessimistic for now.
|
[dnl Be pessimistic for now.
|
||||||
gl_cv_func_memchr_works="guessing no"])])
|
gl_cv_func_memchr_works="guessing no"])])
|
||||||
if test "$gl_cv_func_memchr_works" != yes; then
|
if test "$gl_cv_func_memchr_works" != yes; then
|
||||||
gl_PREREQ_MEMCHR
|
|
||||||
REPLACE_MEMCHR=1
|
REPLACE_MEMCHR=1
|
||||||
AC_LIBOBJ([memchr])
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
HAVE_MEMCHR=0
|
||||||
|
fi
|
||||||
|
if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
|
||||||
|
AC_LIBOBJ([memchr])
|
||||||
|
gl_PREREQ_MEMCHR
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@@ -76,6 +76,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
|
|||||||
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
|
GNULIB_STRVERSCMP=0; AC_SUBST([GNULIB_STRVERSCMP])
|
||||||
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
|
HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN])
|
||||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||||
|
HAVE_MEMCHR=1; AC_SUBST([HAVE_MEMCHR])
|
||||||
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
|
HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
|
||||||
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
|
HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
|
||||||
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
|
HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
|
||||||
|
@@ -62,6 +62,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
|||||||
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
|
-e 's|@''GNULIB_STRVERSCMP''@|$(GNULIB_STRVERSCMP)|g' \
|
||||||
< $(srcdir)/string.in.h | \
|
< $(srcdir)/string.in.h | \
|
||||||
sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
|
sed -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \
|
||||||
|
-e 's|@''HAVE_MEMCHR''@|$(HAVE_MEMCHR)|g' \
|
||||||
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
|
-e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
|
||||||
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
|
-e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
|
||||||
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
|
-e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
|
||||||
|
Reference in New Issue
Block a user