Commit bd2bb1ea by Paolo Carlini Committed by Paolo Carlini

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
parent 03b8fe49
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.
......
......@@ -1048,6 +1048,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
dnl --enable-cheaders= [does stuff].
......
......@@ -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
......
......@@ -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
......
......@@ -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 \
......
......@@ -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 \
......
// 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
......@@ -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); }
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment