[2981] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[PATCH] Protect memrchr prototype by !HAVE_DECL_MEMCHR instead of

daemon@ATHENA.MIT.EDU (Anders Kaseorg)
Sat Mar 19 22:40:06 2011

Date: Sat, 19 Mar 2011 22:40:02 -0400 (EDT)
From: Anders Kaseorg <andersk@MIT.EDU>
To: barnowl-dev@mit.edu

This fixes
viewwin.c:393:7: warning: implicit declaration of function =E2=80=98memrchr=
=E2=80=99
on platforms where PERL_CFLAGS doesn=E2=80=99t contain -D_GNU_SOURCE.

!HAVE_MEMRCHR means that memrchr is undefined at link time, so we need
to provide our own implementation; but !HAVE_DECL_MEMRCHR means that
memrchr is not prototyped at compile time, so we need to provide our
own prototype.

http://lists.gnu.org/archive/html/bug-autoconf/2008-12/msg00037.html

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 compat/compat.h |    4 ++--
 configure.ac    |    1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/compat/compat.h b/compat/compat.h
index 8ad61e6..05c40c9 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -2,6 +2,6 @@
=20
 #include <stddef.h>
=20
-#ifndef HAVE_MEMRCHR
+#if !HAVE_DECL_MEMRCHR
 void *memrchr(const void *s, int c, size_t n);
-#endif  /* HAVE_MEMRCHR */
+#endif  /* !HAVE_DECL_MEMRCHR */
diff --git a/configure.ac b/configure.ac
index 0a200ae..e40e474 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,6 +158,7 @@ if test "x${HAVE_ZIP}" =3D "xno"; then
 fi
=20
 AC_CONFIG_LIBOBJ_DIR([compat])
+AC_CHECK_DECLS([memrchr])
 AC_REPLACE_FUNCS([memrchr])
=20
 AC_CONFIG_FILES([Makefile compat/Makefile libfaim/Makefile perl/Makefile p=
erl/modules/Makefile])
--=20
1.7.4.1


home help back first fref pref prev next nref lref last post