diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-26 11:29:20 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-01-26 11:29:20 +0000 |
commit | 1068b7dbd9138e059eccf72b97df5f3a7f194cdd (patch) | |
tree | 393627f2ed1e560bf65118cc438da81fa46d3429 | |
parent | 8ba1ca38d6be3dd5ed9d50aadd7565fb7c735b8e (diff) | |
download | gcc-1068b7dbd9138e059eccf72b97df5f3a7f194cdd.tar.gz |
2006-01-26 Paolo Carlini <pcarlini@suse.de>
* include/tr1/cfenv: New.
* include/Makefile.am: Add.
* testsuite/tr1/8_c_compatibility/cfenv/functions.cc: New.
* testsuite/tr1/8_c_compatibility/cfenv/types.cc: Likewise.
* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <fenv.h> checks.
* docs/html/ext/tr1.html: Update; add note.
* include/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* testsuite/tr1/8_c_compatibility/complex/functions.cc: Tweak.
* testsuite/tr1/8_c_compatibility/cctype/functions.cc: Likewise.
* docs/html/faq/index.html: Fix link to tr1.html text; fix
formatting.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110252 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libstdc++-v3/ChangeLog | 18 | ||||
-rw-r--r-- | libstdc++-v3/acinclude.m4 | 32 | ||||
-rw-r--r-- | libstdc++-v3/config.h.in | 7 | ||||
-rwxr-xr-x | libstdc++-v3/configure | 230 | ||||
-rw-r--r-- | libstdc++-v3/docs/html/ext/tr1.html | 24 | ||||
-rw-r--r-- | libstdc++-v3/docs/html/faq/index.html | 57 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.am | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/Makefile.in | 1 | ||||
-rw-r--r-- | libstdc++-v3/include/tr1/cfenv | 86 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc | 17 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc | 52 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc | 36 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc | 23 |
13 files changed, 526 insertions, 58 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index a8cd4c1f7d1..3c38e854cc5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,21 @@ +2006-01-26 Paolo Carlini <pcarlini@suse.de> + + * include/tr1/cfenv: New. + * include/Makefile.am: Add. + * testsuite/tr1/8_c_compatibility/cfenv/functions.cc: New. + * testsuite/tr1/8_c_compatibility/cfenv/types.cc: Likewise. + * acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <fenv.h> checks. + * docs/html/ext/tr1.html: Update; add note. + * include/Makefile.in: Regenerate. + * config.h.in: Likewise. + * configure: Likewise. + + * testsuite/tr1/8_c_compatibility/complex/functions.cc: Tweak. + * testsuite/tr1/8_c_compatibility/cctype/functions.cc: Likewise. + + * docs/html/faq/index.html: Fix link to tr1.html text; fix + formatting. + 2006-01-25 Paolo Carlini <pcarlini@suse.de> * include/tr1/cctype: New. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 4e2b1693525..981fc920cd0 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1098,7 +1098,8 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ 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); + [int ch; + isblank(ch); ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no]) ]) AC_MSG_RESULT($ac_c99_ctype_tr1) @@ -1108,6 +1109,35 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ <tr1/cctype> in namespace std::tr1.]) fi + # Check for the existence of <fenv.h> functions. + AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) + ac_c99_fenv_tr1=no; + if test x"$ac_has_fenv_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>]) + AC_TRY_COMPILE([#include <fenv.h>], + [int except, mode; + fexcept_t* pflag; + fenv_t* penv; + feclearexcept(except); + fegetexceptflag(pflag, except); + feraiseexcept(except); + fesetexceptflag(pflag, except); + fetestexcept(except); + fegetround(); + fesetround(mode); + fegetenv(penv); + feholdexcept(penv); + fesetenv(penv); + feupdateenv(penv); + ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no]) + fi + AC_MSG_RESULT($ac_c99_fenv_tr1) + if test x"$ac_c99_fenv_tr1" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1, + [Define if C99 functions in <fenv.h> should be imported in + <tr1/cfenv> in namespace std::tr1.]) + fi + AC_LANG_RESTORE ]) diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in index f8877acbd8e..2184c2d1bd1 100644 --- a/libstdc++-v3/config.h.in +++ b/libstdc++-v3/config.h.in @@ -69,6 +69,9 @@ /* Define to 1 if you have the `fabsl' function. */ #undef HAVE_FABSL +/* Define to 1 if you have the <fenv.h> header file. */ +#undef HAVE_FENV_H + /* Define to 1 if you have the `finite' function. */ #undef HAVE_FINITE @@ -700,6 +703,10 @@ namespace std::tr1. */ #undef _GLIBCXX_USE_C99_CTYPE_TR1 +/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in + namespace std::tr1. */ +#undef _GLIBCXX_USE_C99_FENV_TR1 + /* Define if C99 functions or macros in <math.h> should be imported in <cmath> in namespace std. */ #undef _GLIBCXX_USE_C99_MATH diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 9c3599cef82..6cb8dd72d5e 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -30238,7 +30238,8 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -isblank(0); +int ch; + isblank(ch); ; return 0; @@ -30287,6 +30288,233 @@ _ACEOF fi + # Check for the existence of <fenv.h> functions. + +for ac_header in fenv.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_fenv_h=yes +else + ac_has_fenv_h=no +fi + +done + + ac_c99_fenv_tr1=no; + if test x"$ac_has_fenv_h" = x"yes"; then + echo "$as_me:$LINENO: checking for ISO C99 support to TR1 in <fenv.h>" >&5 +echo $ECHO_N "checking for ISO C99 support to TR1 in <fenv.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 <fenv.h> +int +main () +{ +int except, mode; + fexcept_t* pflag; + fenv_t* penv; + feclearexcept(except); + fegetexceptflag(pflag, except); + feraiseexcept(except); + fesetexceptflag(pflag, except); + fetestexcept(except); + fegetround(); + fesetround(mode); + fegetenv(penv); + feholdexcept(penv); + fesetenv(penv); + feupdateenv(penv); + + ; + 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_fenv_tr1=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_c99_fenv_tr1=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + echo "$as_me:$LINENO: result: $ac_c99_fenv_tr1" >&5 +echo "${ECHO_T}$ac_c99_fenv_tr1" >&6 + if test x"$ac_c99_fenv_tr1" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define _GLIBCXX_USE_C99_FENV_TR1 1 +_ACEOF + + fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/libstdc++-v3/docs/html/ext/tr1.html b/libstdc++-v3/docs/html/ext/tr1.html index de432f40ed6..0eeb8928bd5 100644 --- a/libstdc++-v3/docs/html/ext/tr1.html +++ b/libstdc++-v3/docs/html/ext/tr1.html @@ -30,7 +30,14 @@ Draft Technical Report on C++ Library Extensions </p> <p> -This page describes the TR1 support in mainline GCC CVS, not in any particular release. +In this implementation the header names are prefixed by +<code>tr1/</code>, for instance <code><tr1/functional></code>, +<code><tr1/memory></code>, and so on. +</p> + +<p> +This page describes the TR1 support in mainline GCC CVS, not in any particular +release. </p> <table border="1"> @@ -1796,25 +1803,25 @@ This page describes the TR1 support in mainline GCC CVS, not in any particular r <tr> <td>8.4</td> <td>Additions to header <code><cctype></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> <td>8.4.1</td> <td>Synopsis</td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> <td>8.4.2</td> <td>Function <code>isblank</code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> @@ -1828,25 +1835,25 @@ This page describes the TR1 support in mainline GCC CVS, not in any particular r <tr> <td>8.6</td> <td>Header <code><cfenv></code></td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> <td>8.6.1</td> <td>Synopsis</td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> <td>8.6.2</td> <td>Definitions</td> + <td>done</td> <td></td> <td></td> - <td>missing</td> <td></td> </tr> <tr> @@ -2259,7 +2266,8 @@ This page describes the TR1 support in mainline GCC CVS, not in any particular r <li> <a name="1"/> The shared_ptr implementation uses some code from the - <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">Boost shared_ptr</a> library. + <a href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm">Boost + shared_ptr</a> library. </li> </ol> diff --git a/libstdc++-v3/docs/html/faq/index.html b/libstdc++-v3/docs/html/faq/index.html index e5290a3c521..4d0f922efcf 100644 --- a/libstdc++-v3/docs/html/faq/index.html +++ b/libstdc++-v3/docs/html/faq/index.html @@ -982,64 +982,73 @@ http://clisp.cons.org/~haible/gccinclude-glibc-2.2-compat.diff <hr /> <h2><a name="5_5">5.5 Does libstdc++ support TR1?</a></h2> - <p>The C++ Standard Library Technical Report adds many new features to the library. - The latest version of this effort is described in - <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf"> + <p>The C++ Standard Library Technical Report adds many new features to + the library. The latest version of this effort is described in + <a href= + "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf"> Technical Report 1</a>. </p> <p>libstdc++ strives to implement all of TR1. - The libstdc++ implementation status of the TR1 draft is listed in - <a href="../ext/tr1.html">this page</a>. + An <a href="../ext/tr1.html">overview</a> of the implementation status + is available. </p> <p>Briefly, the features of TR1 and the current status are: </p> <p><strong>Unordered containers - Complete -</strong> - The unordered_set, unordered_map, unordered_multiset, and unordered_multimap containers - are hashed versions of the map, set, multimap, and multiset containers respectively. - These classes are suitable replacements for the SGI STL hash_map and hash_set extensions. + The unordered_set, unordered_map, unordered_multiset, and + unordered_multimap containers are hashed versions of the map, set, + multimap, and multiset containers respectively. These classes are + suitable replacements for the SGI STL hash_map and hash_set + extensions. </p> <p><strong>Reference-counted smart pointers - Complete -</strong> - The shared_ptr and weak_ptr allow several object to know about a pointer and whether it is valid. - When the last reference to the pointer is destroyed the pointer is freed. + The shared_ptr and weak_ptr allow several object to know about a + pointer and whether it is valid. When the last reference to the + pointer is destroyed the pointer is freed. </p> <p><strong>Type traits - Complete -</strong> - The type_traits class gives templates the ability to probe information about the input type - and enable type-dependent logic to be performed without the need of template specializations. + The type_traits class gives templates the ability to probe + information about the input type and enable type-dependent logic + to be performed without the need of template specializations. </p> <p><strong>Fixed-size arrays - Complete -</strong> - The array class implements small fixed-sized arrays with container semantics. + The array class implements small fixed-sized arrays with container + semantics. </p> <p><strong>Tuples - Complete -</strong> - The tuple class implements small heterogeneous arrays. This is an enhanced pair. - In fact, the standard pair is enhanced with a tuple interface. + The tuple class implements small heterogeneous arrays. This is an + enhanced pair. In fact, the standard pair is enhanced with a tuple + interface. </p> <p><strong>A regular expression engine</strong> - This library provides for regular expression objects with traversal of - text with return of subexpressions. + This library provides for regular expression objects with traversal + of text with return of subexpressions. </p> <p><strong>A random number engine</strong> - This library contains randow number generators with several different choices - of distribution. + This library contains randow number generators with several different + choices of distribution. </p> <p><strong>Special functions - Under construction - </strong> - Twenty-three mathematical functions familiar to physicists and engineers are included: - cylindrical and spherical Bessel and Neumann functions, hypergeometric functions, - Laguerre polynomials, Legendre functions, elliptic integrals, exponential integrals - and the Riemann zeta function all for your computing pleasure. + Twenty-three mathematical functions familiar to physicists and + engineers are included: cylindrical and spherical Bessel and Neumann + functions, hypergeometric functions, Laguerre polynomials, Legendre + functions, elliptic integrals, exponential integrals and the Riemann + zeta function all for your computing pleasure. </p> <p><strong>C99 compatibility - Under construction - </strong> - There are many features designed to minimize the divergence of the C and the C++ languages. + There are many features designed to minimize the divergence of the C + and the C++ languages. </p> <hr /> diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index dc66cbbfc6f..2766df628ae 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -485,6 +485,7 @@ tr1_headers = \ ${tr1_srcdir}/bind_iterate.h \ ${tr1_srcdir}/boost_shared_ptr.h \ ${tr1_srcdir}/cctype \ + ${tr1_srcdir}/cfenv \ ${tr1_srcdir}/common.h \ ${tr1_srcdir}/complex \ ${tr1_srcdir}/functional \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 42663512960..b76fec729da 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -702,6 +702,7 @@ tr1_headers = \ ${tr1_srcdir}/bind_iterate.h \ ${tr1_srcdir}/boost_shared_ptr.h \ ${tr1_srcdir}/cctype \ + ${tr1_srcdir}/cfenv \ ${tr1_srcdir}/common.h \ ${tr1_srcdir}/complex \ ${tr1_srcdir}/functional \ diff --git a/libstdc++-v3/include/tr1/cfenv b/libstdc++-v3/include/tr1/cfenv new file mode 100644 index 00000000000..d4e925a8bc3 --- /dev/null +++ b/libstdc++-v3/include/tr1/cfenv @@ -0,0 +1,86 @@ +// 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_CFENV +#define _TR1_CFENV 1 + +#include <bits/c++config.h> + +#if _GLIBCXX_HAVE_FENV_H +#include <fenv.h> +#endif + +#if _GLIBCXX_USE_C99_FENV_TR1 + +#undef feclearexcept +#undef fegetexceptflag +#undef feraiseexcept +#undef fesetexceptflag +#undef fetestexcept +#undef fegetround +#undef fesetround +#undef fegetenv +#undef feholdexcept +#undef fesetenv +#undef feupdateenv + +// namespace std::tr1 +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE(tr1) + + // types + using ::fenv_t; + using ::fexcept_t; + + // functions + using ::feclearexcept; + using ::fegetexceptflag; + using ::feraiseexcept; + using ::fesetexceptflag; + using ::fetestexcept; + + using ::fegetround; + using ::fesetround; + + using ::fegetenv; + using ::feholdexcept; + using ::fesetenv; + using ::feupdateenv; + +_GLIBCXX_END_NAMESPACE +} + +#endif + +#endif diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc index 9665a60e0f2..57d81f1ffc9 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cctype/functions.cc @@ -1,3 +1,5 @@ +// { dg-do compile } + // 2006-01-25 Paolo Carlini <pcarlini@suse.de> // // Copyright (C) 2006 Free Software Foundation, Inc. @@ -22,17 +24,12 @@ #include <tr1/cctype> -void test01(int r = 0) +void test01() { #if _GLIBCXX_USE_C99_CTYPE_TR1 - r = std::tr1::isblank(0); -#else - r = 0; -#endif -} -int main() -{ - test01(); - return 0; + int ch = 0, r; + r = std::tr1::isblank(ch); + +#endif } diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc new file mode 100644 index 00000000000..9f3769fd91c --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/functions.cc @@ -0,0 +1,52 @@ +// { dg-do compile } + +// 2006-01-26 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.6 Header <cfenv> + +#include <tr1/cfenv> + +void test01() +{ +#if _GLIBCXX_USE_C99_FENV_TR1 + + int except = 0, mode = 0; + std::tr1::fexcept_t* pflag = 0; + std::tr1::fenv_t* penv = 0; + + int r; + + r = std::tr1::feclearexcept(except); + r = std::tr1::fegetexceptflag(pflag, except); + r = std::tr1::feraiseexcept(except); + r = std::tr1::fesetexceptflag(pflag, except); + r = std::tr1::fetestexcept(except); + + r = std::tr1::fegetround(); + r = std::tr1::fesetround(mode); + + r = std::tr1::fegetenv(penv); + r = std::tr1::feholdexcept(penv); + r = std::tr1::fesetenv(penv); + r = std::tr1::feupdateenv(penv); + +#endif +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc new file mode 100644 index 00000000000..66186cdea28 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/cfenv/types.cc @@ -0,0 +1,36 @@ +// { dg-do compile } + +// 2006-01-26 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.6 Header <cfenv> + +#include <tr1/cfenv> + +void test01() +{ +#if _GLIBCXX_USE_C99_FENV_TR1 + + // Check for required typedefs + typedef std::tr1::fenv_t fenv_t_type; + typedef std::tr1::fexcept_t fexcept_t_type; + +#endif +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc index 1fdd10848e3..c4749e9a373 100644 --- a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc @@ -1,3 +1,5 @@ +// { dg-do compile } + // 2006-01-10 Paolo Carlini <pcarlini@suse.de> // // Copyright (C) 2006 Free Software Foundation, Inc. @@ -25,19 +27,18 @@ template<typename T> void test01_do() { - using namespace std::tr1; typedef std::complex<T> cmplx_type; cmplx_type ans; - ans = acos(cmplx_type(1.0, 1.0)); - ans = asin(cmplx_type(1.0, 1.0)); - ans = atan(cmplx_type(1.0, 1.0)); + ans = std::tr1::acos(cmplx_type(1.0, 1.0)); + ans = std::tr1::asin(cmplx_type(1.0, 1.0)); + ans = std::tr1::atan(cmplx_type(1.0, 1.0)); - ans = acosh(cmplx_type(1.0, 1.0)); - ans = asinh(cmplx_type(1.0, 1.0)); - ans = atanh(cmplx_type(1.0, 1.0)); - ans = fabs(cmplx_type(1.0, 1.0)); + ans = std::tr1::acosh(cmplx_type(1.0, 1.0)); + ans = std::tr1::asinh(cmplx_type(1.0, 1.0)); + ans = std::tr1::atanh(cmplx_type(1.0, 1.0)); + ans = std::tr1::fabs(cmplx_type(1.0, 1.0)); } void test01() @@ -46,9 +47,3 @@ void test01() test01_do<double>(); test01_do<long double>(); } - -int main() -{ - test01(); - return 0; -} |