[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: automatic prototypes

From: Jim Meyering
Subject: [bug-gnulib] Re: automatic prototypes
Date: Wed, 02 Feb 2005 10:59:39 +0100

Paul Eggert <address@hidden> wrote:
> Simon Josefsson <address@hidden> writes:
>> I think getline would be a better test of this approach.  However, the
>> getline prototype uses (s)size_t, so config.h would have to #include
>> <sys/types.h>.
> Well, you _could_ prototype getline without mentioning either size_t
> or ssize_t, so long as you can compute integer types that are
> compatible with size_t and ssize_t.  Admittedly this is a bit of work
> to get right.

Maybe it'd be worthwhile after all.
memrchr is another case that'd benefit.

Eric Blake just pointed out that chdir-long uses memrchr
(and does include <string.h>) but doesn't include the
backup declaration:

  void *memrchr (const void *, int, size_t);

which is required on cygwin.

Here's the change I'm considering for memrchr.m4.
(of course, with such a change, chdir-long.c would need
the conditional declaration, but that's what I'd like to avoid.
It'd be cleaner to be able to emit e.g.,
  void *memrchr (const void *, int, GL_SIZE_T);
into config.h, along with a definition of the new type)

Index: m4/memrchr.m4
RCS file: /fetish/cu/m4/memrchr.m4,v
retrieving revision 1.3
diff -u -p -r1.3 memrchr.m4
--- m4/memrchr.m4       23 Jan 2005 09:07:57 -0000      1.3
+++ m4/memrchr.m4       2 Feb 2005 09:55:04 -0000
@@ -1,5 +1,5 @@
-# memrchr.m4 serial 3
-dnl Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# memrchr.m4 serial 4
+dnl Copyright (C) 2002, 2003, 2005 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.
@@ -9,6 +9,15 @@ AC_DEFUN([gl_FUNC_MEMRCHR],
   dnl Persuade glibc <string.h> to declare memrchr().
+  dnl For now, code that uses memrchr should add this snippet
+  dnl in addition to the usual `#include <string.h>':
+  dnl
+  dnl #if ! HAVE_DECL_MEMRCHR
+  dnl void *memrchr (const void *, int, size_t);
+  dnl #endif
+  AC_CHECK_DECLS_ONCE([memrchr])
   if test $ac_cv_func_memrchr = no; then

reply via email to

[Prev in Thread] Current Thread [Next in Thread]