enabled more GCC warnings #174

Merged
meierj merged 3 commits from mueller/additional-gcc-warnings into develop 2022-03-08 10:12:48 +01:00
16 changed files with 70 additions and 31 deletions

View File

@ -159,24 +159,42 @@ find_package(Catch2 3)
#global compiler options need to be set before adding executables #global compiler options need to be set before adding executables
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options( add_compile_options(
"-Wall" "-Wall"
"-Wextra" "-Wextra"
"-Wimplicit-fallthrough=1" "-Wimplicit-fallthrough=1"
"-Wno-unused-parameter" "-Wno-unused-parameter"
"-Wno-psabi" "-Wno-psabi"
) "-Wduplicated-cond" # check for duplicate conditions
# Remove unused sections. "-Wduplicated-branches" # check for duplicate branches
add_compile_options( "-Wlogical-op" # Search for bitwise operations instead of logical
"-ffunction-sections" "-Wnull-dereference" # Search for NULL dereference
"-fdata-sections" "-Wundef" # Warn if undefind marcos are used
) "-Wformat=2" # Format string problem detection
"-Wformat-overflow=2" # Formatting issues in printf
"-Wformat-truncation=2" # Formatting issues in printf
"-Wformat-security" # Search for dangerous printf operations
"-Wstrict-overflow=3" # Warn if integer overflows might happen
"-Warray-bounds=2" # Some array bounds violations will be found
"-Wshift-overflow=2" # Search for bit left shift overflows (<c++14)
"-Wcast-qual" # Warn if the constness is cast away
"-Wstringop-overflow=4"
# -Wstack-protector # Emits a few false positives for low level access
# -Wconversion # Creates many false positives
# -Warith-conversion # Use with Wconversion to find more implicit conversions
# -fanalyzer # Should be used to look through problems
)
# Remove unused sections.
add_compile_options(
"-ffunction-sections"
"-fdata-sections"
)
# Removed unused sections.
add_link_options(
"-Wl,--gc-sections"
)
# Removed unused sections.
add_link_options(
"-Wl,--gc-sections"
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(COMPILER_FLAGS "/permissive-") set(COMPILER_FLAGS "/permissive-")
endif() endif()

View File

@ -29,6 +29,10 @@
#define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0 #define Q7S_SIMPLE_ADD_FILE_SYSTEM_TEST 0
#ifndef Q7S_SIMPLE_MODE
#define Q7S_SIMPLE_MODE 0
#endif
namespace config { namespace config {
static const uint32_t SD_CARD_ACCESS_MUTEX_TIMEOUT = 50; static const uint32_t SD_CARD_ACCESS_MUTEX_TIMEOUT = 50;

View File

@ -1,6 +1,7 @@
#ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ #ifndef MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_ #define MISSION_DEVICES_PLOCSUPERVISORHANDLER_H_
#include "OBSWConfig.h"
#include <bsp_q7s/memory/SdCardManager.h> #include <bsp_q7s/memory/SdCardManager.h>
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw_hal/linux/uart/UartComIF.h> #include <fsfw_hal/linux/uart/UartComIF.h>

View File

@ -1,6 +1,8 @@
#include "SdCardManager.h" #include "SdCardManager.h"
#include "OBSWConfig.h"
#include <fsfw/ipc/MutexGuard.h> #include <fsfw/ipc/MutexGuard.h>
#include <fsfw/timemanager/Countdown.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
@ -404,16 +406,13 @@ SdCardManager::OpStatus SdCardManager::checkCurrentOp(Operations& currentOp) {
bool bytesRead = false; bool bytesRead = false;
#if OBSW_ENABLE_TIMERS == 1 #if OBSW_ENABLE_TIMERS == 1
Timer timer; Countdown timer(100);
timer.setTimer(100);
uint32_t remainingTimeMs = 0;
#endif #endif
while (true) { while (true) {
ReturnValue_t result = cmdExecutor.check(bytesRead); ReturnValue_t result = cmdExecutor.check(bytesRead);
// This timer can prevent deadlocks due to missconfigurations // This timer can prevent deadlocks due to missconfigurations
#if OBSW_ENABLE_TIMERS == 1 #if OBSW_ENABLE_TIMERS == 1
timer.getTimer(&remainingTimeMs); if (timer.hasTimedOut()) {
if (remainingTimeMs == 0) {
sif::error << "SdCardManager::checkCurrentOp: Timeout!" << std::endl; sif::error << "SdCardManager::checkCurrentOp: Timeout!" << std::endl;
return OpStatus::FAIL; return OpStatus::FAIL;
} }

View File

@ -12,7 +12,7 @@
// because UDP packets are not allowed in the VPN // because UDP packets are not allowed in the VPN
// This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the // This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the
// CCSDS IP Cores. // CCSDS IP Cores.
#define OBSW_USE_TCP_BRIDGE 1 #define OBSW_USE_TMTC_TCP_BRIDGE 1
namespace common { namespace common {
extern const uint16_t PUS_PACKET_ID; extern const uint16_t PUS_PACKET_ID;

View File

@ -41,4 +41,8 @@
* copy & replace here settings you want to change values * copy & replace here settings you want to change values
*/ */
#ifndef __DOXYGEN__
#define __DOXYGEN__ 0
#endif
#endif /* LWGPS_HDR_OPTS_H */ #endif /* LWGPS_HDR_OPTS_H */

2
fsfw

@ -1 +1 @@
Subproject commit d6c1041133822903c123e4efd890b1320e1157c9 Subproject commit 84f95e8d7641be7a83faf1cbee718c6cc5de152d

@ -1 +1 @@
Subproject commit 52f291692c4074a23743c799148b0432a4e405fa Subproject commit c5ef1783a3b082c0e88561bd91bc3ee0f459fafc

View File

@ -14,6 +14,10 @@
#define GPS_REPLY_WIRETAPPING 0 #define GPS_REPLY_WIRETAPPING 0
#ifndef RPI_TEST_GPS_HANDLER
#define RPI_TEST_GPS_HANDLER 0
#endif
UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; } UartTestClass::UartTestClass(object_id_t objectId) : TestTask(objectId) { mode = TestModes::SCEX; }
ReturnValue_t UartTestClass::initialize() { ReturnValue_t UartTestClass::initialize() {

View File

@ -1,5 +1,6 @@
#include "GPSHyperionLinuxController.h" #include "GPSHyperionLinuxController.h"
#include "OBSWConfig.h"
#include "fsfw/datapool/PoolReadGuard.h" #include "fsfw/datapool/PoolReadGuard.h"
#include "fsfw/timemanager/Clock.h" #include "fsfw/timemanager/Clock.h"

View File

@ -5,6 +5,14 @@
#include <fsfw/serviceinterface/ServiceInterfaceStream.h> #include <fsfw/serviceinterface/ServiceInterfaceStream.h>
#include <fsfw/tasks/FixedTimeslotTaskIF.h> #include <fsfw/tasks/FixedTimeslotTaskIF.h>
#ifndef RPI_TEST_ADIS16507
#define RPI_TEST_ADIS16507 0
#endif
#ifndef RPI_TEST_GPS_HANDLER
#define RPI_TEST_GPS_HANDLER 0
#endif
ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) { ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
// Length of a communication cycle // Length of a communication cycle
uint32_t length = thisSequence->getPeriodMs(); uint32_t length = thisSequence->getPeriodMs();

View File

@ -45,4 +45,4 @@ ReturnValue_t ThermalController::checkModeCommand(Mode_t mode, Submode_t submode
return INVALID_MODE; return INVALID_MODE;
} }
return RETURN_OK; return RETURN_OK;
} }

View File

@ -24,7 +24,7 @@
#include "objects/systemObjectList.h" #include "objects/systemObjectList.h"
#if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0 #if OBSW_USE_TMTC_TCP_BRIDGE == 0
// UDP server includes // UDP server includes
#include "fsfw/osal/common/UdpTcPollingTask.h" #include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h" #include "fsfw/osal/common/UdpTmTcBridge.h"
@ -90,7 +90,7 @@ void ObjectFactory::produceGenericObjects() {
pus::PUS_SERVICE_200); pus::PUS_SERVICE_200);
#if OBSW_ADD_TCPIP_BRIDGE == 1 #if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TCP_BRIDGE == 0 #if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR); auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE); new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
sif::info << "Created UDP server for TMTC commanding with listener port " sif::info << "Created UDP server for TMTC commanding with listener port "

View File

@ -23,7 +23,7 @@ void ACUHandler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pack
parseHkTableReply(packet); parseHkTableReply(packet);
handleDeviceTM(&acuHkTableDataset, id, true); handleDeviceTM(&acuHkTableDataset, id, true);
#if OBSW_ENHANCED_PRINTOUT == 1 && OBSW_DEBUG_ACU == 1 #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_ACU == 1
acuHkTableDataset.read(); acuHkTableDataset.read();
float temperatureC_1 = acuHkTableDataset.temperature1.value * 0.1; float temperatureC_1 = acuHkTableDataset.temperature1.value * 0.1;
float temperatureC_2 = acuHkTableDataset.temperature2.value * 0.1; float temperatureC_2 = acuHkTableDataset.temperature2.value * 0.1;

@ -1 +1 @@
Subproject commit b1594df9303056456604726592635d8a1c987e75 Subproject commit 93e93965e2c6405170b62c523dea1990db02d2ad

2
tmtc

@ -1 +1 @@
Subproject commit 37c1a68da1b465514e84403b06ce40d035e4ad88 Subproject commit abe9c8bc000e834b99a2c367ed10f927eeb666b0