Hello, I'm seeing a false positive for MISRA 9.2: Required. The initializer for an aggregate or union shall be enclosed in braces.
#define CELL_VOLTAGE_CHANNELS (14U) #define MODULE_TEMP_CHANNELS (4U) #define ONBOARD_TEMP_CHANNELS (3U) #define MAX_PCU_CNT (8U) #define MAX_MCU_CNT (8U) typedef struct __attribute__((__packed__)) { uint16_t cellV[CELL_VOLTAGE_CHANNELS]; uint16_t modV; int16_t moduleTemp[MODULE_TEMP_CHANNELS]; int16_t onboardTemp[ONBOARD_TEMP_CHANNELS]; uint16_t balanceFlags; uint8_t minCellIndex; uint8_t maxCellIndex; }McuData_t; typedef struct __attribute__((__packed__)) { uint8_t mcuCnt; McuData_t mcu[MAX_MCU_CNT]; int32_t current; uint8_t contactorStatus; uint32_t faultStatus; uint16_t packV; }PcuData_t; PcuData_t PcuData[MAX_PCU_CNT] = { [0 ... (MAX_PCU_CNT - 1)].mcuCnt = 1, // Default MCU count is 1 at a minimum [0 ... (MAX_PCU_CNT - 1)].current = 0, [0 ... (MAX_PCU_CNT - 1)].contactorStatus = 0, [0 ... (MAX_PCU_CNT - 1)].faultStatus = 0, [0 ... (MAX_PCU_CNT - 1)].packV = 0 };
Hello, Amir,
Thanks for the report. The implementation of MISRA 9.2-9.5 rules was changed in the recent PR. Currently, the addon crashes on your code.
I created this ticket: https://trac.cppcheck.net/ticket/10043
Hello Georgiy,
This is still an issue with cppcheck 2.3 with the latest pull from the main branch.
I can't reproduce. See: https://sourceforge.net/p/cppcheck/discussion/general/thread/d0a109d572/#3ac5/d67b .
Hi Georgiy, I was able to resolve the issue. Thank you for all the help!
Regards, Amir
Log in to post a comment.
Hello,
I'm seeing a false positive for MISRA 9.2: Required. The initializer for an aggregate or union shall be enclosed in braces.
Hello, Amir,
Thanks for the report. The implementation of MISRA 9.2-9.5 rules was changed in the recent PR. Currently, the addon crashes on your code.
I created this ticket: https://trac.cppcheck.net/ticket/10043
Last edit: Georgiy Komarov 2020-12-17
Hello Georgiy,
This is still an issue with cppcheck 2.3 with the latest pull from the main branch.
I can't reproduce. See: https://sourceforge.net/p/cppcheck/discussion/general/thread/d0a109d572/#3ac5/d67b .
Hi Georgiy,
I was able to resolve the issue. Thank you for all the help!
Regards,
Amir