This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] tr1/c_compatibility: cstdbool, etc.


Hi,

tested x86-linux, committed to mainline.

Paolo.

////////////////////
2006-02-26  Paolo Carlini  <pcarlini@suse.de>

	* include/tr1/cmath: Add templates (8.16.3).	
	* include/tr1/cstbool: New.
	* include/tr1/stdbool.h: Likewise.
	* include/Makefile.am: Add.
	* testsuite/tr1/8_c_compatibility/cmath/templates.cc: New.
	* testsuite/tr1/headers.cc: Update.
	* acinclude.m4 ([GLIBCXX_CHECK_C99_TR1]): Add <stdbool.h> check.
	* docs/html/ext/tr1.html: Update.
	* include/Makefile.in: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.
Index: include/tr1/cmath
===================================================================
--- include/tr1/cmath	(revision 111454)
+++ include/tr1/cmath	(working copy)
@@ -295,4 +295,32 @@
 
 #endif
 
+// namespace std::tr1
+namespace std
+{
+_GLIBCXX_BEGIN_NAMESPACE(tr1)
+
+#if _GLIBCXX_USE_C99_MATH
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+  using std::signbit;
+  
+  using std::fpclassify;
+
+  using std::isfinite;
+  using std::isinf;
+  using std::isnan;
+  using std::isnormal;
+
+  using std::isgreater;
+  using std::isgreaterequal;
+  using std::isless;
+  using std::islessequal;
+  using std::islessgreater;
+  using std::isunordered;
 #endif
+#endif
+
+_GLIBCXX_END_NAMESPACE
+}
+
+#endif
Index: include/Makefile.am
===================================================================
--- include/Makefile.am	(revision 111454)
+++ include/Makefile.am	(working copy)
@@ -493,6 +493,7 @@
 	${tr1_srcdir}/common.h \
 	${tr1_srcdir}/complex \
 	${tr1_srcdir}/cstdarg \
+	${tr1_srcdir}/cstdbool \
 	${tr1_srcdir}/cstdint \
 	${tr1_srcdir}/cstdio \
 	${tr1_srcdir}/cstdlib \
@@ -514,6 +515,7 @@
 	${tr1_srcdir}/ref_wrap_iterate.h \
 	${tr1_srcdir}/repeat.h \
 	${tr1_srcdir}/stdarg.h \
+	${tr1_srcdir}/stdbool.h \
 	${tr1_srcdir}/stdint.h \
 	${tr1_srcdir}/stdio.h \
 	${tr1_srcdir}/stdlib.h \
Index: docs/html/ext/tr1.html
===================================================================
--- docs/html/ext/tr1.html	(revision 111454)
+++ docs/html/ext/tr1.html	(working copy)
@@ -1971,25 +1971,25 @@
     <tr>
       <td>8.16.1</td>
       <td>Synopsis</td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
       <td>8.16.2</td>
       <td>Definitions</td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
       <td>8.16.3</td>
       <td>Function template definitions</td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
@@ -2027,17 +2027,17 @@
     <tr>
       <td>8.20</td>
       <td>The header <code>&lt;cstdbool&gt;</code></td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
       <td>8.21</td>
       <td>The header <code>&lt;stdbool.h&gt;</code></td>
+      <td>done</td>
       <td></td>
       <td></td>
-      <td>missing</td>
       <td></td>
     </tr>
     <tr>
@@ -2307,7 +2307,7 @@
 <table width="100%" border="0">
 <tr>
   <td>
-    <!-- IGNORE DIFF -->Last modified 2006-02-07
+    <!-- IGNORE DIFF -->Last modified 2006-02-26
   </td>
   <td align="right" valign="bottom">
     <a href="http://validator.w3.org/check/referer";>
Index: testsuite/tr1/headers.cc
===================================================================
--- testsuite/tr1/headers.cc	(revision 111454)
+++ testsuite/tr1/headers.cc	(working copy)
@@ -29,6 +29,7 @@
 #include <tr1/cmath>
 #include <tr1/complex>
 #include <tr1/cstdarg>
+#include <tr1/cstdbool>
 #include <tr1/cstdint>
 #include <tr1/cstdio>
 #include <tr1/cstdlib>
@@ -44,6 +45,7 @@
 #include <tr1/math.h>
 #include <tr1/memory>
 #include <tr1/stdarg.h>
+#include <tr1/stdbool.h>
 #include <tr1/stdint.h>
 #include <tr1/stdio.h>
 #include <tr1/stdlib.h>
Index: testsuite/tr1/8_c_compatibility/cmath/templates.cc
===================================================================
--- testsuite/tr1/8_c_compatibility/cmath/templates.cc	(revision 0)
+++ testsuite/tr1/8_c_compatibility/cmath/templates.cc	(revision 0)
@@ -0,0 +1,63 @@
+// { dg-do compile }
+
+// 2006-02-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.16 Additions to header <cmath>
+
+#include <tr1/cmath>
+
+#if _GLIBCXX_USE_C99
+#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
+
+template<typename T>
+  void test01_do()
+  {
+    T x = T();
+    
+    bool ret;
+    int iret;
+
+    ret = std::tr1::signbit(x);
+    
+    iret = std::tr1::fpclassify(x);
+    
+    ret = std::tr1::isfinite(x);
+    ret = std::tr1::isinf(x);
+    ret = std::tr1::isnan(x);
+    ret = std::tr1::isnormal(x);
+    
+    ret = std::tr1::isgreater(x, x);
+    ret = std::tr1::isgreaterequal(x, x);
+    ret = std::tr1::isless(x, x);
+    ret = std::tr1::islessequal(x, x);
+    ret = std::tr1::islessgreater(x, x);
+    ret = std::tr1::isunordered(x, x);
+  }
+
+void test01()
+{
+  test01_do<float>();
+  test01_do<double>();
+  test01_do<long double>();
+}
+
+#endif
+#endif
Index: acinclude.m4
===================================================================
--- acinclude.m4	(revision 111454)
+++ acinclude.m4	(working copy)
@@ -1330,6 +1330,9 @@
               <tr1/cinttypes> in namespace std::tr1.])
   fi
 
+  # Check for the existence of the <stdbool.h> header.	
+  AC_CHECK_HEADERS(stdbool.h)
+
   AC_LANG_RESTORE
 ])
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]