This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
newlib 1.10.0 vs Linux string.h difference
- From: "Joel Sherrill <joel at OARcorp dot com>" <joel dot sherrill at OARcorp dot com>
- To: newlib at sources dot redhat dot com, Eric Norum <eric dot norum at usask dot ca>
- Date: Thu, 22 Aug 2002 11:57:47 -0500
- Subject: newlib 1.10.0 vs Linux string.h difference
- Organization: OAR Corporation
- Reply-to: joel dot sherrill at OARcorp dot com
Hi,
Eric Norum ran across a problem some libstdc++-v3 code in gcc 3.2
which compiles native but doesn't with newlib because of a minor
difference in the two string.h implementations. I don't know whether
this is a bug in newlib or not and wanted comments:
The file:
#include <string.h>
int f(char *c1) {
char *c;
c=strdup(c1);
}
These are all with GCC 3.2 on RedHat 7.3.
bash-2.05$ /opt/gcc-3.2/bin/gcc -c j.c
bash-2.05$ /opt/gcc-3.2/bin/gcc -ansi -c j.c
bash-2.05$ mips-rtems-gcc j.cc -c
bash-2.05$ mips-rtems-gcc -ansi j.cc -c
j.cc: In function `int f(char*)':
j.cc:5: `strdup' undeclared (first use this function)
j.cc:5: (Each undeclared identifier is reported only once for each
function it
appears in.)
Notice that when you turn on -ansi, strdup() no longer has
a prototype from newlib because it is wrapped in a __STRICT_ANSI__
conditional.
Any suggestions on how to address this.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985