From 466bf0ffb7bed9c819454f7930ad68bce4f8db85 Mon Sep 17 00:00:00 2001 From: Freddie Chopin Date: Mon, 4 May 2020 17:56:11 +0200 Subject: [PATCH 1/2] Fix "comparison of integer expressions of different signedness" warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With -Wextra GCC gives: socketCAN/CO_driver.c: In function ‘setRxFilters’: socketCAN/CO_driver.c:159:19: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] 159 | for (i = 0; i < CANmodule->CANinterfaceCount; i ++) { | ^ --- socketCAN/CO_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socketCAN/CO_driver.c b/socketCAN/CO_driver.c index 818a595..662f628 100644 --- a/socketCAN/CO_driver.c +++ b/socketCAN/CO_driver.c @@ -131,7 +131,7 @@ static CO_ReturnError_t disableRx(CO_CANmodule_t *CANmodule) static CO_ReturnError_t setRxFilters(CO_CANmodule_t *CANmodule) { int ret; - int i; + size_t i; int count; CO_ReturnError_t retval; From e88ecb894eb73d611e2e6685474d81cf9ffb435d Mon Sep 17 00:00:00 2001 From: Freddie Chopin Date: Wed, 6 May 2020 16:29:23 +0200 Subject: [PATCH 2/2] Fix "unused parameter" warnings Some functions have a signature required by API, thus they have arguments which will be unused. Fix by casting to void. --- 305/CO_LSSmaster.c | 4 ++++ 305/CO_LSSslave.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/305/CO_LSSmaster.c b/305/CO_LSSmaster.c index 0771f48..2a94b8f 100644 --- a/305/CO_LSSmaster.c +++ b/305/CO_LSSmaster.c @@ -811,6 +811,8 @@ static CO_LSSmaster_return_t CO_LSSmaster_FsScanInitiate( CO_LSSmaster_scantype_t scan, CO_LSS_fastscan_lss_sub_next lssSub) { + (void)timeDifference_us; /* unused */ + LSSmaster->fsLssSub = lssSub; LSSmaster->fsIdNumber = 0; @@ -900,6 +902,8 @@ static CO_LSSmaster_return_t CO_LSSmaster_FsVerifyInitiate( uint32_t idNumberCheck, CO_LSS_fastscan_lss_sub_next lssNext) { + (void)timeDifference_us; /* unused */ + switch (scan) { case CO_LSSmaster_FS_SCAN: /* ID obtained by scan */ diff --git a/305/CO_LSSslave.c b/305/CO_LSSslave.c index 111bb69..0ad1264 100644 --- a/305/CO_LSSslave.c +++ b/305/CO_LSSslave.c @@ -38,6 +38,8 @@ static void CO_LSSslave_serviceSwitchStateGlobal( CO_LSS_cs_t service, void *msg) { + (void)service; /* unused */ + uint8_t *data = CO_CANrxMsg_readData(msg); uint8_t mode = data[1]; @@ -224,6 +226,8 @@ static void CO_LSSslave_serviceInquire( CO_LSS_cs_t service, void *msg) { + (void)msg; /* unused */ + uint32_t value; if(LSSslave->lssState != CO_LSS_STATE_CONFIGURATION) { @@ -485,6 +489,8 @@ void CO_LSSslave_process( uint16_t *pendingBitRate, uint8_t *pendingNodeId) { + (void)activeBitRate; /* unused */ + LSSslave->activeNodeID = activeNodeId; *pendingBitRate = LSSslave->pendingBitRate; *pendingNodeId = LSSslave->pendingNodeID;