aboutsummaryrefslogtreecommitdiff
path: root/Source/ablastr/utils/SignalHandling.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-06-13 05:07:42 +0200
committerGravatar GitHub <noreply@github.com> 2023-06-13 03:07:42 +0000
commit297dd2d31527acc9676d4eb0c3a9c54c2688abd6 (patch)
tree86e14ea3325872030f7fe3fb7b6e20013fa1d032 /Source/ablastr/utils/SignalHandling.cpp
parentd1a2d04521691a9489f53cc003142e91d98571ee (diff)
downloadWarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.tar.gz
WarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.tar.zst
WarpX-297dd2d31527acc9676d4eb0c3a9c54c2688abd6.zip
Enforce const correctness using clang-tidy CI test (#3921)
* add clang-tidy workflow * fix missing newline * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * make clang.14.sh executable * remove non explicitly selected checks * complete list of dependencies * fix bug * specify path of clang-tidy file * fix bug * add new check * remove one check * add magic numbers check * removed one check * keep only one check * Docs: Conda Dev w/ Boost (#3911) Add the `boost` package to the conda developer environment. Used for QED table generation. * Fix typo in Adastra cluster documentation (#3918) * add back three checks * prepare clang-tidy wrapper * actually use clang-tidy in the script * test * fix bug * actually use clang-tidy * fixed bug * fixed bug * fixed bug * fixed bug * remove all checks except the selected 3 * fixed bug * fixed bug * fixed bug * enforce const correctness using clang-tidy * remove one check * Fix Concurrency Issue * BLAS++/LAPACK++ for RZ+PSATD * Build all 4 WarpX DIMS * add few echo for test purposes * try to debug mysterious error * don't test RZ with clang-tidy * add back RZ test * add some const * fix bug * check also header files * remove header filter since it does not work as expected * fixed bug * check also WarpX headers * fix bugs * continue enforcing const correctness * continue enforcing const correctness * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed bug * fix bugs and add new const * clean .clang-tidy * make regex more precise according to Weiqun's suggestion * add more const * fix bugs * fix bug * silence warning on float comparison * fixed bug * fixed bugs * fix bug and add const * fixed bugs * fix bug * fix bug * fix bug * fixed bug * fix bug
Diffstat (limited to 'Source/ablastr/utils/SignalHandling.cpp')
-rw-r--r--Source/ablastr/utils/SignalHandling.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/ablastr/utils/SignalHandling.cpp b/Source/ablastr/utils/SignalHandling.cpp
index f071315ed..36ab50f4c 100644
--- a/Source/ablastr/utils/SignalHandling.cpp
+++ b/Source/ablastr/utils/SignalHandling.cpp
@@ -35,7 +35,7 @@ SignalHandling::parseSignalNameToNumber (const std::string &str)
amrex::IParser signals_parser(str);
#if defined(__linux__) || defined(__APPLE__)
- struct {
+ const struct {
const char* abbrev;
const int value;
} signals_to_parse[] = {
@@ -104,7 +104,7 @@ SignalHandling::parseSignalNameToNumber (const std::string &str)
auto spf = signals_parser.compileHost<0>();
- int sig = spf();
+ const int sig = spf();
ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(sig < NUM_SIGNALS,
"Parsed signal value is outside the supported range of [1, 31]");
@@ -133,7 +133,7 @@ SignalHandling::InitSignalHandling ()
} else {
sa.sa_handler = SIG_IGN;
}
- int result = sigaction(signal_number, &sa, nullptr);
+ const int result = sigaction(signal_number, &sa, nullptr);
ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE(result == 0,
"Failed to install signal handler for a configured signal");
}
@@ -159,7 +159,7 @@ SignalHandling::CheckSignals ()
// unset the flag without risking loss of a signal - if a
// signal arrives after this, it will be handled the next
// time this function is called.
- bool signal_received = signal_received_flags[signal_number].exchange(false);
+ const bool signal_received = signal_received_flags[signal_number].exchange(false);
if (signal_received) {
for (int signal_request = 0; signal_request < SIGNAL_REQUESTS_SIZE; ++signal_request) {
@@ -195,7 +195,7 @@ SignalHandling::WaitSignals ()
bool
SignalHandling::TestAndResetActionRequestFlag (int action_to_test)
{
- bool retval = signal_actions_requested[action_to_test];
+ const bool retval = signal_actions_requested[action_to_test];
signal_actions_requested[action_to_test] = false;
return retval;
}