From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../ios_base/failure/cons_virtual_derivation.cc | 28 +++++++++ .../testsuite/27_io/ios_base/failure/what-1.cc | 59 ++++++++++++++++++ .../testsuite/27_io/ios_base/failure/what-2.cc | 50 +++++++++++++++ .../testsuite/27_io/ios_base/failure/what-3.cc | 72 ++++++++++++++++++++++ .../testsuite/27_io/ios_base/failure/what-big.cc | 40 ++++++++++++ 5 files changed, 249 insertions(+) create mode 100644 libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc create mode 100644 libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc create mode 100644 libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc create mode 100644 libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc create mode 100644 libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc (limited to 'libstdc++-v3/testsuite/27_io/ios_base/failure') 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 index 000000000..fbf52b0fa --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/cons_virtual_derivation.cc @@ -0,0 +1,28 @@ +// 2007-05-29 Benjamin Kosnik + +// Copyright (C) 2007, 2008, 2009 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 3, 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 COPYING3. If not see +// . + +#include +#include + +int main() +{ + typedef std::ios_base::failure test_type; + __gnu_test::diamond_derivation::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 index 000000000..7b5e1945c --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-1.cc @@ -0,0 +1,59 @@ +// 2001-02-26 Benjamin Kosnik + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 +// 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 3, 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 COPYING3. If not see +// . + +// 19.1 Exception classes + +#include +#include +#include +#include +#include + +// 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 index 000000000..50e30a260 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-2.cc @@ -0,0 +1,50 @@ +// 2001-02-26 Benjamin Kosnik + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 +// 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 3, 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 COPYING3. If not see +// . + +// 19.1 Exception classes + +#include +#include +#include +#include + +// 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 index 000000000..ddb29c5ef --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-3.cc @@ -0,0 +1,72 @@ +// 2001-02-26 Benjamin Kosnik + +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 +// 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 3, 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 COPYING3. If not see +// . + +// 19.1 Exception classes + +#include +#include +#include +#include + +// test copy ctors, assignment operators, and persistence of member string data +// libstdc++/1972 +// via Greg Bumgardner +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; + for (size_t i = 0; i < num; i++) + array[i]=array[i]; // Suppress unused warning. +} + +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 index 000000000..18f5a6a94 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/ios_base/failure/what-big.cc @@ -0,0 +1,40 @@ +// 2007-05-29 Benjamin Kosnik + +// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see +// . + +#include +#include +#include +#include + +// 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; +} -- cgit v1.2.3