This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4 PATCH] Fix IRIX bootstrap failure in libstdc++
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org, <libstdc++ at gcc dot gnu dot org>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 3 Oct 2004 16:24:55 -0600 (MDT)
- Subject: [3.4 PATCH] Fix IRIX bootstrap failure in libstdc++
mips-sgi-irix6.5 currently fails to bootstrap on both mainline and
the gcc 3.4 branch. The patch below restores bootstrap on the
gcc-3_4-branch, and should resolve one of the multiple breakages
on mainline (for example, Richard Sandiford's fixproto/fix-headers
patch http://gcc.gnu.org/ml/gcc-patches/2004-09/msg03008.html is
also required).
The failures addressed below are the unresolved references to
strtof and strtold whilst linking libstdc++. The problem is that
config/locale/generic/c_locale.cc currently guards its uses of
strtof and strtold with #ifdef _GLIBCXX_USE_C99. Unfortunately on
MIPS/IRIX, _GLIBCXX_USE_C99 is defined, even though the corresponding
_GLIBCXX_HAVE_STRTOF and _GLIBC_HAVE_STRTOLD aren't. The proposed
fix is to use the finer granularity configure HAVE_foo tests instead
of the more generic _GLIBCXX_USE_C99.
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures. As mentioned above,
this patch also restores bootstrap of the gcc-3_4-branch for all
default languages on mips-sgi-irix6.5.
Ok for mainline and the gcc-3_4-branch? Given that mips-sgi-irix6.5
is a primary evaluation platform in gcc-3.4/criteria.html, I think
this needs to be fixed for gcc 3.4.3.
2004-10-03 Roger Sayle <roger@eyesopen.com>
* config/locale/generic/c_locale.cc (__convert_to_v): Use
_GLIBCXX_HAVE_STRTOF instead _GLIBCXX_USE_C99 to check for strtof.
Likewise, use _GLIBCXX_HAVE_STRTOLD instead of _GLIBCXX_USE_C99
to check for presence of strtold.
Index: c_locale.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/locale/generic/c_locale.cc,v
retrieving revision 1.18
diff -c -3 -p -r1.18 c_locale.cc
*** c_locale.cc 31 Mar 2004 09:13:10 -0000 1.18
--- c_locale.cc 3 Oct 2004 18:55:12 -0000
*************** namespace std
*** 57,63 ****
setlocale(LC_ALL, "C");
char* __sanity;
errno = 0;
! #if defined(_GLIBCXX_USE_C99)
float __f = strtof(__s, &__sanity);
#else
double __d = strtod(__s, &__sanity);
--- 57,63 ----
setlocale(LC_ALL, "C");
char* __sanity;
errno = 0;
! #if defined(_GLIBCXX_HAVE_STRTOF)
float __f = strtof(__s, &__sanity);
#else
double __d = strtod(__s, &__sanity);
*************** namespace std
*** 117,123 ****
// Assumes __s formatted for "C" locale.
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
! #if defined(_GLIBCXX_USE_C99)
char* __sanity;
errno = 0;
long double __ld = strtold(__s, &__sanity);
--- 117,123 ----
// Assumes __s formatted for "C" locale.
char* __old = strdup(setlocale(LC_ALL, NULL));
setlocale(LC_ALL, "C");
! #if defined(_GLIBCXX_HAVE_STRTOLD)
char* __sanity;
errno = 0;
long double __ld = strtold(__s, &__sanity);
Roger
--