2007-06-26 Benjamin Kosnik <bkoz@redhat.com>
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jun 2007 15:58:45 +0000 (15:58 +0000)
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 26 Jun 2007 15:58:45 +0000 (15:58 +0000)
* testsuite/util/testsuite_api.h: New.
* testsuite/27_io/ios_base/failure: Add.
* testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc: New.
* testsuite/27_io/ios_base/failure/what-1.cc: Same.
* testsuite/27_io/ios_base/failure/what-2.cc: Same.
* testsuite/27_io/ios_base/failure/what-big.cc: Same.
* testsuite/27_io/ios_base/failure/what-3.cc: Same.
* testsuite/19_diagnostics/logic_error/
cons_virtual_derivation.cc: Same.
* testsuite/19_diagnostics/runtime_error/
cons_virtual_derivation.cc: Same.
* testsuite/18_support/bad_alloc/cons_virtual_derivation.cc: Same.
* testsuite/18_support/bad_cast/cons_virtual_derivation.cc: Same.
* testsuite/18_support/bad_exception/cons_virtual_derivation.cc: Same.
* testsuite/18_support/bad_typeid/cons_virtual_derivation.cc: Same.
* testsuite/ext/concurrence_lock_error: New.
* testsuite/ext/concurrence_lock_error/
cons_virtual_derivation.cc: Same.
* testsuite/ext/forced_exception_error: New.
* testsuite/ext/forced_exception_error/
cons_virtual_derivation.cc: Same.
* testsuite/ext/concurrence_unlock_error: New.
* testsuite/ext/concurrence_unlock_error/
cons_virtual_derivation.cc: Same.
* testsuite/20_util/function_objects/bad_function_call: New.
* testsuite/20_util/function_objects/bad_function_call/
cons_virtual_derivation.cc: Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126032 138bc75d-0d04-0410-961f-82ee72b054a4

17 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc [new file with mode: 0644]
libstdc++-v3/testsuite/util/testsuite_api.h [new file with mode: 0644]

index bfcfc77..0007aaf 100644 (file)
@@ -1,5 +1,35 @@
 2007-06-26  Benjamin Kosnik  <bkoz@redhat.com>
 
+       * testsuite/util/testsuite_api.h: New.
+       * testsuite/27_io/ios_base/failure: Add.
+       * testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc: New.
+       * testsuite/27_io/ios_base/failure/what-1.cc: Same.
+       * testsuite/27_io/ios_base/failure/what-2.cc: Same.
+       * testsuite/27_io/ios_base/failure/what-big.cc: Same.
+       * testsuite/27_io/ios_base/failure/what-3.cc: Same.
+       * testsuite/19_diagnostics/logic_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/19_diagnostics/runtime_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/18_support/bad_alloc/cons_virtual_derivation.cc: Same.
+       * testsuite/18_support/bad_cast/cons_virtual_derivation.cc: Same.
+       * testsuite/18_support/bad_exception/cons_virtual_derivation.cc: Same.
+       * testsuite/18_support/bad_typeid/cons_virtual_derivation.cc: Same.
+       * testsuite/ext/concurrence_lock_error: New.
+       * testsuite/ext/concurrence_lock_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/ext/forced_exception_error: New.
+       * testsuite/ext/forced_exception_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/ext/concurrence_unlock_error: New.
+       * testsuite/ext/concurrence_unlock_error/
+       cons_virtual_derivation.cc: Same.
+       * testsuite/20_util/function_objects/bad_function_call: New.
+       * testsuite/20_util/function_objects/bad_function_call/
+       cons_virtual_derivation.cc: Same.
+       
+2007-06-26  Benjamin Kosnik  <bkoz@redhat.com> 
+
        * include/ext/throw_allocator.h: Fixes for -fno-exceptions.
        * testsuite/util/testsuite_shared.cc: Same.
        * testsuite/util/io/illegal_input_error.hpp: Same.
