This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: FAIL: tr1/8_c_compatibility/cinttypes/functions.cc (test for excess errors)
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: libstdc++ at gcc dot gnu dot org, Loren James Rittle <rittle at labs dot mot dot com>
- Date: Sun, 07 Sep 2008 18:14:06 +0200
- Subject: Re: FAIL: tr1/8_c_compatibility/cinttypes/functions.cc (test for excess errors)
- References: <alpine.LSU.1.99.0809071630280.3773@acrux.dbai.tuwien.ac.at>
Hi,
What surprises me is that this code is the following snippet
#ifdef _GLIBCXX_USE_WCHAR_T
ret = std::tr1::wcstoimax(ws, wendptr, base);
uret = std::tr1::wcstoumax(ws, wendptr, base);
#endif
and the FreeBSD system in questions definitely does not have glibc
installed. Is some configure check going awry here, or is the macro
just not named correctly?
It's just the macro for generic wchar_t support, it's *very* old and
unrelated to glibc.
Anyway, I think it's just matter of a missing configure-time check for
those two specific C99 wchar_t functions, the below adds it, I'm going
to commit it to mainline.
Paolo.
/////////////////
2008-09-07 Paolo Carlini <paolo.carlini@oracle.com>
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Check wcstoimax and
wcstoumax, define _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1.
* include/tr1_impl/cinttypes: Use the latter.
* testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Likewise.
* configure: Regenerate.
* config.h.in: Likewise.
Index: include/tr1_impl/cinttypes
===================================================================
*** include/tr1_impl/cinttypes (revision 140087)
--- include/tr1_impl/cinttypes (working copy)
***************
*** 1,6 ****
// TR1 cinttypes -*- C++ -*-
! // Copyright (C) 2007 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
--- 1,6 ----
// TR1 cinttypes -*- C++ -*-
! // Copyright (C) 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
*************** _GLIBCXX_BEGIN_NAMESPACE_TR1
*** 64,70 ****
using ::strtoimax;
using ::strtoumax;
! #ifdef _GLIBCXX_USE_WCHAR_T
using ::wcstoimax;
using ::wcstoumax;
#endif
--- 64,70 ----
using ::strtoimax;
using ::strtoumax;
! #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
using ::wcstoimax;
using ::wcstoumax;
#endif
Index: testsuite/tr1/8_c_compatibility/cinttypes/functions.cc
===================================================================
*** testsuite/tr1/8_c_compatibility/cinttypes/functions.cc (revision 140087)
--- testsuite/tr1/8_c_compatibility/cinttypes/functions.cc (working copy)
***************
*** 2,8 ****
// 2006-01-30 Paolo Carlini <pcarlini@suse.de>
//
! // Copyright (C) 2006 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
--- 2,8 ----
// 2006-01-30 Paolo Carlini <pcarlini@suse.de>
//
! // Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
*************** void test01()
*** 31,37 ****
std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
const char* s = 0;
char** endptr = 0;
! #ifdef _GLIBCXX_USE_WCHAR_T
const wchar_t* ws = 0;
wchar_t** wendptr = 0;
#endif
--- 31,37 ----
std::tr1::intmax_t i = 0, numer = 0, denom = 0, base = 0;
const char* s = 0;
char** endptr = 0;
! #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
const wchar_t* ws = 0;
wchar_t** wendptr = 0;
#endif
*************** void test01()
*** 49,55 ****
ret = std::tr1::strtoimax(s, endptr, base);
uret = std::tr1::strtoumax(s, endptr, base);
! #ifdef _GLIBCXX_USE_WCHAR_T
ret = std::tr1::wcstoimax(ws, wendptr, base);
uret = std::tr1::wcstoumax(ws, wendptr, base);
#endif
--- 49,55 ----
ret = std::tr1::strtoimax(s, endptr, base);
uret = std::tr1::strtoumax(s, endptr, base);
! #if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
ret = std::tr1::wcstoimax(ws, wendptr, base);
uret = std::tr1::wcstoumax(ws, wendptr, base);
#endif
Index: config.h.in
===================================================================
*** config.h.in (revision 140038)
--- config.h.in (working copy)
***************
*** 760,765 ****
--- 760,769 ----
<tr1/cinttypes> in namespace std::tr1. */
#undef _GLIBCXX_USE_C99_INTTYPES_TR1
+ /* Define if wchar_t C99 functions in <inttypes.h> should be imported in
+ <tr1/cinttypes> in namespace std::tr1. */
+ #undef _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1
+
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std. */
#undef _GLIBCXX_USE_C99_MATH
Index: acinclude.m4
===================================================================
*** acinclude.m4 (revision 140038)
--- acinclude.m4 (working copy)
*************** AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
*** 1520,1526 ****
fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make
! # sense if the previous check fails, per C99, 7.8/1).
ac_c99_inttypes_tr1=no;
if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
--- 1520,1526 ----
fi
# Check for the existence of <inttypes.h> functions (NB: doesn't make
! # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
ac_c99_inttypes_tr1=no;
if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
*************** AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
*** 1541,1546 ****
--- 1541,1567 ----
<tr1/cinttypes> in namespace std::tr1.])
fi
+ # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
+ # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
+ ac_c99_inttypes_wchar_t_tr1=no;
+ if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
+ AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
+ AC_TRY_COMPILE([#include <inttypes.h>],
+ [intmax_t base;
+ const wchar_t* s;
+ wchar_t** endptr;
+ intmax_t ret = wcstoimax(s, endptr, base);
+ uintmax_t uret = wcstoumax(s, endptr, base);
+ ],[ac_c99_inttypes_wchar_t_tr1=yes],
+ [ac_c99_inttypes_wchar_t_tr1=no])
+ fi
+ AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
+ if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
+ [Define if wchar_t C99 functions in <inttypes.h> should be
+ imported in <tr1/cinttypes> in namespace std::tr1.])
+ fi
+
# Check for the existence of the <stdbool.h> header.
AC_CHECK_HEADERS(stdbool.h)