From fdebddb965719af86698eb4ae662540d507df976 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Feb 2023 12:19:53 +0100 Subject: [PATCH 1/2] fix shadowing warnings --- CMakeLists.txt | 1 + bsp_q7s/callbacks/rwSpiCallback.cpp | 2 +- bsp_q7s/core/CoreController.cpp | 4 ++-- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 2 +- linux/csp/CspComIF.cpp | 20 ++++++++--------- linux/devices/Max31865RtdLowlevelHandler.cpp | 6 ++--- linux/devices/RwPollingTask.cpp | 4 ++-- linux/devices/ploc/PlocSupervisorHandler.cpp | 2 +- .../startracker/StarTrackerHandler.cpp | 4 ++-- .../devices/startracker/StarTrackerHandler.h | 4 ++-- linux/ipcore/PdecHandler.cpp | 22 +++++++++---------- linux/ipcore/PdecHandler.h | 22 +++++++++---------- misc/eclipse/.cproject | 17 +------------- mission/controller/acs/SensorProcessing.cpp | 2 +- mission/devices/HeaterHandler.cpp | 2 +- mission/devices/RwHandler.cpp | 4 ++-- mission/system/objects/AcsSubsystem.cpp | 7 +++--- 18 files changed, 57 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e2e9838..895034c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,6 +358,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") "-Wimplicit-fallthrough=1" "-Wno-unused-parameter" "-Wno-psabi" + "-Wshadow=local" "-Wduplicated-cond" # check for duplicate conditions "-Wduplicated-branches" # check for duplicate branches "-Wlogical-op" # Search for bitwise operations instead of logical diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 7f71a004..fa36744e 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -139,7 +139,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sen * However, receiving more than 5 empty frames will be interpreted as an error. */ uint8_t byteRead = 0; - for (int idx = 0; idx < 10; idx++) { + for (idx = 0; idx < 10; idx++) { if (read(fileDescriptor, &byteRead, 1) != 1) { sif::error << "rwSpiCallback::spiCallback: Read failed" << std::endl; closeSpi(fileDescriptor, gpioId, &gpioIF, mutex); diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 4ff4965f..d3264b73 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -160,7 +160,7 @@ ReturnValue_t CoreController::initializeAfterTaskCreation() { sdcMan->setActiveSdCard(sdInfo.active); currMntPrefix = sdcMan->getCurrentMountPrefix(); if (BLOCKING_SD_INIT) { - ReturnValue_t result = initSdCardBlocking(); + result = initSdCardBlocking(); if (result != returnvalue::OK and result != SdCardManager::ALREADY_MOUNTED) { sif::warning << "CoreController::CoreController: SD card init failed" << std::endl; } @@ -1163,7 +1163,7 @@ ReturnValue_t CoreController::updateProtInfo(bool regenerateChipStateFile) { uint8_t lineCounter = 0; string word; while (getline(chipStateFile, nextLine)) { - ReturnValue_t result = handleProtInfoUpdateLine(nextLine); + result = handleProtInfoUpdateLine(nextLine); if (result != returnvalue::OK) { sif::warning << "CoreController::updateProtInfo: Protection info update failed!" << std::endl; return result; diff --git a/fsfw b/fsfw index a6d707a7..be015b4c 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit a6d707a7db589136ac2bd917cd8b3a3e2c16a0e4 +Subproject commit be015b4c669995dc55bc316b006699be8542d941 diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 91e8893c..e995a846 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -137,7 +137,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) { if ((statusReg & 0b1000'0000) == 0) { sif::warning << "SpiTestClass::performRm3100Test: Data not ready!" << std::endl; TaskFactory::delayTask(10); - uint8_t statusReg = readRm3100Register(fileDescriptor, currentGpioId, 0x34); + statusReg = readRm3100Register(fileDescriptor, currentGpioId, 0x34); if ((statusReg & 0b1000'0000) == 0) { return; } diff --git a/linux/csp/CspComIF.cpp b/linux/csp/CspComIF.cpp index ea508a31..23359c0a 100644 --- a/linux/csp/CspComIF.cpp +++ b/linux/csp/CspComIF.cpp @@ -141,8 +141,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s requestStruct.mem_id = P60PDU_PARAM; requestStruct.count = p60pdu_config_count; requestStruct.size = P60PDU_PARAM_SIZE; - int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, - requestStruct.mem_id, cspCookie->getTimeout()); + result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, + requestStruct.mem_id, cspCookie->getTimeout()); if (result != 0) { return returnvalue::FAILED; } @@ -151,8 +151,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s requestStruct.mem_id = P60ACU_PARAM; requestStruct.count = p60acu_config_count; requestStruct.size = P60ACU_PARAM_SIZE; - int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, - requestStruct.mem_id, cspCookie->getTimeout()); + result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, + requestStruct.mem_id, cspCookie->getTimeout()); if (result != 0) { return returnvalue::FAILED; } @@ -161,8 +161,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s requestStruct.mem_id = P60DOCK_PARAM; requestStruct.count = p60dock_config_count; requestStruct.size = P60DOCK_PARAM_SIZE; - int result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, - requestStruct.mem_id, cspCookie->getTimeout()); + result = rparam_get_full_table(&requestStruct, cspAddress, P60_PORT_RPARAM, + requestStruct.mem_id, cspCookie->getTimeout()); if (result != 0) { return returnvalue::FAILED; } @@ -171,8 +171,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); - int result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + result = gs_rparam_save(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } @@ -181,8 +181,8 @@ ReturnValue_t CspComIF::sendMessage(CookieIF* cookie, const uint8_t* sendData, s return returnvalue::FAILED; } const TableInfo* tableInfo = reinterpret_cast(sendData); - int result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, - tableInfo->targetTable); + result = gs_rparam_load(cspAddress, cspCookie->getTimeout(), tableInfo->sourceTable, + tableInfo->targetTable); if (result != 0) { return returnvalue::FAILED; } diff --git a/linux/devices/Max31865RtdLowlevelHandler.cpp b/linux/devices/Max31865RtdLowlevelHandler.cpp index 52a107dc..0af22bfa 100644 --- a/linux/devices/Max31865RtdLowlevelHandler.cpp +++ b/linux/devices/Max31865RtdLowlevelHandler.cpp @@ -232,7 +232,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se return returnvalue::FAILED; } - auto thresholdHandler = [](Max31865ReaderCookie* rtdCookie, const uint8_t* sendData) { + auto thresholdHandler = [&]() { rtdCookie->lowThreshold = (sendData[1] << 8) | sendData[2]; rtdCookie->highThreshold = (sendData[3] << 8) | sendData[4]; rtdCookie->writeLowThreshold = true; @@ -249,7 +249,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se rtdCookie->db.active = false; rtdCookie->db.configured = false; if (sendLen == 5) { - thresholdHandler(rtdCookie, sendData); + thresholdHandler(); } } break; @@ -265,7 +265,7 @@ ReturnValue_t Max31865RtdReader::sendMessage(CookieIF* cookie, const uint8_t* se rtdCookie->db.active = true; } if (sendLen == 5) { - thresholdHandler(rtdCookie, sendData); + thresholdHandler(); } break; } diff --git a/linux/devices/RwPollingTask.cpp b/linux/devices/RwPollingTask.cpp index a0008082..1c209ed3 100644 --- a/linux/devices/RwPollingTask.cpp +++ b/linux/devices/RwPollingTask.cpp @@ -183,7 +183,7 @@ ReturnValue_t RwPollingTask::writeAndReadAllRws(DeviceCommandId_t id) { if (skipCommandingForRw[idx]) { continue; } - ReturnValue_t result = sendOneMessage(fd, *rwCookies[idx]); + result = sendOneMessage(fd, *rwCookies[idx]); if (result != returnvalue::OK) { closeSpi(fd); return returnvalue::FAILED; @@ -479,7 +479,7 @@ ReturnValue_t RwPollingTask::pullCsLow(gpioId_t gpioId, GpioIF& gpioIF) { } // Pull SPI CS low. For now, no support for active high given if (gpioId != gpio::NO_GPIO) { - ReturnValue_t result = gpioIF.pullLow(gpioId); + result = gpioIF.pullLow(gpioId); if (result != returnvalue::OK) { sif::error << "RwPollingTask::pullCsLow: Failed to pull chip select low" << std::endl; return result; diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index 8537d011..086ef661 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -119,7 +119,7 @@ ReturnValue_t PlocSupervisorHandler::executeAction(ActionId_t actionId, case MEMORY_CHECK_WITH_FILE: { shutdownCmdSent = false; UpdateParams params; - ReturnValue_t result = extractBaseParams(&data, size, params); + result = extractBaseParams(&data, size, params); if (result != returnvalue::OK) { return result; } diff --git a/linux/devices/startracker/StarTrackerHandler.cpp b/linux/devices/startracker/StarTrackerHandler.cpp index 21f7174e..a868a22b 100644 --- a/linux/devices/startracker/StarTrackerHandler.cpp +++ b/linux/devices/startracker/StarTrackerHandler.cpp @@ -1909,7 +1909,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() { if (internalState == InternalState::VERIFY_BOOT) { sif::warning << "StarTrackerHandler::checkProgram: Failed to boot firmware" << std::endl; // Device handler will run into timeout and fall back to transition source mode - triggerEvent(BOOTING_FIRMWARE_FAILED); + triggerEvent(BOOTING_FIRMWARE_FAILED_EVENT); internalState = InternalState::FAILED_FIRMWARE_BOOT; } else if (internalState == InternalState::BOOTLOADER_CHECK) { internalState = InternalState::DONE; @@ -1922,7 +1922,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() { if (internalState == InternalState::VERIFY_BOOT) { internalState = InternalState::LOGLEVEL; } else if (internalState == InternalState::BOOTLOADER_CHECK) { - triggerEvent(BOOTING_BOOTLOADER_FAILED); + triggerEvent(BOOTING_BOOTLOADER_FAILED_EVENT); internalState = InternalState::BOOTING_BOOTLOADER_FAILED; } break; diff --git a/linux/devices/startracker/StarTrackerHandler.h b/linux/devices/startracker/StarTrackerHandler.h index 029b2bde..3ed81047 100644 --- a/linux/devices/startracker/StarTrackerHandler.h +++ b/linux/devices/startracker/StarTrackerHandler.h @@ -140,9 +140,9 @@ class StarTrackerHandler : public DeviceHandlerBase { static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::STR_HANDLER; //! [EXPORT] : [COMMENT] Failed to boot firmware - static const Event BOOTING_FIRMWARE_FAILED = MAKE_EVENT(1, severity::LOW); + static const Event BOOTING_FIRMWARE_FAILED_EVENT = MAKE_EVENT(1, severity::LOW); //! [EXPORT] : [COMMENT] Failed to boot star tracker into bootloader mode - static const Event BOOTING_BOOTLOADER_FAILED = MAKE_EVENT(2, severity::LOW); + static const Event BOOTING_BOOTLOADER_FAILED_EVENT = MAKE_EVENT(2, severity::LOW); static const size_t MAX_PATH_SIZE = 50; static const size_t MAX_FILE_NAME = 30; diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index b6b684e9..3244280e 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -330,12 +330,12 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { FrameAna_t frameAna = static_cast((pdecFar & FRAME_ANA_MASK) >> FRAME_ANA_POSITION); switch (frameAna) { case (FrameAna_t::ABANDONED_CLTU): { - triggerEvent(INVALID_TC_FRAME, ABANDONED_CLTU); + triggerEvent(INVALID_TC_FRAME, ABANDONED_CLTU_RETVAL); sif::warning << "PdecHandler::checkFrameAna: Abondoned CLTU" << std::endl; break; } case (FrameAna_t::FRAME_DIRTY): { - triggerEvent(INVALID_TC_FRAME, FRAME_DIRTY); + triggerEvent(INVALID_TC_FRAME, FRAME_DIRTY_RETVAL); sif::warning << "PdecHandler::checkFrameAna: Frame dirty" << std::endl; break; } @@ -350,13 +350,13 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) { break; } case (FrameAna_t::AD_DISCARDED_LOCKOUT): { - triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); + triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT_RETVAL); sif::warning << "PdecHandler::checkFrameAna: AD frame discarded because of lockout" << std::endl; break; } case (FrameAna_t::AD_DISCARDED_WAIT): { - triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT); + triggerEvent(INVALID_TC_FRAME, AD_DISCARDED_LOCKOUT_RETVAL); sif::warning << "PdecHandler::checkFrameAna: AD frame discarded because of wait" << std::endl; break; } @@ -385,40 +385,40 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) { IReason_t ireason = static_cast((pdecFar & IREASON_MASK) >> IREASON_POSITION); switch (ireason) { case (IReason_t::NO_REPORT): { - triggerEvent(INVALID_TC_FRAME, parameter1, NO_REPORT); + triggerEvent(INVALID_TC_FRAME, parameter1, NO_REPORT_RETVAL); sif::info << "PdecHandler::handleIReason: No illegal report" << std::endl; break; } case (IReason_t::ERROR_VERSION_NUMBER): { - triggerEvent(INVALID_TC_FRAME, parameter1, ERROR_VERSION_NUMBER); + triggerEvent(INVALID_TC_FRAME, parameter1, ERROR_VERSION_NUMBER_RETVAL); sif::info << "PdecHandler::handleIReason: Error in version number and reserved A and B " << "fields" << std::endl; break; } case (IReason_t::ILLEGAL_COMBINATION): { - triggerEvent(INVALID_TC_FRAME, parameter1, ILLEGAL_COMBINATION); + triggerEvent(INVALID_TC_FRAME, parameter1, ILLEGAL_COMBINATION_RETVAL); sif::info << "PdecHandler::handleIReason: Illegal combination (AC) of bypass and control " << "command flags" << std::endl; break; } case (IReason_t::INVALID_SC_ID): { - triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_SC_ID); + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_SC_ID_RETVAL); sif::info << "PdecHandler::handleIReason: Invalid spacecraft identifier " << std::endl; break; } case (IReason_t::INVALID_VC_ID_MSB): { - triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_MSB); + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_MSB_RETVAL); sif::info << "PdecHandler::handleIReason: VC identifier bit 0 to 4 did not match " << std::endl; break; } case (IReason_t::INVALID_VC_ID_LSB): { - triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_LSB); + triggerEvent(INVALID_TC_FRAME, parameter1, INVALID_VC_ID_LSB_RETVAL); sif::info << "PdecHandler::handleIReason: VC identifier bit 5 did not match " << std::endl; break; } case (IReason_t::NS_NOT_ZERO): { - triggerEvent(INVALID_TC_FRAME, parameter1, NS_NOT_ZERO); + triggerEvent(INVALID_TC_FRAME, parameter1, NS_NOT_ZERO_RETVAL); sif::info << "PdecHandler::handleIReason: N(S) of BC or BD frame not set to all zeros" << std::endl; break; diff --git a/linux/ipcore/PdecHandler.h b/linux/ipcore/PdecHandler.h index 32692dd8..b514f501 100644 --- a/linux/ipcore/PdecHandler.h +++ b/linux/ipcore/PdecHandler.h @@ -97,30 +97,30 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc static constexpr Modes OP_MODE = Modes::IRQ; - static const ReturnValue_t ABANDONED_CLTU = MAKE_RETURN_CODE(0xA0); - static const ReturnValue_t FRAME_DIRTY = MAKE_RETURN_CODE(0xA1); + static const ReturnValue_t ABANDONED_CLTU_RETVAL = MAKE_RETURN_CODE(0xA0); + static const ReturnValue_t FRAME_DIRTY_RETVAL = MAKE_RETURN_CODE(0xA1); static const ReturnValue_t FRAME_ILLEGAL_ONE_REASON = MAKE_RETURN_CODE(0xA2); static const ReturnValue_t FRAME_ILLEGAL_MULTIPLE_REASONS = MAKE_RETURN_CODE(0xA2); - static const ReturnValue_t AD_DISCARDED_LOCKOUT = MAKE_RETURN_CODE(0xA3); - static const ReturnValue_t AD_DISCARDED_WAIT = MAKE_RETURN_CODE(0xA4); + static const ReturnValue_t AD_DISCARDED_LOCKOUT_RETVAL = MAKE_RETURN_CODE(0xA3); + static const ReturnValue_t AD_DISCARDED_WAIT_RETVAL = MAKE_RETURN_CODE(0xA4); static const ReturnValue_t AD_DISCARDED_NS_VS = MAKE_RETURN_CODE(0xA5); //! [EXPORT] : [COMMENT] Received action message with unknown action id static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xB0); - static const ReturnValue_t NO_REPORT = MAKE_RETURN_CODE(0xA6); + static const ReturnValue_t NO_REPORT_RETVAL = MAKE_RETURN_CODE(0xA6); //! Error in version number and reserved A and B fields - static const ReturnValue_t ERROR_VERSION_NUMBER = MAKE_RETURN_CODE(0xA7); + static const ReturnValue_t ERROR_VERSION_NUMBER_RETVAL = MAKE_RETURN_CODE(0xA7); //! Illegal combination of bypass and control command flag - static const ReturnValue_t ILLEGAL_COMBINATION = MAKE_RETURN_CODE(0xA8); + static const ReturnValue_t ILLEGAL_COMBINATION_RETVAL = MAKE_RETURN_CODE(0xA8); //! Spacecraft identifier did not match - static const ReturnValue_t INVALID_SC_ID = MAKE_RETURN_CODE(0xA9); + static const ReturnValue_t INVALID_SC_ID_RETVAL = MAKE_RETURN_CODE(0xA9); //! VC identifier bits 0 to 4 did not match - static const ReturnValue_t INVALID_VC_ID_MSB = MAKE_RETURN_CODE(0xAA); + static const ReturnValue_t INVALID_VC_ID_MSB_RETVAL = MAKE_RETURN_CODE(0xAA); //! VC identifier bit 5 did not match - static const ReturnValue_t INVALID_VC_ID_LSB = MAKE_RETURN_CODE(0xAB); + static const ReturnValue_t INVALID_VC_ID_LSB_RETVAL = MAKE_RETURN_CODE(0xAB); //! N(S) of BC or BD frame not set to all zeros - static const ReturnValue_t NS_NOT_ZERO = MAKE_RETURN_CODE(0xAC); + static const ReturnValue_t NS_NOT_ZERO_RETVAL = MAKE_RETURN_CODE(0xAC); //! Invalid BC control command static const ReturnValue_t INVALID_BC_CC = MAKE_RETURN_CODE(0xAE); diff --git a/misc/eclipse/.cproject b/misc/eclipse/.cproject index 0f3348a8..4cfe3fa1 100644 --- a/misc/eclipse/.cproject +++ b/misc/eclipse/.cproject @@ -58,7 +58,6 @@ - @@ -121,7 +120,6 @@ - @@ -190,7 +188,6 @@ - @@ -259,7 +256,6 @@ - @@ -423,7 +419,6 @@ - @@ -586,7 +581,6 @@ - @@ -756,8 +750,7 @@ - - + @@ -925,7 +918,6 @@ - @@ -1326,7 +1318,6 @@ - @@ -1496,9 +1487,6 @@ - - - @@ -1541,9 +1529,6 @@ - - - diff --git a/mission/controller/acs/SensorProcessing.cpp b/mission/controller/acs/SensorProcessing.cpp index 24547247..0845768a 100644 --- a/mission/controller/acs/SensorProcessing.cpp +++ b/mission/controller/acs/SensorProcessing.cpp @@ -567,7 +567,7 @@ void SensorProcessing::processGps(const double gpsLatitude, const double gpsLong gcLatitude = atan(factor * tan(latitudeRad)); // Calculation of the satellite velocity in earth fixed frame - double posSatE[3] = {0, 0, 0}, deltaDistance[3] = {0, 0, 0}, gpsVelocityE[3] = {0, 0, 0}; + double deltaDistance[3] = {0, 0, 0}; MathOperations::cartesianFromLatLongAlt(latitudeRad, gdLongitude, gpsAltitude, posSatE); if (validSavedPosSatE && (gpsUnixSeconds - timeOfSavedPosSatE) < (gpsParameters->timeDiffVelocityMax)) { diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index 43f53bf7..9600c0db 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -289,7 +289,7 @@ void HeaterHandler::handleSwitchOffCommand(heater::Switchers heaterIdx) { << " low" << std::endl; triggerEvent(GPIO_PULL_LOW_FAILED, result); } else { - auto result = heaterMutex->lockMutex(); + result = heaterMutex->lockMutex(); heater.switchState = OFF; if (result == returnvalue::OK) { heaterMutex->unlockMutex(); diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 6e7c1cc0..13da2784 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -163,10 +163,10 @@ ReturnValue_t RwHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_ RwReplies replies(packet); ReturnValue_t result = returnvalue::OK; ReturnValue_t status; - auto checkPacket = [&](DeviceCommandId_t id, const uint8_t* packetPtr) { + auto checkPacket = [&](DeviceCommandId_t currentId, const uint8_t* packetPtr) { // This is just the packet length of the frame from the RW. The actual // data is one more flag byte to show whether the value was read at least once. - auto packetLen = rws::idToPacketLen(id); + auto packetLen = rws::idToPacketLen(currentId); // arrayprinter::print(packetPtr, packetLen); uint16_t replyCrc; size_t dummy = 0; diff --git a/mission/system/objects/AcsSubsystem.cpp b/mission/system/objects/AcsSubsystem.cpp index d24572af..edb1c6d3 100644 --- a/mission/system/objects/AcsSubsystem.cpp +++ b/mission/system/objects/AcsSubsystem.cpp @@ -59,12 +59,13 @@ void AcsSubsystem::handleEventMessages() { EventMessage event; for (ReturnValue_t result = eventQueue->receiveMessage(&event); result == returnvalue::OK; result = eventQueue->receiveMessage(&event)) { + ReturnValue_t status; switch (event.getMessageId()) { case EventMessage::EVENT_MESSAGE: if (event.getEvent() == acs::SAFE_RATE_VIOLATION) { CommandMessage msg; ModeMessage::setCmdModeMessage(msg, acs::AcsMode::DETUMBLE, 0); - ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg); + status = commandQueue->sendMessage(commandQueue->getId(), &msg); if (result != returnvalue::OK) { sif::error << "AcsSubsystem: sending DETUMBLE mode cmd to self has failed" << std::endl; } @@ -73,8 +74,8 @@ void AcsSubsystem::handleEventMessages() { event.getEvent() == acs::MULTIPLE_RW_INVALID) { CommandMessage msg; ModeMessage::setCmdModeMessage(msg, acs::AcsMode::SAFE, 0); - ReturnValue_t result = commandQueue->sendMessage(commandQueue->getId(), &msg); - if (result != returnvalue::OK) { + status = commandQueue->sendMessage(commandQueue->getId(), &msg); + if (status != returnvalue::OK) { sif::error << "AcsSubsystem: sending SAFE mode cmd to self has failed" << std::endl; } } From 706e3c88826358c7d2c7014a6f5760d6832deefb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 17 Feb 2023 12:20:29 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5db00eb..7bc31de1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,10 @@ change warranting a new major release: # [unreleased] +## Changed + +- Add `-Wshadow=local` shadowing warnings and fixed all of them + # [v1.28.0] 2023-02-17 eive-tmtc: v2.12.7