aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/CPUUtils.cpp
diff options
context:
space:
mode:
authorMichalis Spyrou <michalis.spyrou@arm.com>2019-05-01 13:03:59 +0100
committerMichalis Spyrou <michalis.spyrou@arm.com>2019-05-10 14:42:02 +0100
commit9d0b5f82c2734444145718f12788f2dde436ef45 (patch)
treeb4771f8043f3da4af07c6f33fd803cdfcc394a20 /src/runtime/CPUUtils.cpp
parent4bcef43cb5665167c128f3e43f69239889ee34bc (diff)
downloadComputeLibrary-9d0b5f82c2734444145718f12788f2dde436ef45.tar.gz
COMPMID-2177 Fix clang warnings
Change-Id: I78039db8c58d7b14a042c41e54c25fb9cb509bf7 Signed-off-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-on: https://review.mlplatform.org/c/1092 Reviewed-by: VidhyaSudhan Loganathan <vidhyasudhan.loganathan@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/runtime/CPUUtils.cpp')
-rw-r--r--src/runtime/CPUUtils.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/runtime/CPUUtils.cpp b/src/runtime/CPUUtils.cpp
index f3355a740b..f7240db99e 100644
--- a/src/runtime/CPUUtils.cpp
+++ b/src/runtime/CPUUtils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -54,16 +54,16 @@
/* Make sure the bits we care about are defined, just in case asm/hwcap.h is
* out of date (or for bare metal mode) */
#ifndef HWCAP_ASIMDHP
-#define HWCAP_ASIMDHP (1 << 10)
-#endif /* HWCAP_ASIMDHP */
+#define HWCAP_ASIMDHP (1 << 10) // NOLINT
+#endif /* HWCAP_ASIMDHP */
#ifndef HWCAP_CPUID
-#define HWCAP_CPUID (1 << 11)
-#endif /* HWCAP_CPUID */
+#define HWCAP_CPUID (1 << 11) // NOLINT
+#endif /* HWCAP_CPUID */
#ifndef HWCAP_ASIMDDP
-#define HWCAP_ASIMDDP (1 << 20)
-#endif /* HWCAP_ASIMDDP */
+#define HWCAP_ASIMDDP (1 << 20) // NOLINT
+#endif /* HWCAP_ASIMDDP */
namespace
{
@@ -146,12 +146,12 @@ CPUModel midr_to_model(const unsigned int midr)
break;
}
}
- else if(implementer == 0x48) // HiSilicon CPUs
+ else if(implementer == 0x48)
{
// Only CPUs we have code paths for are detected. All other CPUs can be safely classed as "GENERIC"
switch(cpunum)
{
- case 0xd40: // A76 (Kirin 980)
+ case 0xd40: // A76
model = CPUModel::GENERIC_FP16_DOT;
break;
default:
@@ -220,8 +220,8 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
while(bool(getline(file, line)))
{
- regmatch_t match[2];
- ret_status = regexec(&proc_regex, line.c_str(), 2, match, 0);
+ std::array<regmatch_t, 2> match;
+ ret_status = regexec(&proc_regex, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string id = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));
@@ -244,7 +244,7 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
continue;
}
- ret_status = regexec(&imp_regex, line.c_str(), 2, match, 0);
+ ret_status = regexec(&imp_regex, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));
@@ -254,7 +254,7 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
continue;
}
- ret_status = regexec(&var_regex, line.c_str(), 2, match, 0);
+ ret_status = regexec(&var_regex, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));
@@ -264,7 +264,7 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
continue;
}
- ret_status = regexec(&part_regex, line.c_str(), 2, match, 0);
+ ret_status = regexec(&part_regex, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));
@@ -274,7 +274,7 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
continue;
}
- ret_status = regexec(&rev_regex, line.c_str(), 2, match, 0);
+ ret_status = regexec(&rev_regex, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));
@@ -302,8 +302,7 @@ void populate_models_cpuinfo(std::vector<CPUModel> &cpusv)
int get_max_cpus()
{
- int max_cpus = 1;
-#if !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__))
+ int max_cpus = 1;
std::ifstream CPUspresent;
CPUspresent.open("/sys/devices/system/cpu/present", std::ios::in);
bool success = false;
@@ -341,7 +340,6 @@ int get_max_cpus()
{
max_cpus = std::thread::hardware_concurrency();
}
-#endif /* BARE_METAL */
return max_cpus;
}
#endif /* !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__)) */
@@ -427,8 +425,8 @@ unsigned int get_threads_hint()
std::string line;
while(bool(getline(cpuinfo, line)))
{
- regmatch_t match[2];
- ret_status = regexec(&cpu_part_rgx, line.c_str(), 2, match, 0);
+ std::array<regmatch_t, 2> match;
+ ret_status = regexec(&cpu_part_rgx, line.c_str(), 2, match.data(), 0);
if(ret_status == 0)
{
std::string cpu_part = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so));