From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Fix some more warnings in test
Date: Sat, 31 Oct 2020 00:21:47 +0000 [thread overview]
Message-ID: <20201031002147.GA2676789@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 170 bytes --]
libstdc++-v3/ChangeLog:
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc:
Avoid -Wcatch-value warnings.
Tested powerpc64le-linux. Committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 4452 bytes --]
commit d1e5d82af819025df9d9a81e8c591690e299924a
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Oct 30 10:47:25 2020
libstdc++: Fix some more warnings in test
libstdc++-v3/ChangeLog:
* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc:
Avoid -Wcatch-value warnings.
diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc
index 36d681528650..5a714873f0d7 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc
@@ -59,14 +59,14 @@ void test01()
{ }
catch(std::exception&)
{ ++myexit; }
-
+
// When doubling is too big, but smaller is sufficient, the resize
// should do smaller and be happy. It certainly shouldn't throw
// other exceptions or crash.
try
{
std::vector<bool> x;
- x.resize(x.max_size() / 2 + 1, false);
+ x.resize(x.max_size() / 2 + 1, false);
for(int i = 0; i < _S_word_bit; ++i)
x.push_back(false);
check_cap_ge_size(x);
@@ -75,11 +75,11 @@ void test01()
{ }
catch(std::exception&)
{ ++myexit; }
-
+
try
{
std::vector<bool> x;
- x.resize(x.max_size() / 2 + 1, false);
+ x.resize(x.max_size() / 2 + 1, false);
x.insert(x.end(), _S_word_bit, false);
check_cap_ge_size(x);
}
@@ -87,11 +87,11 @@ void test01()
{ }
catch(std::exception&)
{ ++myexit; }
-
+
try
{
std::vector<bool> x;
- x.resize(x.max_size() / 2 + 1, false);
+ x.resize(x.max_size() / 2 + 1, false);
std::vector<bool> y(_S_word_bit, false);
x.insert(x.end(), y.begin(), y.end());
check_cap_ge_size(x);
@@ -106,7 +106,7 @@ void test01()
try
{
std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
+ x.resize(x.max_size() - _S_word_bit, false);
for(int i = 0; i < _S_word_bit; ++i)
x.push_back(false);
check_cap_ge_size(x);
@@ -115,11 +115,11 @@ void test01()
{ }
catch(std::exception&)
{ ++myexit; }
-
+
try
{
std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
+ x.resize(x.max_size() - _S_word_bit, false);
x.insert(x.end(), _S_word_bit, false);
check_cap_ge_size(x);
}
@@ -131,7 +131,7 @@ void test01()
try
{
std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
+ x.resize(x.max_size() - _S_word_bit, false);
std::vector<bool> y(_S_word_bit, false);
x.insert(x.end(), y.begin(), y.end());
check_cap_ge_size(x);
@@ -140,51 +140,51 @@ void test01()
{ }
catch(std::exception&)
{ ++myexit; }
-
+
// Attempts to put in more than max_size() items should result in a
// length error.
try
{
std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
+ x.resize(x.max_size() - _S_word_bit, false);
for(int i = 0; i < _S_word_bit + 1; ++i)
x.push_back(false);
++myexit;
}
- catch(std::bad_alloc)
+ catch(std::bad_alloc&)
{ }
- catch(std::length_error)
+ catch(std::length_error&)
{ }
- catch(std::exception)
- { ++myexit; }
-
- try
- {
- std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
- x.insert(x.end(), _S_word_bit + 1, false);
- ++myexit;
- }
- catch(std::bad_alloc)
- { }
- catch(std::length_error)
- { }
- catch(std::exception)
+ catch(std::exception&)
{ ++myexit; }
try
{
std::vector<bool> x;
- x.resize(x.max_size() - _S_word_bit, false);
+ x.resize(x.max_size() - _S_word_bit, false);
+ x.insert(x.end(), _S_word_bit + 1, false);
+ ++myexit;
+ }
+ catch(std::bad_alloc&)
+ { }
+ catch(std::length_error&)
+ { }
+ catch(std::exception&)
+ { ++myexit; }
+
+ try
+ {
+ std::vector<bool> x;
+ x.resize(x.max_size() - _S_word_bit, false);
std::vector<bool> y(_S_word_bit + 1, false);
x.insert(x.end(), y.begin(), y.end());
++myexit;
}
- catch(std::bad_alloc)
+ catch(std::bad_alloc&)
{ }
- catch(std::length_error)
+ catch(std::length_error&)
{ }
- catch(std::exception)
+ catch(std::exception&)
{ ++myexit; }
VERIFY( !myexit );
reply other threads:[~2020-10-31 0:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201031002147.GA2676789@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).