This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
[civhr@civ.hw.ac.uk] libc/1178: Multiple declaration of strnlen
- To: libc-alpha Mailinglist <libc-alpha@sourceware.cygnus.com>
- Subject: [civhr@civ.hw.ac.uk] libc/1178: Multiple declaration of strnlen
- From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
- Date: 25 Jun 1999 16:19:25 +0200
- Cc: civhr@civ.hw.ac.uk
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?
Andreas
- Subject: libc/1178: Multiple declaration of strnlen
- From: civhr@civ.hw.ac.uk
- Date: Fri Jun 25 16:17:55 1999
Topics:
libc/1178: Multiple declaration of strnlen()
----------------------------------------------------------------------
Date: Fri, 25 Jun 1999 06:25:26 -0400
From: civhr@civ.hw.ac.uk
To: bugs@gnu.org
Subject: libc/1178: Multiple declaration of strnlen()
Message-Id: <199906251025.GAA27125@delysid.gnu.org>
>Number: 1178
>Category: libc
>Synopsis: Multiple declaration of strnlen()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: libc-gnats
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Fri Jun 25 06:30:01 EDT 1999
>Last-Modified:
>Originator: civhr@civ.hw.ac.uk
>Organization:
net
>Release: 2.1.1
>Environment:
Linux 2.2.10, RedHat 6.0 stock
>Description:
With using the right #defines (__USE_GNU etc.), strnlen() gets defined by both
/usr/include/string.h and /usr/include/bits/string2.h
(if __NO_STRING_INLINES is not defined).
This results in annoying warning messages from gcc.
Wouldn't it make sense to change (/usr/include/string.h line 203)
#ifdef __USE_GNU
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
#endif
into
#if defined(__USE_GNU) && defined(__NO_STRING_INLINES)
...
?
That at least keeps gcc happy. Or I'm missing something subtle ?
HTH,
Hannes
>How-To-Repeat:
>Fix:
>Audit-Trail:
>Unformatted:
------------------------------
End of forward__FwPH Digest
***************************
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de