old-cross-binutils/gdb/gnulib/import/m4/strchrnul.m4
Simon Marchi 8424cc978c Import strchrnul from gnulib and use it
For a forthcoming patch, I need a "skip_to_colon" function.  I noticed
there are two skip_to_semicolon (one in gdb and one in gdbserver). I
thought we could put it in common/, and generalize it for any character.
It turns out that the strchrnul function does exactly that.  I imported
the corresponding module from gnulib, for those systems that do not have
it.

There are probably more places where this function can be used instead
of doing the work by hand (I am looking at
remote-utils.c::look_up_one_symbol).

gdb/ChangeLog:

	* remote.c (skip_to_semicolon): Remove.
	(remote_parse_stop_reply): Use strchrnul instead of
	skip_to_semicolon.
	* gnulib/update-gnulib.sh (IMPORTED_GNULIB_MODULES): Add
	strchrnul.
	* gnulib/aclocal.m4: Regenerate.
	* gnulib/config.in: Regenerate.
	* gnulib/configure: Regenerate.
	* gnulib/import/Makefile.am: Regenerate.
	* gnulib/import/Makefile.in: Regenerate.
	* gnulib/import/m4/gnulib-cache.m4: Regenerate.
	* gnulib/import/m4/gnulib-comp.m4: Regenerate.
	* gnulib/import/m4/rawmemchr.m4: New file.
	* gnulib/import/m4/strchrnul.m4: New file.
	* gnulib/import/rawmemchr.c: New file.
	* gnulib/import/rawmemchr.valgrind: New file.
	* gnulib/import/strchrnul.c: New file.
	* gnulib/import/strchrnul.valgrind: New file.

gdb/gdbserver/ChangeLog:

	* server.c (skip_to_semicolon):  Remove.
	(process_point_options): Use strchrnul instead of
	skip_to_semicolon.
2016-01-28 10:28:56 -05:00

50 lines
1.5 KiB
Text

# strchrnul.m4 serial 9
dnl Copyright (C) 2003, 2007, 2009-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([gl_FUNC_STRCHRNUL],
[
dnl Persuade glibc <string.h> to declare strchrnul().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([gl_HEADER_STRING_H_DEFAULTS])
AC_CHECK_FUNCS([strchrnul])
if test $ac_cv_func_strchrnul = no; then
HAVE_STRCHRNUL=0
else
AC_CACHE_CHECK([whether strchrnul works],
[gl_cv_func_strchrnul_works],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <string.h> /* for strchrnul */
]], [[const char *buf = "a";
return strchrnul (buf, 'b') != buf + 1;
]])],
[gl_cv_func_strchrnul_works=yes],
[gl_cv_func_strchrnul_works=no],
[dnl Cygwin 1.7.9 introduced strchrnul, but it was broken until 1.7.10
AC_EGREP_CPP([Lucky user],
[
#if defined __CYGWIN__
#include <cygwin/version.h>
#if CYGWIN_VERSION_DLL_COMBINED > CYGWIN_VERSION_DLL_MAKE_COMBINED (1007, 9)
Lucky user
#endif
#else
Lucky user
#endif
],
[gl_cv_func_strchrnul_works="guessing yes"],
[gl_cv_func_strchrnul_works="guessing no"])
])
])
case "$gl_cv_func_strchrnul_works" in
*yes) ;;
*) REPLACE_STRCHRNUL=1 ;;
esac
fi
])
# Prerequisites of lib/strchrnul.c.
AC_DEFUN([gl_PREREQ_STRCHRNUL], [:])