mirror of
https://git.savannah.gnu.org/git/gnulib.git
synced 2025-08-08 17:22:05 +03:00
strnlen: Fix warning in C++ mode on MacOS X.
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
||||
2010-04-10 Bruno Haible <bruno@clisp.org>
|
||||
|
||||
strnlen: Fix warning in C++ mode on MacOS X.
|
||||
* lib/string.in.h (strnlen): Use the modern idiom.
|
||||
* m4/strnlen.m4 (gl_FUNC_STRNLEN): Set REPLACE_STRNLEN to 1, instead of
|
||||
defining strnlen as a macro already in <config.h>.
|
||||
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Initialize
|
||||
REPLACE_STRNLEN.
|
||||
* modules/string (Makefile.am): Substitute REPLACE_STRNLEN.
|
||||
Reported by Jarno Rajahalme <jarno.rajahalme@nsn.com>.
|
||||
|
||||
2010-04-08 James Youngman <jay@gnu.org>
|
||||
|
||||
* doc/manywarnings.texi (manywarnings): Add missing parenthesis in
|
||||
|
@@ -372,12 +372,23 @@ _GL_WARN_ON_USE (strndup, "strndup is unportable - "
|
||||
MAXLEN bytes. If no '\0' terminator is found in that many bytes,
|
||||
return MAXLEN. */
|
||||
#if @GNULIB_STRNLEN@
|
||||
# if @REPLACE_STRNLEN@
|
||||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# undef strnlen
|
||||
# define strnlen rpl_strnlen
|
||||
# endif
|
||||
_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__string, size_t __maxlen)
|
||||
__attribute__ ((__pure__))
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__string, size_t __maxlen));
|
||||
# else
|
||||
# if ! @HAVE_DECL_STRNLEN@
|
||||
_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__string, size_t __maxlen)
|
||||
__attribute__ ((__pure__))
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
# endif
|
||||
_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__string, size_t __maxlen));
|
||||
# endif
|
||||
_GL_CXXALIASWARN (strnlen);
|
||||
#elif defined GNULIB_POSIXCHECK
|
||||
# undef strnlen
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 16
|
||||
# serial 17
|
||||
|
||||
# Written by Paul Eggert.
|
||||
|
||||
@@ -105,6 +105,7 @@ AC_DEFUN([gl_HEADER_STRING_H_DEFAULTS],
|
||||
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
|
||||
REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT])
|
||||
REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP])
|
||||
REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN])
|
||||
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
|
||||
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
|
||||
UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R])
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# strnlen.m4 serial 10
|
||||
# strnlen.m4 serial 11
|
||||
dnl Copyright (C) 2002-2003, 2005-2007, 2009-2010 Free Software Foundation,
|
||||
dnl Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
@@ -7,10 +7,11 @@ dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([gl_FUNC_STRNLEN],
|
||||
[
|
||||
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
||||
|
||||
dnl Persuade glibc <string.h> to declare strnlen().
|
||||
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
|
||||
|
||||
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
|
||||
AC_CHECK_DECLS_ONCE([strnlen])
|
||||
if test $ac_cv_have_decl_strnlen = no; then
|
||||
HAVE_DECL_STRNLEN=0
|
||||
@@ -18,12 +19,11 @@ AC_DEFUN([gl_FUNC_STRNLEN],
|
||||
|
||||
AC_FUNC_STRNLEN
|
||||
if test $ac_cv_func_strnlen_working = no; then
|
||||
REPLACE_STRNLEN=1
|
||||
# This is necessary because automake-1.6.1 doesn't understand
|
||||
# that the above use of AC_FUNC_STRNLEN means we may have to use
|
||||
# lib/strnlen.c.
|
||||
#AC_LIBOBJ([strnlen])
|
||||
AC_DEFINE([strnlen], [rpl_strnlen],
|
||||
[Define to rpl_strnlen if the replacement function should be used.])
|
||||
gl_PREREQ_STRNLEN
|
||||
fi
|
||||
])
|
||||
|
@@ -89,6 +89,7 @@ string.h: string.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
|
||||
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
|
||||
-e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \
|
||||
-e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \
|
||||
-e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \
|
||||
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
|
||||
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
|
||||
-e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \
|
||||
|
Reference in New Issue
Block a user