[civhr@civ.hw.ac.uk] libc/1178: Multiple declaration of strnlen

Hannes Reinecke H.Reinecke@hw.ac.uk
Fri Jun 25 07:48:00 GMT 1999


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 ?)

Cheers,

Hannes
-- 
Hannes Reinecke                                 <civhr@civ.hw.ac.uk>
Fluid Loading and Instrumentation Center        Tel: (+44) 131 451 3149
Dept. of Civil & Offshore Engineering           Fax: (+44) 131 451 3154
Heriot Watt University, Edinburgh EH14 4AS


More information about the Libc-alpha mailing list