From 6c64b4cee863b34a9d07f07ed1d8300e018182d9 Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 23 Dec 2025 13:48:18 +0100 Subject: [PATCH] Now compiles with warning flags for C++ --- Makefile | 3 ++- src/detectorTowerAngleAxis.cpp | 26 +++++++++++++++++++++----- src/detectorTowerAngleAxis.h | 8 ++++---- src/detectorTowerController.cpp | 6 ++++-- src/detectorTowerLiftAxis.cpp | 15 ++++++++++++--- src/detectorTowerLiftAxis.h | 8 ++++---- src/detectorTowerSupportAxis.cpp | 4 ++++ src/detectorTowerSupportAxis.h | 16 ++++++++++++---- 8 files changed, 63 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index 71feae6..61075e9 100644 --- a/Makefile +++ b/Makefile @@ -42,4 +42,5 @@ DBDS += turboPmac/sinqMotor/src/sinqMotor.dbd DBDS += turboPmac/src/turboPmac.dbd DBDS += src/detectorTower.dbd -USR_CFLAGS += -Wall -Wextra -Wunused-result -Wextra -Werror -fvisibility=hidden # -Wpedantic // Does not work because EPICS macros trigger warnings +USR_CFLAGS += -Wall -Wextra -Wunused-result -Wextra -Werror # -Wpedantic // Does not work because EPICS macros trigger warnings +USR_CXXFLAGS += -Wall -Wextra -Wunused-result -Werror \ No newline at end of file diff --git a/src/detectorTowerAngleAxis.cpp b/src/detectorTowerAngleAxis.cpp index 126c111..72e6bc1 100644 --- a/src/detectorTowerAngleAxis.cpp +++ b/src/detectorTowerAngleAxis.cpp @@ -179,6 +179,10 @@ asynStatus detectorTowerAngleAxis::poll(bool *moving) { } asynStatus detectorTowerAngleAxis::doPoll(bool *moving) { + + // Suppress unused variable warning + (void)moving; + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nThe doPoll method " "of this axis type should not be reachable. This is a bug.\n", @@ -187,9 +191,16 @@ asynStatus detectorTowerAngleAxis::doPoll(bool *moving) { } asynStatus detectorTowerAngleAxis::doMove(double position, int relative, - double min_velocity, - double max_velocity, + double minVelocity, + double maxVelocity, double acceleration) { + + // Suppress unused variable warning + (void)relative; + (void)minVelocity; + (void)maxVelocity; + (void)acceleration; + double motorRecResolution = 0.0; getAxisParamChecked(this, motorRecResolution, &motorRecResolution); @@ -276,6 +287,9 @@ asynStatus detectorTowerAngleAxis::stop(double acceleration) { // ========================================================================= + // Suppress unused variable warning + (void)acceleration; + status = pC_->writeRead(axisNo_, "P350=8", response, 0); if (status != asynSuccess) { @@ -540,8 +554,9 @@ static const iocshArg *const CreateAxisArgs[] = { &CreateAxisArg2, &CreateAxisArg3, }; -static const iocshFuncDef configDetectorTowerCreateAxis = {"detectorTowerAxis", - 4, CreateAxisArgs}; +static const iocshFuncDef configDetectorTowerCreateAxis = { + "detectorTowerAxis", 4, CreateAxisArgs, + "Create new instances of detectorTower axes."}; static void configDetectorTowerCreateAxisCallFunc(const iocshArgBuf *args) { detectorTowerCreateAxis(args[0].sval, args[1].ival, args[2].ival, args[3].ival); @@ -595,7 +610,8 @@ static const iocshArg *const setDeferredMovementWaitArgs[] = { &setDeferredMovementWaitArg0, &setDeferredMovementWaitArg1, &setDeferredMovementWaitArg2}; static const iocshFuncDef setDeferredMovementWaitDef = { - "setDeferredMovementWait", 3, setDeferredMovementWaitArgs}; + "setDeferredMovementWait", 3, setDeferredMovementWaitArgs, + "Set the wait time in seconds for the deferred movement."}; static void setDeferredMovementWaitCallFunc(const iocshArgBuf *args) { setDeferredMovementWait(args[0].sval, args[1].ival, args[2].dval); diff --git a/src/detectorTowerAngleAxis.h b/src/detectorTowerAngleAxis.h index 395fc8c..709cf1a 100644 --- a/src/detectorTowerAngleAxis.h +++ b/src/detectorTowerAngleAxis.h @@ -56,13 +56,13 @@ class HIDDEN detectorTowerAngleAxis : public turboPmacAxis { * * @param position * @param relative - * @param min_velocity - * @param max_velocity + * @param minVelocity + * @param maxVelocity * @param acceleration * @return asynStatus */ - asynStatus doMove(double position, int relative, double min_velocity, - double max_velocity, double acceleration); + asynStatus doMove(double position, int relative, double minVelocity, + double maxVelocity, double acceleration); /** * @brief Start a movement to the target positions of this axis and the diff --git a/src/detectorTowerController.cpp b/src/detectorTowerController.cpp index 3166dd9..c2ceeeb 100644 --- a/src/detectorTowerController.cpp +++ b/src/detectorTowerController.cpp @@ -26,7 +26,8 @@ detectorTowerController::detectorTowerController( const char *portName, const char *ipPortConfigName, int numAxes, double movingPollPeriod, double idlePollPeriod, double comTimeout) : turboPmacController(portName, ipPortConfigName, numAxes, movingPollPeriod, - idlePollPeriod, NUM_detectorTower_DRIVER_PARAMS) + idlePollPeriod, comTimeout, + NUM_detectorTower_DRIVER_PARAMS) { @@ -1005,7 +1006,8 @@ static const iocshArg *const CreateControllerArgs[] = { &CreateControllerArg0, &CreateControllerArg1, &CreateControllerArg2, &CreateControllerArg3, &CreateControllerArg4, &CreateControllerArg5}; static const iocshFuncDef configDetectorTowerCreateController = { - "detectorTowerController", 6, CreateControllerArgs}; + "detectorTowerController", 6, CreateControllerArgs, + "Create a new instance of a detector tower controller."}; static void configDetectorTowerCreateControllerCallFunc(const iocshArgBuf *args) { detectorTowerCreateController(args[0].sval, args[1].sval, args[2].ival, diff --git a/src/detectorTowerLiftAxis.cpp b/src/detectorTowerLiftAxis.cpp index ecdee17..b4d71c9 100644 --- a/src/detectorTowerLiftAxis.cpp +++ b/src/detectorTowerLiftAxis.cpp @@ -72,7 +72,7 @@ detectorTowerLiftAxis::detectorTowerLiftAxis(detectorTowerController *pC, angleAxis->liftAxis_ = this; // Initialize the flag to false - waitingForStart_ = false; + waitingForStart_ = false; } detectorTowerLiftAxis::~detectorTowerLiftAxis(void) { @@ -149,6 +149,10 @@ asynStatus detectorTowerLiftAxis::poll(bool *moving) { } asynStatus detectorTowerLiftAxis::doPoll(bool *moving) { + + // Suppress unused variable warnings + (void)moving; + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nThe doPoll method " "of this axis type should not be reachable. This is a bug.\n", @@ -157,9 +161,14 @@ asynStatus detectorTowerLiftAxis::doPoll(bool *moving) { } asynStatus detectorTowerLiftAxis::doMove(double position, int relative, - double min_velocity, - double max_velocity, + double minVelocity, double maxVelocity, double acceleration) { + // Suppress unused variable warnings + (void)relative; + (void)minVelocity; + (void)maxVelocity; + (void)acceleration; + double motorRecResolution = 0.0; getAxisParamChecked(this, motorRecResolution, &motorRecResolution); diff --git a/src/detectorTowerLiftAxis.h b/src/detectorTowerLiftAxis.h index 4b35e90..d4cfbcf 100644 --- a/src/detectorTowerLiftAxis.h +++ b/src/detectorTowerLiftAxis.h @@ -52,13 +52,13 @@ class HIDDEN detectorTowerLiftAxis : public turboPmacAxis { * * @param position * @param relative - * @param min_velocity - * @param max_velocity + * @param minVelocity + * @param maxVelocity * @param acceleration * @return asynStatus */ - asynStatus doMove(double position, int relative, double min_velocity, - double max_velocity, double acceleration); + asynStatus doMove(double position, int relative, double minVelocity, + double maxVelocity, double acceleration); /** * @brief Calls the `reset` function of the associated angle axis. diff --git a/src/detectorTowerSupportAxis.cpp b/src/detectorTowerSupportAxis.cpp index c971233..8f8c975 100644 --- a/src/detectorTowerSupportAxis.cpp +++ b/src/detectorTowerSupportAxis.cpp @@ -146,6 +146,10 @@ asynStatus detectorTowerSupportAxis::poll(bool *moving) { } asynStatus detectorTowerSupportAxis::doPoll(bool *moving) { + + // Suppress unused variable warnings + (void)moving; + asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nThe doPoll method " "of this axis type should not be reachable. This is a bug.\n", diff --git a/src/detectorTowerSupportAxis.h b/src/detectorTowerSupportAxis.h index 1a16c9c..f3c68b1 100644 --- a/src/detectorTowerSupportAxis.h +++ b/src/detectorTowerSupportAxis.h @@ -56,13 +56,21 @@ class HIDDEN detectorTowerSupportAxis : public turboPmacAxis { * * @param position * @param relative - * @param min_velocity - * @param max_velocity + * @param minVelocity + * @param maxVelocity * @param acceleration * @return asynStatus */ - asynStatus doMove(double position, int relative, double min_velocity, - double max_velocity, double acceleration) { + asynStatus doMove(double position, int relative, double minVelocity, + double maxVelocity, double acceleration) { + + // Suppress unused variable warnings + (void)position; + (void)relative; + (void)minVelocity; + (void)maxVelocity; + (void)acceleration; + return asynSuccess; }