Merge "Remove cdecl cruft." into main
diff --git a/benchmarks/bionic_benchmarks.cpp b/benchmarks/bionic_benchmarks.cpp
index 81f1842..b88c6e5 100644
--- a/benchmarks/bionic_benchmarks.cpp
+++ b/benchmarks/bionic_benchmarks.cpp
@@ -372,7 +372,7 @@
void RegisterGoogleBenchmarks(bench_opts_t primary_opts, bench_opts_t secondary_opts,
const std::string& fn_name, args_vector_t* run_args) {
- if (g_str_to_func.find(fn_name) == g_str_to_func.end()) {
+ if (!g_str_to_func.contains(fn_name)) {
errx(1, "ERROR: No benchmark for function %s", fn_name.c_str());
}
long iterations_to_use = primary_opts.num_iterations ? primary_opts.num_iterations :
diff --git a/linker/linker.cpp b/linker/linker.cpp
index 8b467a3..e13d37d 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -3595,7 +3595,7 @@
// 2. Initialize other namespaces
for (auto& ns_config : namespace_configs) {
- if (namespaces.find(ns_config->name()) != namespaces.end()) {
+ if (namespaces.contains(ns_config->name())) {
continue;
}
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index ad40c50..70430b8 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -304,7 +304,7 @@
}
if (result == ConfigParser::kPropertyAssign) {
- if (properties->find(name) != properties->end()) {
+ if (properties->contains(name)) {
DL_WARN("%s:%zd: warning: redefining property \"%s\" (overriding previous value)",
ld_config_file_path,
cp.lineno(),
@@ -313,7 +313,7 @@
(*properties)[name] = PropertyValue(std::move(value), cp.lineno());
} else if (result == ConfigParser::kPropertyAppend) {
- if (properties->find(name) == properties->end()) {
+ if (!properties->contains(name)) {
DL_WARN("%s:%zd: warning: appending to undefined property \"%s\" (treating as assignment)",
ld_config_file_path,
cp.lineno(),
@@ -526,7 +526,7 @@
properties.get_strings(property_name_prefix + ".links", &lineno);
for (const auto& linked_ns_name : linked_namespaces) {
- if (namespace_configs.find(linked_ns_name) == namespace_configs.end()) {
+ if (!namespace_configs.contains(linked_ns_name)) {
*error_msg = create_error_msg(ld_config_file_path,
lineno,
std::string("undefined namespace: ") + linked_ns_name);
diff --git a/linker/linker_namespaces.cpp b/linker/linker_namespaces.cpp
index 5182129..eb9dae9 100644
--- a/linker/linker_namespaces.cpp
+++ b/linker/linker_namespaces.cpp
@@ -100,7 +100,7 @@
// be searched.
if (allow_secondary) {
const android_namespace_list_t& secondary_namespaces = si->get_secondary_namespaces();
- if (secondary_namespaces.find(this) != secondary_namespaces.end()) {
+ if (secondary_namespaces.contains(this)) {
return true;
}
}
diff --git a/linker/linker_soinfo.cpp b/linker/linker_soinfo.cpp
index 802c06a..d915503 100644
--- a/linker/linker_soinfo.cpp
+++ b/linker/linker_soinfo.cpp
@@ -887,7 +887,7 @@
handle_ = handle_ | 1;
} while (handle_ == reinterpret_cast<uintptr_t>(RTLD_DEFAULT) ||
handle_ == reinterpret_cast<uintptr_t>(RTLD_NEXT) ||
- g_soinfo_handles_map.find(handle_) != g_soinfo_handles_map.end());
+ g_soinfo_handles_map.contains(handle_));
g_soinfo_handles_map[handle_] = this;
}
diff --git a/tests/dirent_test.cpp b/tests/dirent_test.cpp
index 4d21246..cde2d11 100644
--- a/tests/dirent_test.cpp
+++ b/tests/dirent_test.cpp
@@ -33,11 +33,11 @@
static void CheckProcSelf(std::set<std::string>& names) {
// We have a good idea of what should be in /proc/self.
- ASSERT_TRUE(names.find(".") != names.end());
- ASSERT_TRUE(names.find("..") != names.end());
- ASSERT_TRUE(names.find("cmdline") != names.end());
- ASSERT_TRUE(names.find("fd") != names.end());
- ASSERT_TRUE(names.find("stat") != names.end());
+ ASSERT_TRUE(names.contains("."));
+ ASSERT_TRUE(names.contains(".."));
+ ASSERT_TRUE(names.contains("cmdline"));
+ ASSERT_TRUE(names.contains("fd"));
+ ASSERT_TRUE(names.contains("stat"));
}
template <typename DirEntT>
diff --git a/tests/ifaddrs_test.cpp b/tests/ifaddrs_test.cpp
index b3ab94d..da64770 100644
--- a/tests/ifaddrs_test.cpp
+++ b/tests/ifaddrs_test.cpp
@@ -137,7 +137,7 @@
sockaddr_in* sock = reinterpret_cast<sockaddr_in*>(&ifr.ifr_addr);
in_addr_t addr = sock->sin_addr.s_addr;
- EXPECT_TRUE(addrs.find(addr) != addrs.end()) << if_name << ' ' << std::hex << ntohl(addr);
+ EXPECT_TRUE(addrs.contains(addr)) << if_name << ' ' << std::hex << ntohl(addr);
}
TEST(ifaddrs, getifaddrs_INET) {
diff --git a/tests/link_test.cpp b/tests/link_test.cpp
index 127a3d9..ae3a1cd 100644
--- a/tests/link_test.cpp
+++ b/tests/link_test.cpp
@@ -195,7 +195,7 @@
}
void AddModule(dl_phdr_info* info, size_t s) {
ASSERT_EQ(sizeof(dl_phdr_info), s);
- ASSERT_TRUE(dl_iter_mods.find(info->dlpi_addr) == dl_iter_mods.end());
+ ASSERT_FALSE(dl_iter_mods.contains(info->dlpi_addr));
ASSERT_TRUE(info->dlpi_name != nullptr);
dl_iter_mods[info->dlpi_addr] = {
.name = info->dlpi_name,
diff --git a/tests/stack_protector_test.cpp b/tests/stack_protector_test.cpp
index aea791c..5817a27 100644
--- a/tests/stack_protector_test.cpp
+++ b/tests/stack_protector_test.cpp
@@ -48,7 +48,7 @@
printf("[thread %d] TLS stack guard = %p\n", tid, guard);
// Duplicate tid. gettid(2) bug? Seeing this would be very upsetting.
- ASSERT_TRUE(tids.find(tid) == tids.end());
+ ASSERT_FALSE(tids.contains(tid));
// Uninitialized guard. Our bug. Note this is potentially flaky; we _could_
// get four random zero bytes, but it should be vanishingly unlikely.
diff --git a/tools/versioner/src/versioner.cpp b/tools/versioner/src/versioner.cpp
index 5afa00b..320c19c 100644
--- a/tools/versioner/src/versioner.cpp
+++ b/tools/versioner/src/versioner.cpp
@@ -142,7 +142,7 @@
auto new_end = std::remove_if(headers.begin(), headers.end(), [&arch](llvm::StringRef header) {
for (const auto& it : ignored_headers) {
- if (it.second.find(arch) == it.second.end()) {
+ if (!it.second.contains(arch)) {
continue;
}