cctype: New.

2006-01-25  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/cctype: New.
	* include/Makefile.am: Add.
	* testsuite/tr1/8_c_compatibility/cctype/functions.cc: New.
	* include/Makefile.in: Regenerate.

	* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): New, check for C99
	support to TR1, Chapter 8.
	* configure.ac: Use it.
	* include/tr1/complex: Adjust.
	* config.h.in: Regenerate.
	* configure: Likewise.

From-SVN: r110221
This commit is contained in:
Paolo Carlini 2006-01-25 19:29:40 +00:00 committed by Paolo Carlini
parent 03b8fe495d
commit bd2bb1ea59
10 changed files with 514 additions and 6 deletions

View File

@ -1,3 +1,17 @@
2006-01-25 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cctype: New.
* include/Makefile.am: Add.
* testsuite/tr1/8_c_compatibility/cctype/functions.cc: New.
* include/Makefile.in: Regenerate.
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): New, check for C99
support to TR1, Chapter 8.
* configure.ac: Use it.
* include/tr1/complex: Adjust.
* config.h.in: Regenerate.
* configure: Likewise.
2006-01-25 Benjamin Kosnik <bkoz@redhat.com>
* docs/html/configopts.html: Tweak docs.

View File

@ -1047,6 +1047,71 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
])
dnl
dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
dnl facilities in Chapter 8, "C compatibility".
dnl
AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
# Check for the existence of <complex.h> complex math functions used
# by tr1/complex.
AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
ac_c99_complex_tr1=no;
if test x"$ac_has_complex_h" = x"yes"; then
AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
AC_TRY_COMPILE([#include <complex.h>],
[typedef __complex__ float float_type; float_type tmpf;
cacosf(tmpf);
casinf(tmpf);
catanf(tmpf);
cacoshf(tmpf);
casinhf(tmpf);
catanhf(tmpf);
typedef __complex__ double double_type; double_type tmpd;
cacos(tmpd);
casin(tmpd);
catan(tmpd);
cacosh(tmpd);
casinh(tmpd);
catanh(tmpd);
typedef __complex__ long double ld_type; ld_type tmpld;
cacosl(tmpld);
casinl(tmpld);
catanl(tmpld);
cacoshl(tmpld);
casinhl(tmpld);
catanhl(tmpld);
],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
fi
AC_MSG_RESULT($ac_c99_complex_tr1)
if test x"$ac_c99_complex_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
[Define if C99 functions in <complex.h> should be used in
<tr1/complex>. Using compiler builtins for these functions
requires corresponding C99 library functions to be present.])
fi
# Check for the existence of <ctype.h> functions.
AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
AC_CACHE_VAL(ac_c99_ctype_tr1, [
AC_TRY_COMPILE([#include <ctype.h>],
[isblank(0);
],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no])
])
AC_MSG_RESULT($ac_c99_ctype_tr1)
if test x"$ac_c99_ctype_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
[Define if C99 functions in <ctype.h> should be imported in
<tr1/cctype> in namespace std::tr1.])
fi
AC_LANG_RESTORE
])
dnl
dnl Check for what type of C headers to use.
dnl

View File

@ -691,6 +691,15 @@
functions to be present. */
#undef _GLIBCXX_USE_C99_COMPLEX
/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.
Using compiler builtins for these functions requires corresponding C99
library functions to be present. */
#undef _GLIBCXX_USE_C99_COMPLEX_TR1
/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in
namespace std::tr1. */
#undef _GLIBCXX_USE_C99_CTYPE_TR1
/* Define if C99 functions or macros in <math.h> should be imported in <cmath>
in namespace std. */
#undef _GLIBCXX_USE_C99_MATH

321
libstdc++-v3/configure vendored
View File

