Compare commits

...

2 Commits
1.5.1 ... 1.5.2

Author SHA1 Message Date
cb4adb068c Fixed some warnings
All checks were successful
Test And Build / Lint (push) Successful in 6s
Test And Build / Build (push) Successful in 5s
2025-09-17 11:24:15 +02:00
d7c9d009ee Better solution for suppressing unused variable warning
All checks were successful
Test And Build / Lint (push) Successful in 5s
Test And Build / Build (push) Successful in 5s
2025-09-17 11:08:24 +02:00
3 changed files with 39 additions and 21 deletions

View File

@@ -5,17 +5,13 @@
msgPrintControlKey::msgPrintControlKey(char *controller, int axisNo,
const char *functionName, int line,
size_t maxRepetitions) {
controller_ = controller;
axisNo_ = axisNo;
line_ = line;
functionName_ = functionName;
maxRepetitions_ = maxRepetitions;
}
size_t maxRepetitions)
: controller_(controller), axisNo_(axisNo), functionName_(functionName),
line_(line), maxRepetitions_(maxRepetitions) {}
void msgPrintControlKey::format(char *buffer, size_t bufferSize) {
snprintf(buffer, bufferSize, "controller %s, axis %d, function %s, line %d",
controller_.c_str(), axisNo_, functionName_, line_);
controller_.c_str(), axisNo_, functionName_.c_str(), line_);
}
// =============================================================================
@@ -78,8 +74,8 @@ bool msgPrintControl::shouldBePrinted(msgPrintControlKey &key, bool wantToPrint,
pasynUser, ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d\nError "
"associated with key \"%s\" has been resolved.\n",
key.controller_.c_str(), key.axisNo_, key.functionName_,
key.line_, formattedKey);
key.controller_.c_str(), key.axisNo_,
key.functionName_.c_str(), key.line_, formattedKey);
}
map_[key] = 0;
}
@@ -107,7 +103,7 @@ void msgPrintControl::resetCount(msgPrintControlKey &key, asynUser *pasynUser) {
"Controller \"%s\", axis %d => %s, line %d\nError "
"associated with key \"%s\" has been resolved.\n",
key.controller_.c_str(), key.axisNo_,
key.functionName_, key.line_, formattedKey);
key.functionName_.c_str(), key.line_, formattedKey);
}
map_[key] = 0;
}

View File

@@ -23,7 +23,7 @@ class HIDDEN msgPrintControlKey {
// -1 indicates a non-axis specific message
int axisNo_;
const char *functionName_;
std::string functionName_;
int line_;
/**
@@ -38,7 +38,7 @@ class HIDDEN msgPrintControlKey {
bool operator==(const msgPrintControlKey &other) const {
return axisNo_ == other.axisNo_ && line_ == other.line_ &&
strcmp(functionName_, other.functionName_) == 0 &&
functionName_ == other.functionName_ &&
controller_ == other.controller_;
}
@@ -55,7 +55,7 @@ template <> struct hash<msgPrintControlKey> {
// Combine the hashes of the members (x and y)
size_t h1 = std::hash<std::string>{}(obj.controller_);
size_t h2 = hash<int>{}(obj.axisNo_);
size_t h3 = std::hash<const char *>{}(obj.functionName_);
size_t h3 = std::hash<std::string>{}(obj.functionName_);
size_t h4 = hash<int>{}(obj.line_);
// Combine the hashes (simple XOR and shifting technique)
return h1 ^ (h2 << 1) ^ (h3 << 2) ^ (h4 << 3);

View File

@@ -318,7 +318,12 @@ asynStatus sinqAxis::forcedPoll(bool *moving) {
return poll_status;
}
asynStatus sinqAxis::doPoll(bool * /*moving*/) { return asynSuccess; }
asynStatus sinqAxis::doPoll(bool *moving) {
// Suppress unused variable warning - this is just a default fallback
// function.
(void)moving;
return asynSuccess;
}
asynStatus sinqAxis::move(double position, int relative, double minVelocity,
double maxVelocity, double acceleration) {
@@ -354,9 +359,15 @@ asynStatus sinqAxis::move(double position, int relative, double minVelocity,
return pC_->callParamCallbacks();
}
asynStatus sinqAxis::doMove(double /*position*/, int /*relative*/,
double /*minVelocity*/, double /*maxVelocity*/,
double /*acceleration*/) {
asynStatus sinqAxis::doMove(double position, int relative, double minVelocity,
double maxVelocity, double acceleration) {
// Suppress unused variable warning - this is just a default fallback
// function.
(void)position;
(void)relative;
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
return asynSuccess;
}
@@ -398,8 +409,14 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity,
}
}
asynStatus sinqAxis::doHome(double /*minVelocity*/, double /*maxVelocity*/,
double /*acceleration*/, int /*forwards*/) {
asynStatus sinqAxis::doHome(double minVelocity, double maxVelocity,
double acceleration, int forwards) {
// Suppress unused variable warning - this is just a default fallback
// function.
(void)minVelocity;
(void)maxVelocity;
(void)acceleration;
(void)forwards;
return asynSuccess;
}
@@ -421,7 +438,12 @@ asynStatus sinqAxis::reset() {
asynStatus sinqAxis::doReset() { return asynError; }
asynStatus sinqAxis::enable(bool /*on*/) { return asynSuccess; }
asynStatus sinqAxis::enable(bool on) {
// Suppress unused variable warning - this is just a default fallback
// function.
(void)on;
return asynSuccess;
}
asynStatus sinqAxis::motorPosition(double *motorPos) {
asynStatus status = asynSuccess;