Skip to content

Commit 36cbfb0

Browse files
committed
update formatting and OpenMP linking
1 parent 061261c commit 36cbfb0

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

cmake/openmp.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,20 @@ endfunction()
2121
function(ppc_link_openmp exec_func_lib)
2222
find_package(OpenMP REQUIRED)
2323
# Link the canonical imported target if available
24-
if (TARGET OpenMP::OpenMP_CXX)
24+
if(TARGET OpenMP::OpenMP_CXX)
2525
target_link_libraries(${exec_func_lib} PUBLIC OpenMP::OpenMP_CXX)
2626
endif()
2727

28-
if (APPLE)
28+
if(APPLE)
2929
# Homebrew libomp common paths
30-
find_path(LIBOMP_INCLUDE_DIR omp.h HINTS /opt/homebrew/opt/libomp/include /usr/local/opt/libomp/include)
31-
find_library(LIBOMP_LIBRARY omp HINTS /opt/homebrew/opt/libomp/lib /usr/local/opt/libomp/lib)
32-
if (LIBOMP_INCLUDE_DIR)
30+
find_path(LIBOMP_INCLUDE_DIR omp.h HINTS /opt/homebrew/opt/libomp/include
31+
/usr/local/opt/libomp/include)
32+
find_library(LIBOMP_LIBRARY omp HINTS /opt/homebrew/opt/libomp/lib
33+
/usr/local/opt/libomp/lib)
34+
if(LIBOMP_INCLUDE_DIR)
3335
target_include_directories(${exec_func_lib} PUBLIC ${LIBOMP_INCLUDE_DIR})
3436
endif()
35-
if (LIBOMP_LIBRARY)
37+
if(LIBOMP_LIBRARY)
3638
target_link_libraries(${exec_func_lib} PUBLIC ${LIBOMP_LIBRARY})
3739
# Ensure Clang generates OpenMP code
3840
target_compile_options(${exec_func_lib} PUBLIC -Xclang -fopenmp)

modules/util/include/util.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class DestructorFailureFlag {
6464

6565
enum class GTestParamIndex : uint8_t { kTaskGetter, kNameTest, kTestParams };
6666

67-
std::string GetAbsoluteTaskPath(const std::string& id_path, const std::string& relative_path);
67+
std::string GetAbsoluteTaskPath(const std::string &id_path, const std::string &relative_path);
6868
int GetNumThreads();
6969
int GetNumProc();
7070
double GetTaskMaxTime();
@@ -75,13 +75,13 @@ std::string GetNamespace() {
7575
std::string name = typeid(T).name();
7676
#ifdef __GNUC__
7777
int status = 0;
78-
std::unique_ptr<char, void (*)(void*)> demangled{abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),
79-
std::free};
78+
std::unique_ptr<char, void (*)(void *)> demangled{abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),
79+
std::free};
8080
name = (status == 0) ? demangled.get() : name;
8181
#endif
8282
#ifdef _MSC_VER
8383
const std::string prefixes[] = {"class ", "struct ", "enum ", "union "};
84-
for (const auto& prefix : prefixes) {
84+
for (const auto &prefix : prefixes) {
8585
if (name.starts_with(prefix)) {
8686
name = name.substr(prefix.size());
8787
break;
@@ -107,7 +107,7 @@ namespace test {
107107
return std::isalnum(static_cast<unsigned char>(c)) || c == '_' || c == '-' || c == '.';
108108
};
109109
std::ranges::replace(token, ' ', '_');
110-
for (char& ch : token) {
110+
for (char &ch : token) {
111111
if (!is_allowed(ch)) {
112112
ch = '_';
113113
}
@@ -117,11 +117,11 @@ namespace test {
117117

118118
class ScopedPerTestEnv {
119119
public:
120-
explicit ScopedPerTestEnv(const std::string& token)
120+
explicit ScopedPerTestEnv(const std::string &token)
121121
: set_uid_("PPC_TEST_UID", token), set_tmp_("PPC_TEST_TMPDIR", CreateTmpDir(token)) {}
122122

123123
private:
124-
static std::string CreateTmpDir(const std::string& token) {
124+
static std::string CreateTmpDir(const std::string &token) {
125125
namespace fs = std::filesystem;
126126
const fs::path tmp = fs::temp_directory_path() / (std::string("ppc_test_") + token);
127127
std::error_code ec;
@@ -135,8 +135,8 @@ class ScopedPerTestEnv {
135135
};
136136

137137
[[nodiscard]] inline std::string MakeCurrentGTestToken(std::string_view fallback_name) {
138-
const auto* unit = ::testing::UnitTest::GetInstance();
139-
const auto* info = (unit != nullptr) ? unit->current_test_info() : nullptr;
138+
const auto *unit = ::testing::UnitTest::GetInstance();
139+
const auto *info = (unit != nullptr) ? unit->current_test_info() : nullptr;
140140
std::ostringstream os;
141141
if (info != nullptr) {
142142
os << info->test_suite_name() << "." << info->name();

0 commit comments

Comments
 (0)