@ -29974,6 +29974,327 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# For C99 support to TR1.
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# Check for the existence of <complex.h> complex math functions used
# by tr1/complex.
for ac_header in complex.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
ac_header_preproc=yes
;;
no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
(
cat <<\_ASBOX
## ----------------------------------------- ##
## Report this to the package-unused lists. ##
## ----------------------------------------- ##
_ASBOX
) |
sed "s/^/$as_me: WARNING: /" >&2
;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
fi
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
ac_has_complex_h=yes
else
ac_has_complex_h=no
fi
done
ac_c99_complex_tr1=no;
if test x"$ac_has_complex_h" = x"yes"; then
echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <complex.h>" >&5
echo $ECHO_N "checking for ISO C99 support to TR1 in <complex.h>... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <complex.h>
int
main ()
{
typedef __complex__ float float_type; float_type tmpf;
cacosf(tmpf);
casinf(tmpf);
catanf(tmpf);
cacoshf(tmpf);
casinhf(tmpf);
catanhf(tmpf);
typedef __complex__ double double_type; double_type tmpd;
cacos(tmpd);
casin(tmpd);
catan(tmpd);
cacosh(tmpd);
casinh(tmpd);
catanh(tmpd);
typedef __complex__ long double ld_type; ld_type tmpld;
cacosl(tmpld);
casinl(tmpld);
catanl(tmpld);
cacoshl(tmpld);
casinhl(tmpld);
catanhl(tmpld);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_c99_complex_tr1=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_c99_complex_tr1=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_c99_complex_tr1" >&5
echo "${ECHO_T}$ac_c99_complex_tr1" >&6
if test x"$ac_c99_complex_tr1" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_C99_COMPLEX_TR1 1
_ACEOF
fi
# Check for the existence of <ctype.h> functions.
echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <ctype.h>" >&5
echo $ECHO_N "checking for ISO C99 support to TR1 in <ctype.h>... $ECHO_C" >&6
if test "${ac_c99_ctype_tr1+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
int
main ()
{
isblank(0);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_cxx_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_c99_ctype_tr1=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_c99_ctype_tr1=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_c99_ctype_tr1" >&5
echo "${ECHO_T}$ac_c99_ctype_tr1" >&6
if test x"$ac_c99_ctype_tr1" = x"yes"; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE_C99_CTYPE_TR1 1
_ACEOF
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
# For TLS support.
# Check whether --enable-tls or --disable-tls was given.

View File

@ -157,6 +157,9 @@ if $GLIBCXX_IS_NATIVE; then
# For LFS support.
GLIBCXX_CHECK_LFS
# For C99 support to TR1.
GLIBCXX_CHECK_C99_TR1
# For TLS support.
GCC_CHECK_TLS

View File

@ -484,6 +484,7 @@ tr1_headers = \
${tr1_srcdir}/bind_repeat.h \
${tr1_srcdir}/bind_iterate.h \
${tr1_srcdir}/boost_shared_ptr.h \
${tr1_srcdir}/cctype \
${tr1_srcdir}/common.h \
${tr1_srcdir}/complex \
${tr1_srcdir}/functional \

View File

@ -701,6 +701,7 @@ tr1_headers = \
${tr1_srcdir}/bind_repeat.h \
${tr1_srcdir}/bind_iterate.h \
${tr1_srcdir}/boost_shared_ptr.h \
${tr1_srcdir}/cctype \
${tr1_srcdir}/common.h \
${tr1_srcdir}/complex \
${tr1_srcdir}/functional \

View File

@ -0,0 +1,56 @@
// TR1 cctype -*- C++ -*-
// 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/** @file
* This is a TR1 C++ Library header.
*/
#ifndef _TR1_CCTYPE
#define _TR1_CCTYPE 1
#include <bits/c++config.h>
#include <ctype.h>
#if _GLIBCXX_USE_C99_CTYPE_TR1
#undef isblank
// namespace std::tr1
namespace std
{
_GLIBCXX_BEGIN_NAMESPACE(tr1)
using ::isblank;
_GLIBCXX_END_NAMESPACE
}
#endif
#endif

View File

@ -64,7 +64,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acos(__complex__ float __z)
{ return __builtin_cacosf(__z); }
@ -100,7 +100,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return std::complex<_Tp>(__t.imag(), -__t.real());
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asin(__complex__ float __z)
{ return __builtin_casinf(__z); }
@ -144,7 +144,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
_Tp(0.25) * log(__num / __den));
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atan(__complex__ float __z)
{ return __builtin_catanf(__z); }
@ -183,7 +183,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return std::log(__t + __z);
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_acosh(__complex__ float __z)
{ return __builtin_cacoshf(__z); }
@ -222,7 +222,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
return std::log(__t + __z);
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_asinh(__complex__ float __z)
{ return __builtin_casinhf(__z); }
@ -266,7 +266,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1)
_Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));
}
#if _GLIBCXX_USE_C99_COMPLEX
#if _GLIBCXX_USE_C99_COMPLEX_TR1
inline __complex__ float
__complex_atanh(__complex__ float __z)
{ return __builtin_catanhf(__z); }

View File

@ -0,0 +1,38 @@
// 2006-01-25 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
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
// USA.
// 8.4 Additions to header <cctype>
#include <tr1/cctype>
void test01(int r = 0)
{
#if _GLIBCXX_USE_C99_CTYPE_TR1
r = std::tr1::isblank(0);
#else
r = 0;
#endif
}
int main()
{
test01();
return 0;
}