Skip to content

Commit 34ffd56

Browse files
committed
lint
1 parent 64ce1d6 commit 34ffd56

File tree

7 files changed

+86
-53
lines changed

7 files changed

+86
-53
lines changed

Plugins/FpeMonitoring/CMakeLists.txt

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ else()
4747

4848
set(_backtrace_setup_complete FALSE)
4949
set(_backtrace_src
50-
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/backtrace.cpp")
50+
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp/backtrace.cpp"
51+
)
5152
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/CMakeTmp")
5253

5354
find_path(
@@ -57,12 +58,17 @@ else()
5758
PATHS ${Boost_INCLUDE_DIRS}
5859
)
5960

60-
file(WRITE "${_backtrace_src}"
61+
file(
62+
WRITE "${_backtrace_src}"
6163
"#include <boost/stacktrace.hpp>\n"
6264
"#include <iostream>\n"
63-
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n")
65+
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
66+
)
6467

65-
message(CHECK_START "Does backtrace work without libbacktrace linker flag")
68+
message(
69+
CHECK_START
70+
"Does backtrace work without libbacktrace linker flag"
71+
)
6672
try_compile(
6773
_backtrace_nolink
6874
"${CMAKE_CURRENT_BINARY_DIR}"
@@ -87,18 +93,20 @@ else()
8793
message(STATUS "Could not find backtrace header file")
8894
else()
8995
message(CHECK_START "Does backtrace work with explicit include")
90-
file(WRITE "${_backtrace_src}"
96+
file(
97+
WRITE "${_backtrace_src}"
9198
"#include <boost/stacktrace.hpp>\n"
9299
"#include <iostream>\n"
93-
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n")
100+
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
101+
)
94102
try_compile(
95103
_backtrace_explicit
96104
"${CMAKE_CURRENT_BINARY_DIR}"
97105
"${_backtrace_src}"
98106
LINK_LIBRARIES ${CMAKE_DL_LIBS}
99-
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
100-
COMPILE_DEFINITIONS
101-
BOOST_STACKTRACE_USE_BACKTRACE
107+
CMAKE_FLAGS
108+
"-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
109+
COMPILE_DEFINITIONS BOOST_STACKTRACE_USE_BACKTRACE
102110
OUTPUT_VARIABLE __OUTPUT
103111
)
104112

@@ -113,12 +121,16 @@ else()
113121
"BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=\"${backtrace_header}\""
114122
)
115123

116-
file(WRITE "${_backtrace_src}"
124+
file(
125+
WRITE "${_backtrace_src}"
117126
"#include <boost/stacktrace.hpp>\n"
118-
"int main() {}\n")
127+
"int main() {}\n"
128+
)
119129

120-
message(CHECK_START
121-
"Does backtrace work with explicit include")
130+
message(
131+
CHECK_START
132+
"Does backtrace work with explicit include"
133+
)
122134
try_compile(
123135
_backtrace_explicit_header
124136
"${CMAKE_CURRENT_BINARY_DIR}"
@@ -135,21 +147,25 @@ else()
135147
if(_backtrace_explicit_header)
136148
message(CHECK_PASS "yes")
137149
list(
138-
APPEND
139-
_fpe_definitions
150+
APPEND _fpe_definitions
140151
BOOST_STACKTRACE_USE_BACKTRACE
141152
${_backtrace_include_def}
142153
)
143154
set(_backtrace_setup_complete TRUE)
144155
else()
145156
message(CHECK_FAIL "no")
146157

147-
file(WRITE "${_backtrace_src}"
158+
file(
159+
WRITE "${_backtrace_src}"
148160
"#include <boost/stacktrace.hpp>\n"
149161
"#include <iostream>\n"
150-
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n")
162+
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
163+
)
151164

152-
message(CHECK_START "Does backtrace work without linker flag")
165+
message(
166+
CHECK_START
167+
"Does backtrace work without linker flag"
168+
)
153169
try_compile(
154170
_backtrace_nolink
155171
"${CMAKE_CURRENT_BINARY_DIR}"
@@ -166,21 +182,25 @@ else()
166182
if(_backtrace_nolink)
167183
message(CHECK_PASS "yes")
168184
list(
169-
APPEND
170-
_fpe_definitions
185+
APPEND _fpe_definitions
171186
BOOST_STACKTRACE_USE_BACKTRACE
172187
${_backtrace_include_def}
173188
)
174189
set(_backtrace_setup_complete TRUE)
175190
else()
176191
message(CHECK_FAIL "no")
177192

178-
file(WRITE "${_backtrace_src}"
193+
file(
194+
WRITE "${_backtrace_src}"
179195
"#include <boost/stacktrace.hpp>\n"
180196
"#include <iostream>\n"
181-
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n")
197+
"int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
198+
)
182199

183-
message(CHECK_START "Does backtrace work with linker flag")
200+
message(
201+
CHECK_START
202+
"Does backtrace work with linker flag"
203+
)
184204
try_compile(
185205
_backtrace_link
186206
"${CMAKE_CURRENT_BINARY_DIR}"
@@ -197,8 +217,7 @@ else()
197217
if(_backtrace_link)
198218
message(CHECK_PASS "yes")
199219
list(
200-
APPEND
201-
_fpe_definitions
220+
APPEND _fpe_definitions
202221
BOOST_STACKTRACE_USE_BACKTRACE
203222
${_backtrace_include_def}
204223
)
@@ -218,12 +237,17 @@ else()
218237
endif()
219238

220239
if(NOT _backtrace_setup_complete)
221-
message(STATUS "libdl available but backtrace backend probe failed: use boost basic fallback")
240+
message(
241+
STATUS
242+
"libdl available but backtrace backend probe failed: use boost basic fallback"
243+
)
222244
endif()
223245
endif()
224246
endif()
225247

226-
227248
if(_fpe_definitions)
228-
target_compile_definitions(ActsPluginFpeMonitoring PUBLIC ${_fpe_definitions})
249+
target_compile_definitions(
250+
ActsPluginFpeMonitoring
251+
PUBLIC ${_fpe_definitions}
252+
)
229253
endif()

Plugins/FpeMonitoring/src/FpeMonitor.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ FpeMonitor::Result::FpeInfo::FpeInfo(
5555
std::size_t countIn, FpeType typeIn,
5656
std::shared_ptr<const boost::stacktrace::stacktrace> stIn,
5757
std::uintptr_t locationIn)
58-
: count{countIn},
59-
type{typeIn},
60-
st{std::move(stIn)},
61-
location{locationIn} {}
58+
: count{countIn}, type{typeIn}, st{std::move(stIn)}, location{locationIn} {}
6259

6360
FpeMonitor::Result FpeMonitor::Result::merged(const Result &with) const {
6461
Result result{};
@@ -168,8 +165,8 @@ void FpeMonitor::Result::deduplicate() {
168165
m_stackTraces.reserve(copy.size());
169166

170167
for (auto &info : copy) {
171-
const auto mergeTarget = std::ranges::find_if(
172-
m_stackTraces, [&](const FpeInfo &existing) {
168+
const auto mergeTarget =
169+
std::ranges::find_if(m_stackTraces, [&](const FpeInfo &existing) {
173170
return canMergeFpeInfo(existing, info.type, info.location, *info.st);
174171
});
175172

Plugins/FpeMonitoring/src/FpeMonitorPlatformDarwinArm64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ bool shouldFailFastOnUnknownSignal() {
164164

165165
void installSignalHandlers(void (*handler)(int, siginfo_t*, void*)) {
166166
// Install both SIGFPE and SIGILL handlers to cover Darwin arm64 behavior.
167-
struct sigaction action {};
167+
struct sigaction action{};
168168
action.sa_sigaction = handler;
169169
action.sa_flags = SA_SIGINFO;
170170
sigaction(SIGFPE, &action, nullptr);

Plugins/FpeMonitoring/src/FpeMonitorPlatformDarwinX86_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ bool shouldFailFastOnUnknownSignal() {
111111

112112
void installSignalHandlers(void (*handler)(int, siginfo_t*, void*)) {
113113
// A single SIGFPE handler is sufficient on Darwin x86_64.
114-
struct sigaction action {};
114+
struct sigaction action{};
115115
action.sa_sigaction = handler;
116116
action.sa_flags = SA_SIGINFO;
117117
sigaction(SIGFPE, &action, nullptr);

Plugins/FpeMonitoring/src/FpeMonitorPlatformLinuxX86_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ bool shouldFailFastOnUnknownSignal() {
103103

104104
void installSignalHandlers(void (*handler)(int, siginfo_t*, void*)) {
105105
// Linux only needs SIGFPE for floating-point trap monitoring.
106-
struct sigaction action {};
106+
struct sigaction action{};
107107
action.sa_sigaction = handler;
108108
action.sa_flags = SA_SIGINFO;
109109
sigaction(SIGFPE, &action, nullptr);

Plugins/FpeMonitoring/src/FpeMonitorPlatformUnsupported.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ namespace ActsPlugins::detail {
1313
// This backend intentionally provides a complete no-op implementation so the
1414
// public FpeMonitor API remains available even when platform trapping support
1515
// is missing.
16-
bool isRuntimeSupported() { return false; }
16+
bool isRuntimeSupported() {
17+
return false;
18+
}
1719

1820
std::optional<FpeType> decodeFpeType(int signal, siginfo_t* si, void* ctx) {
1921
// No signal decoding support on unsupported platforms.
@@ -24,11 +26,17 @@ std::optional<FpeType> decodeFpeType(int signal, siginfo_t* si, void* ctx) {
2426
}
2527

2628
// Trap-control hooks are intentionally inert.
27-
void clearPendingExceptions(int excepts) { static_cast<void>(excepts); }
29+
void clearPendingExceptions(int excepts) {
30+
static_cast<void>(excepts);
31+
}
2832

29-
void enableExceptions(int excepts) { static_cast<void>(excepts); }
33+
void enableExceptions(int excepts) {
34+
static_cast<void>(excepts);
35+
}
3036

31-
void disableExceptions(int excepts) { static_cast<void>(excepts); }
37+
void disableExceptions(int excepts) {
38+
static_cast<void>(excepts);
39+
}
3240

3341
void maskTrapsInSignalContext(void* ctx, FpeType type) {
3442
// No context mutation possible without platform-specific register layout.
@@ -46,9 +54,13 @@ std::size_t captureStackFromSignalContext(void* ctx, void* buffer,
4654
}
4755

4856
// Keep defaults aligned with safe_dump fallback behavior.
49-
std::size_t safeDumpSkipFrames() { return 2; }
57+
std::size_t safeDumpSkipFrames() {
58+
return 2;
59+
}
5060

51-
bool shouldFailFastOnUnknownSignal() { return false; }
61+
bool shouldFailFastOnUnknownSignal() {
62+
return false;
63+
}
5264

5365
void installSignalHandlers(void (*handler)(int, siginfo_t*, void*)) {
5466
// Signal handler installation is intentionally disabled.

Python/Examples/src/Framework.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,16 @@ void addFramework(py::module& mex) {
344344
std::optional<FpeMonitor> mon;
345345
};
346346

347-
auto fpe = py::class_<FpeMonitor>(mex, "FpeMonitor")
348-
.def_static("_trigger_divbyzero", &trigger_divbyzero)
349-
.def_static("_trigger_overflow", &trigger_overflow)
350-
.def_static("_trigger_invalid", &trigger_invalid)
351-
.def_property_readonly_static(
352-
"supported",
353-
[](const py::object& /*self*/) {
354-
return FpeMonitor::isSupported();
355-
})
356-
.def_static("context", []() { return FpeMonitorContext(); });
347+
auto fpe =
348+
py::class_<FpeMonitor>(mex, "FpeMonitor")
349+
.def_static("_trigger_divbyzero", &trigger_divbyzero)
350+
.def_static("_trigger_overflow", &trigger_overflow)
351+
.def_static("_trigger_invalid", &trigger_invalid)
352+
.def_property_readonly_static("supported",
353+
[](const py::object& /*self*/) {
354+
return FpeMonitor::isSupported();
355+
})
356+
.def_static("context", []() { return FpeMonitorContext(); });
357357

358358
fpe.def_property_readonly("result", py::overload_cast<>(&FpeMonitor::result),
359359
py::return_value_policy::reference_internal)

0 commit comments

Comments
 (0)