summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-01 17:03:22 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-01 17:03:22 +0000
commitf5d16d55b4f237b5bc9cdb50da61ca639a60f94d (patch)
tree2e6d25df053819c91aa4d7a351c24b78ad8aea1f /libstdc++-v3
parent4e7a1eb86a1b273d882474a660fb9a332b91c5c8 (diff)
downloadgcc-f5d16d55b4f237b5bc9cdb50da61ca639a60f94d.tar.gz
2007-06-01 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/19_diagnostics/logic_error/what-big.cc: New. * testsuite/19_diagnostics/logic_error/what-3.cc: Same. * testsuite/19_diagnostics/runtime_error/what-big.cc: Same. * testsuite/19_diagnostics/runtime_error/what-3.cc: Same. * testsuite/18_support/14493.cc: Break into... * testsuite/18_support/exception/what.cc: ...this. * testsuite/18_support/bad_cast/what.cc: ...this. * testsuite/18_support/bad_alloc/what.cc: ...this. * testsuite/18_support/bad_typeid/what.cc: ...this. * testsuite/18_support/bad_exception/what.cc: ...this. * testsuite/19_diagnostics/bad_exception/23591_thread-1.c: Move... * testsuite/18_support/bad_exception/23591_thread-1.c: ...here. * testsuite/18_support/14026.cc: Move... * testsuite/18_support/uncaught_exception/14026.cc: ...here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125267 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog20
-rw-r--r--libstdc++-v3/testsuite/18_support/14026.cc34
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_alloc/what.cc41
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_cast/what.cc41
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c (renamed from libstdc++-v3/testsuite/19_diagnostics/bad_exception/23591_thread-1.c)0
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_exception/what.cc (renamed from libstdc++-v3/testsuite/18_support/14493.cc)12
-rw-r--r--libstdc++-v3/testsuite/18_support/bad_typeid/what.cc41
-rw-r--r--libstdc++-v3/testsuite/18_support/exception/what.cc41
-rw-r--r--libstdc++-v3/testsuite/18_support/uncaught_exception/14026.cc54
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc69
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc41
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc3
-rw-r--r--libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc41
13 files changed, 391 insertions, 47 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 463cbf6304c..6507c5f63aa 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,4 +1,24 @@
2007-06-01 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/19_diagnostics/logic_error/what-big.cc: New.
+ * testsuite/19_diagnostics/logic_error/what-3.cc: Same.
+ * testsuite/19_diagnostics/runtime_error/what-big.cc: Same.
+ * testsuite/19_diagnostics/runtime_error/what-3.cc: Same.
+
+ * testsuite/18_support/14493.cc: Break into...
+ * testsuite/18_support/exception/what.cc: ...this.
+ * testsuite/18_support/bad_cast/what.cc: ...this.
+ * testsuite/18_support/bad_alloc/what.cc: ...this.
+ * testsuite/18_support/bad_typeid/what.cc: ...this.
+ * testsuite/18_support/bad_exception/what.cc: ...this.
+
+ * testsuite/19_diagnostics/bad_exception/23591_thread-1.c: Move...
+ * testsuite/18_support/bad_exception/23591_thread-1.c: ...here.
+
+ * testsuite/18_support/14026.cc: Move...
+ * testsuite/18_support/uncaught_exception/14026.cc: ...here.
+
+2007-06-01 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/throw_allocator.h (__throw_allocator::allocate):
Throw bad_alloc for out of memory conditions.
diff --git a/libstdc++-v3/testsuite/18_support/14026.cc b/libstdc++-v3/testsuite/18_support/14026.cc
deleted file mode 100644
index 103ac64a9d7..00000000000
--- a/libstdc++-v3/testsuite/18_support/14026.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// PR 14026
-// 18.6.4 uncaught_exception
-
-#include <cstdlib>
-#include <exception>
-#include <testsuite_hooks.h>
-
-static void
-no_uncaught ()
-{
- if (std::uncaught_exception ())
- abort ();
-}
-
-int
-main ()
-{
- try
- {
- throw 1;
- }
- catch (...)
- {
- try
- {
- throw;
- }
- catch (...)
- {
- no_uncaught ();
- }
- }
- no_uncaught ();
-}
diff --git a/libstdc++-v3/testsuite/18_support/bad_alloc/what.cc b/libstdc++-v3/testsuite/18_support/bad_alloc/what.cc
new file mode 100644
index 00000000000..3beb3bd1c42
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/bad_alloc/what.cc
@@ -0,0 +1,41 @@
+// 2007-01-30 Paolo Carlini <pcarlini@suse.de>
+
+// 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
+// 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.
+
+#include <new>
+#include <typeinfo>
+#include <exception>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/14493
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ bad_alloc ba;
+ VERIFY( !strcmp(ba.what(), "std::bad_alloc") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/bad_cast/what.cc b/libstdc++-v3/testsuite/18_support/bad_cast/what.cc
new file mode 100644
index 00000000000..e22495f611d
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/bad_cast/what.cc
@@ -0,0 +1,41 @@
+// 2007-01-30 Paolo Carlini <pcarlini@suse.de>
+
+// 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
+// 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.
+
+#include <new>
+#include <typeinfo>
+#include <exception>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/14493
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ bad_cast bc;
+ VERIFY( !strcmp(bc.what(), "std::bad_cast") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/bad_exception/23591_thread-1.c b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c
index 8c953eaed0e..8c953eaed0e 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/bad_exception/23591_thread-1.c
+++ b/libstdc++-v3/testsuite/18_support/bad_exception/23591_thread-1.c
diff --git a/libstdc++-v3/testsuite/18_support/14493.cc b/libstdc++-v3/testsuite/18_support/bad_exception/what.cc
index 188bad7d497..a18bafe7787 100644
--- a/libstdc++-v3/testsuite/18_support/14493.cc
+++ b/libstdc++-v3/testsuite/18_support/bad_exception/what.cc
@@ -30,18 +30,6 @@ void test01()
bool test __attribute__((unused)) = true;
using namespace std;
- bad_alloc ba;
- VERIFY( !strcmp(ba.what(), "std::bad_alloc") );
-
- bad_cast bc;
- VERIFY( !strcmp(bc.what(), "std::bad_cast") );
-
- bad_typeid bt;
- VERIFY( !strcmp(bt.what(), "std::bad_typeid") );
-
- exception e;
- VERIFY( !strcmp(e.what(), "std::exception") );
-
bad_exception be;
VERIFY( !strcmp(be.what(), "std::bad_exception") );
}
diff --git a/libstdc++-v3/testsuite/18_support/bad_typeid/what.cc b/libstdc++-v3/testsuite/18_support/bad_typeid/what.cc
new file mode 100644
index 00000000000..4e8d9a86893
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/bad_typeid/what.cc
@@ -0,0 +1,41 @@
+// 2007-01-30 Paolo Carlini <pcarlini@suse.de>
+
+// 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
+// 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.
+
+#include <new>
+#include <typeinfo>
+#include <exception>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/14493
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ bad_typeid bt;
+ VERIFY( !strcmp(bt.what(), "std::bad_typeid") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/exception/what.cc b/libstdc++-v3/testsuite/18_support/exception/what.cc
new file mode 100644
index 00000000000..d328bb77f18
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception/what.cc
@@ -0,0 +1,41 @@
+// 2007-01-30 Paolo Carlini <pcarlini@suse.de>
+
+// 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
+// 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.
+
+#include <new>
+#include <typeinfo>
+#include <exception>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/14493
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ exception e;
+ VERIFY( !strcmp(e.what(), "std::exception") );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/uncaught_exception/14026.cc b/libstdc++-v3/testsuite/18_support/uncaught_exception/14026.cc
new file mode 100644
index 00000000000..d6948906d41
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/uncaught_exception/14026.cc
@@ -0,0 +1,54 @@
+// Copyright (C) 2004, 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
+// 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.
+
+// PR 14026
+// 18.6.4 uncaught_exception
+
+#include <cstdlib>
+#include <exception>
+#include <testsuite_hooks.h>
+
+static void
+no_uncaught ()
+{
+ if (std::uncaught_exception())
+ abort();
+}
+
+int
+main()
+{
+ try
+ {
+ throw 1;
+ }
+ catch (...)
+ {
+ try
+ {
+ throw;
+ }
+ catch (...)
+ {
+ no_uncaught ();
+ }
+ }
+ no_uncaught();
+
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
new file mode 100644
index 00000000000..4dbad0d2709
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-3.cc
@@ -0,0 +1,69 @@
+// { dg-options "-std=gnu++0x" }
+
+// 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
+// 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.
+
+#include <string>
+#include <stdexcept>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// test copy ctors, assignment operators, and persistence of member string data
+// libstdc++/1972
+// via Greg Bumgardner <bumgard@roguewave.com>
+void allocate_on_stack(void)
+{
+ const size_t num = 512;
+ __extension__ char array[num];
+ for (size_t i = 0; i < num; i++)
+ array[i]=0;
+}
+
+void test04()
+{
+ bool test __attribute__((unused)) = true;
+ const std::string s("CA ISO emergency once again:immediate power down");
+ const char* strlit1 = "wish I lived in Palo Alto";
+ const char* strlit2 = "...or Santa Barbara";
+ std::logic_error obj1(s);
+
+ // block 01
+ {
+ const std::string s2(strlit1);
+ std::logic_error obj2(s2);
+ obj1 = obj2;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit1, obj1.what()) == 0 );
+
+ // block 02
+ {
+ const std::string s3(strlit2);
+ std::logic_error obj3 = std::logic_error(s3);
+ obj1 = obj3;
+ }
+ allocate_on_stack();
+ VERIFY( std::strcmp(strlit2, obj1.what()) == 0 );
+}
+
+int main(void)
+{
+ test04();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc
new file mode 100644
index 00000000000..681e2a364b1
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/logic_error/what-big.cc
@@ -0,0 +1,41 @@
+// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
+
+// 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
+// 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.
+
+#include <cstring>
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+ typedef std::logic_error test_type;
+
+ bool test __attribute__((unused)) = true;
+ const std::string xxx(10000, 'x');
+ test_type t(xxx);
+ VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
index 04b85c0c5fe..63cb4816322 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-3.cc
@@ -26,7 +26,7 @@
#include <cstring>
#include <testsuite_hooks.h>
-// test copy ctors and assignment operators
+// test copy ctors, assignment operators, and persistence of member string data
// libstdc++/1972
// via Greg Bumgardner <bumgard@roguewave.com>
void allocate_on_stack(void)
@@ -36,6 +36,7 @@ void allocate_on_stack(void)
for (size_t i = 0; i < num; i++)
array[i]=0;
}
+
void test04()
{
bool test __attribute__((unused)) = true;
diff --git a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc
new file mode 100644
index 00000000000..c0ce964f6f8
--- /dev/null
+++ b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/what-big.cc
@@ -0,0 +1,41 @@
+// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com>
+
+// 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
+// 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.
+
+#include <cstring>
+#include <string>
+#include <stdexcept>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+ typedef std::runtime_error test_type;
+
+ bool test __attribute__((unused)) = true;
+ const std::string xxx(10000, 'x');
+ test_type t(xxx);
+ VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 );
+}
+
+int main(void)
+{
+ test01();
+ return 0;
+}