From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1725) id 3C25B386F00B; Tue, 18 Aug 2020 18:16:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3C25B386F00B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597774605; bh=oUonngTbMtuPt/TJmPvJHq0VgYptQYgisPq8wtMd7D8=; h=From:To:Subject:Date:From; b=ZRyv2hN+yMN4GotIxzB1BX1ZaKyiVhON0Gii+Ums2CyFLDWZrQlVSHJwZjg6kfV/m I4p79fVdUElKrAAtpzFWPwJ3QEenGbjoHHZoY/crJ2+9g7ha6QisA2IC8XsKqd9s9P UAkIbon7D3n42VPNROanOKPuIywj22EDY7li30VY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: William Schmidt To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/users/wschmidt/heads/builtins3)] libstdc++: Make testsuite usable with -fno-exceptions X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/users/wschmidt/heads/builtins3 X-Git-Oldrev: 7d4ee8bc5843997cdc4408848ab2d9ec82f085b2 X-Git-Newrev: 4c27c6584d0c15926f57ac40f931e238cf0b3110 Message-Id: <20200818181645.3C25B386F00B@sourceware.org> Date: Tue, 18 Aug 2020 18:16:45 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2020 18:16:45 -0000 https://gcc.gnu.org/g:4c27c6584d0c15926f57ac40f931e238cf0b3110 commit 4c27c6584d0c15926f57ac40f931e238cf0b3110 Author: Jonathan Wakely Date: Thu Jul 30 12:23:54 2020 +0100 libstdc++: Make testsuite usable with -fno-exceptions Previously it was not possible to add -fno-exceptions to the testsuite flags, because some files that are compiled by the v3-build_support procedure failed with exceptions disabled. This adjusts those files to still compile without exceptions (with degraded functionality in some cases). The sole testcase that explicitly checks for -fno-exceptions has also been adjusted to use the more robust exceptions_enabled effective-target keyword from gcc/testsuite/lib/target-supports.exp. libstdc++-v3/ChangeLog: * testsuite/23_containers/vector/bool/72847.cc: Use the exceptions_enabled effective-target keyword instead of checking for an explicit -fno-exceptions option. * testsuite/util/testsuite_abi.cc (examine_symbol): Remove redundant try-catch. * testsuite/util/testsuite_allocator.h [!__cpp_exceptions]: Do not define check_allocate_max_size and memory_resource. * testsuite/util/testsuite_containers.h: Replace comment with #error if wrong standard dialect used. * testsuite/util/testsuite_shared.cc: Likewise. Diff: --- libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc | 2 +- libstdc++-v3/testsuite/util/testsuite_abi.cc | 11 +++-------- libstdc++-v3/testsuite/util/testsuite_allocator.h | 4 +++- libstdc++-v3/testsuite/util/testsuite_containers.h | 5 +++-- libstdc++-v3/testsuite/util/testsuite_shared.cc | 7 +++++-- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc index 26260e762af..c4fbc75abe8 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/72847.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // . -// { dg-skip-if "" { *-*-* } { "-fno-exceptions" } } +// { dg-require-effective-target exceptions_enabled } #include #include diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc index fd8224b6789..f4bd319855a 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc @@ -362,14 +362,9 @@ get_symbol(const string& name, const symbols& s) void examine_symbol(const char* name, const char* file) { - try - { - symbols s = create_symbols(file); - const symbol& sym = get_symbol(name, s); - sym.print(); - } - catch(...) - { __throw_exception_again; } + symbols s = create_symbols(file); + const symbol& sym = get_symbol(name, s); + sym.print(); } int diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index e52ef788467..e030ed5500c 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -257,6 +257,7 @@ namespace __gnu_test return true; } +#if __cpp_exceptions template bool check_allocate_max_size() @@ -276,6 +277,7 @@ namespace __gnu_test } throw; } +#endif // A simple allocator which can be constructed endowed of a given // "personality" (an integer), queried in operator== to simulate the @@ -761,7 +763,7 @@ namespace __gnu_test #endif // C++11 #if __cplusplus >= 201703L -#if __cpp_aligned_new && __cpp_rtti +#if __cpp_aligned_new && __cpp_rtti && __cpp_exceptions // A concrete memory_resource, with error checking. class memory_resource : public std::pmr::memory_resource { diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h b/libstdc++-v3/testsuite/util/testsuite_containers.h index 8566af17c4a..33259ae3601 100644 --- a/libstdc++-v3/testsuite/util/testsuite_containers.h +++ b/libstdc++-v3/testsuite/util/testsuite_containers.h @@ -408,8 +408,9 @@ namespace __gnu_test void erase_external_iterators(std::multimap& s); -// NB: "must be compiled with C++11" -#if __cplusplus >= 201103L +#if __cplusplus < 201103L +# error "must be compiled with C++11 (or later)" +#else template void linkage_check_cxx98_cxx11_erase(_Tp& container) diff --git a/libstdc++-v3/testsuite/util/testsuite_shared.cc b/libstdc++-v3/testsuite/util/testsuite_shared.cc index b0458dd33d3..eabff4c25c5 100644 --- a/libstdc++-v3/testsuite/util/testsuite_shared.cc +++ b/libstdc++-v3/testsuite/util/testsuite_shared.cc @@ -45,12 +45,14 @@ try_allocation() extern "C" void try_throw_exception() { +#if __cpp_exceptions try { std::__throw_bad_exception(); } catch (const std::exception& e) { } +#endif } extern "C" void @@ -75,8 +77,9 @@ try_function_random_fail() std::__throw_bad_exception(); } -#if __cplusplus < 201103L -// "must be compiled with C++98" +#if __cplusplus >= 201103L +# error "must be compiled with C++98" +#else void erase_external(std::set& s) { s.erase(s.begin()); }