This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libbacktrace patch committed: Declare strnlen if not declared


This patch to libbacktrace declares strnlen if it is not declared in a
standard header file.  If necessary, the actual definition will come
from libiberty.  Bootstrapped on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian


2012-09-18  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Check whether strnlen is declared.
	* dwarf.c: Declare strnlen if not declared.


Index: dwarf.c
===================================================================
--- dwarf.c	(revision 191432)
+++ dwarf.c	(working copy)
@@ -44,6 +44,11 @@ POSSIBILITY OF SUCH DAMAGE.  */
 #include "backtrace.h"
 #include "internal.h"
 
+#ifndef HAVE_DECL_STRNLEN
+/* The function is defined in libiberty if needed.  */
+extern size_t strnlen (const char *, size_t);
+#endif
+
 /* A buffer to read DWARF info.  */
 
 struct dwarf_buf
Index: configure.ac
===================================================================
--- configure.ac	(revision 191432)
+++ configure.ac	(working copy)
@@ -199,6 +199,8 @@ if test "$ALLOC_FILE" = "alloc.lo"; then
 fi
 AC_SUBST(BACKTRACE_USES_MALLOC)
 
+AC_CHECK_DECLS(strnlen)
+
 AC_CACHE_CHECK([whether tests can run],
   [libbacktrace_cv_sys_native],
   [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]