diff --git a/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_alloc/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..dd0d09b
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <new>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::bad_alloc test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_cast/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..4efc346
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <typeinfo>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::bad_cast test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_exception/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..b66ce7d
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <exception>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::bad_exception test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/18_support/bad_typeid/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..0da3c9d
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <typeinfo>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::bad_typeid test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/logic_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..5c936e2
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <stdexcept>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::logic_error test_type;
+  __gnu_test::diamond_derivation<test_type, false>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/runtime_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..86d5bb5
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <stdexcept>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::runtime_error test_type;
+  __gnu_test::diamond_derivation<test_type, false>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..6cc46c0
--- /dev/null
@@ -0,0 +1,31 @@
+// { dg-do run { xfail *-*-* } }
+// { dg-options "-std=gnu++0x" }
+// 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 <functional>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::bad_function_call test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..1819726
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <ios>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef std::ios_base::failure test_type;
+  __gnu_test::diamond_derivation<test_type, false>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc
new file mode 100644 (file)
index 0000000..1845d98
--- /dev/null
@@ -0,0 +1,59 @@
+// 2001-02-26 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/1972
+void test01()
+{
+  bool test __attribute__((unused)) = true;
+  std::string s("lack of sunlight, no water error");
+
+  // 1
+  std::ios_base::failure obj1 = std::ios_base::failure(s);
+
+  // 2
+  std::ios_base::failure obj2(s);
+
+  VERIFY( std::strcmp(obj1.what(), s.data()) == 0 );
+  VERIFY( std::strcmp(obj2.what(), s.data()) == 0 );
+}
+
+void test02()
+{
+  bool test __attribute__((unused)) = true;
+  std::string s("lack of sunlight error");
+  std::range_error x(s);
+  
+  VERIFY( std::strcmp(x.what(), s.data()) == 0 );
+}
+
+int main(void)
+{
+  test01();
+  test02();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc
new file mode 100644 (file)
index 0000000..74fc46b
--- /dev/null
@@ -0,0 +1,51 @@
+// 2001-02-26 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#include <cstring>
+#include <testsuite_hooks.h>
+
+// libstdc++/2089
+class fuzzy_logic : public std::ios_base::failure
+{
+public:
+  fuzzy_logic() : std::ios_base::failure("whoa") { }
+};
+
+void test03()
+{
+  bool test __attribute__((unused)) = true;
+  try
+    { throw fuzzy_logic(); }
+  catch(const fuzzy_logic& obj)
+    { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); }
+  catch(...)
+    { VERIFY( false ); }
+}
+
+int main(void)
+{
+  test03();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc
new file mode 100644 (file)
index 0000000..a8dd535
--- /dev/null
@@ -0,0 +1,71 @@
+// 2001-02-26 Benjamin Kosnik  <bkoz@redhat.com>
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 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.
+
+// 19.1 Exception classes
+
+#include <string>
+#include <ios>
+#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::ios_base::failure obj1(s);
+  
+  // block 01
+  {
+    const std::string s2(strlit1);
+    std::ios_base::failure obj2(s2);
+    obj1 = obj2;
+  }
+  allocate_on_stack();
+  VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); 
+
+  // block 02
+  {
+    const std::string s3(strlit2);
+    std::ios_base::failure obj3 = std::ios_base::failure(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/27_io/ios_base/failure/what-big.cc b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc
new file mode 100644 (file)
index 0000000..1af7335
--- /dev/null
@@ -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 <ios>
+#include <testsuite_hooks.h>
+
+// Can construct and return 10k character error string.
+void test01()
+{
+  typedef std::ios_base::failure 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/ext/concurrence_lock_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/concurrence_lock_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..07396b0
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <ext/concurrence.h>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef __gnu_cxx::__concurrence_lock_error test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/concurrence_unlock_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..ddc2c46
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <ext/concurrence.h>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef __gnu_cxx::__concurrence_unlock_error test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc
new file mode 100644 (file)
index 0000000..4ce8c67
--- /dev/null
@@ -0,0 +1,30 @@
+// { dg-do run { xfail *-*-* } }
+// 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 <ext/throw_allocator.h>
+#include <testsuite_api.h>
+
+int main()
+{
+  typedef __gnu_cxx::forced_exception_error test_type;
+  __gnu_test::diamond_derivation<test_type, true>::test();
+  return 0;
+}
diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h
new file mode 100644 (file)
index 0000000..143ac67
--- /dev/null
@@ -0,0 +1,81 @@
+// -*- C++ -*-
+// Exception testing utils for the C++ library testsuite. 
+//
+// 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.
+//
+// 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.
+
+#include <testsuite_hooks.h>
+
+#ifndef _TESTSUITE_EH
+#define _TESTSUITE_EH 1
+
+namespace __gnu_test
+{
+  // Checks for virtual public derivation in exception classes.
+  // See:
+  // http://www.boost.org/more/error_handling.html
+  struct bad_non_virtual : virtual public std::exception { };
+
+  template<typename Exception, bool DefaultCons>
+    struct diamond_derivation_base;
+
+  template<typename Exception>
+    struct diamond_derivation_base<Exception, true>
+    {
+      struct diamond_derivation_error: bad_non_virtual, Exception
+      {
+       diamond_derivation_error() : bad_non_virtual(), Exception() { }
+      };
+    };
+
+  template<typename Exception>
+    struct diamond_derivation_base<Exception, false>
+    {
+      struct diamond_derivation_error: bad_non_virtual, Exception
+      {
+       diamond_derivation_error()
+       : bad_non_virtual(), Exception("construct diamond") { }
+      };
+    };
+  
+  template<typename Exception, bool DefaultCons>
+    struct diamond_derivation: diamond_derivation_base<Exception, DefaultCons>
+    {
+      typedef diamond_derivation_base<Exception, DefaultCons> base_type;
+      typedef typename base_type::diamond_derivation_error error_type;
+      
+      static void test()
+      {
+       bool test __attribute__((unused)) = true;      
+       try { throw error_type(); }
+       catch (std::exception const& e) { }
+       catch (...) 
+         { VERIFY( false ); }
+      }
+    };
+}
+#endif