This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [civhr@civ.hw.ac.uk] libc/1178: Multiple declaration of strnlen
- To: H.Reinecke@hw.ac.uk
- Subject: Re: [civhr@civ.hw.ac.uk] libc/1178: Multiple declaration of strnlen
- From: Mark Kettenis <kettenis@wins.uva.nl>
- Date: Fri, 25 Jun 1999 16:56:58 +0200 (MET DST)
- CC: aj@arthur.rhein-neckar.de, libc-alpha@sourceware.cygnus.com
- References: <u8zp1omkgi.fsf@arthur.rhein-neckar.de> <377396BD.E3CAB088@hw.ac.uk>
Date: Fri, 25 Jun 1999 15:48:29 +0100
From: Hannes Reinecke <H.Reinecke@hw.ac.uk>
Andreas Jaeger wrote:
>
> This small program:
> #include <string.h>
>
> int
> main (void)
> {
> }
>
> shows the problem reported in the appended bug report if you compile
> with:
>
> gcc -D_GNU_SOURCE -O2 -Wall -W -Wredundant-decls -c strlen-test.c
> In file included from /usr/include/string.h:346,
> from strlen-test.c:1:
> /usr/include/bits/string2.h:946: warning: redundant redeclaration of `strnlen' in same scope
> /usr/include/string.h:212: warning: previous declaration of `strnlen'
>
> What shall we do?
>
What about my proposal ?
#if defined(__USE_GNU) && defined(__NO_STRING_INLINES)
extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
#endif
Because we should only need it if the inlined version should _not_ be
used.
Or is there some requirements to have it always defined in string.h ?
(After all, this is a GNU extension, innit ?)
Yes, and therefore we should simply remove the prototype for strnlen
from bits/string.h.
Mark