diff options
author | Tom Tromey <tom@tromey.com> | 2025-03-11 13:49:30 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2025-03-18 05:32:04 -0600 |
commit | 4d5ced441ab9598001f9ce1e2b61370dd036138f (patch) | |
tree | 4e8b8a28aac13ced23dc54f34a33f77b2339d60b /gdb | |
parent | b91c25f6cd62985aa9600cc7451d717456b2a573 (diff) | |
download | binutils-4d5ced441ab9598001f9ce1e2b61370dd036138f.zip binutils-4d5ced441ab9598001f9ce1e2b61370dd036138f.tar.gz binutils-4d5ced441ab9598001f9ce1e2b61370dd036138f.tar.bz2 |
Use gdb unordered set and map in unit tests
This changes some unit test code to use gdb:unordered_set and
gdb::unordered_map.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/gdbarch-selftests.c | 5 | ||||
-rw-r--r-- | gdb/unittests/command-def-selftests.c | 5 | ||||
-rw-r--r-- | gdb/unittests/intrusive_list-selftests.c | 4 |
3 files changed, 6 insertions, 8 deletions
diff --git a/gdb/gdbarch-selftests.c b/gdb/gdbarch-selftests.c index 56ecc38..27b17d17 100644 --- a/gdb/gdbarch-selftests.c +++ b/gdb/gdbarch-selftests.c @@ -25,8 +25,7 @@ #include "gdbsupport/def-vector.h" #include "gdbarch.h" #include "scoped-mock-context.h" - -#include <map> +#include "gdbsupport/unordered_map.h" namespace selftests { @@ -131,7 +130,7 @@ register_name_test (struct gdbarch *gdbarch) scoped_mock_context<test_target_ops> mockctx (gdbarch); /* Track the number of times each register name appears. */ - std::map<const std::string, int> name_counts; + gdb::unordered_map<std::string, int> name_counts; const int num_regs = gdbarch_num_cooked_regs (gdbarch); for (auto regnum = 0; regnum < num_regs; regnum++) diff --git a/gdb/unittests/command-def-selftests.c b/gdb/unittests/command-def-selftests.c index cf51f0d..1579511 100644 --- a/gdb/unittests/command-def-selftests.c +++ b/gdb/unittests/command-def-selftests.c @@ -20,8 +20,7 @@ #include "cli/cli-cmds.h" #include "cli/cli-decode.h" #include "gdbsupport/selftest.h" - -#include <map> +#include "gdbsupport/unordered_map.h" namespace selftests { @@ -134,7 +133,7 @@ static unsigned int nr_invalid_prefixcmd = 0; /* A map associating a list with the prefix leading to it. */ -static std::map<cmd_list_element **, const char *> lists; +static gdb::unordered_map<cmd_list_element **, const char *> lists; /* Store each command list in lists, associated with the prefix to reach it. A list must only be found once. diff --git a/gdb/unittests/intrusive_list-selftests.c b/gdb/unittests/intrusive_list-selftests.c index 0bcfa62..6d624e4 100644 --- a/gdb/unittests/intrusive_list-selftests.c +++ b/gdb/unittests/intrusive_list-selftests.c @@ -20,7 +20,7 @@ #include "gdbsupport/intrusive_list.h" #include "gdbsupport/owning_intrusive_list.h" #include "gdbsupport/selftest.h" -#include <unordered_set> +#include "gdbsupport/unordered_set.h" /* Count of how many item_with_base or item_with_member objects are currently alive. */ @@ -717,7 +717,7 @@ struct intrusive_list_test item_type a ("a"), b ("b"), c ("c"); ListType list; std::vector<const item_type *> expected; - std::unordered_set<const item_type *> disposer_seen; + gdb::unordered_set<const item_type *> disposer_seen; int disposer_calls = 0; list.push_back (a); |