We are running into an issue where it appears cppcheck is not calculating the size of an object correctly and is then calling out passedByValue
Here is the sample object with a bunch of different variations that all lead to an 8B value . Some work and others don't as denoted by the comments.
classtestObject{public:enumBase{Val1=0x0000};#if 0 // This failsBasebase:32;Baseext:16;uint16_tvalue;#elif 0 // This worksBasebase:32;uint32_tvalue;#elif 0 // This worksuint32_tbase;Baseext:16;uint16_tvalue;#elif 0 // This failsBasebase:32;Baseext:16;uint16_tvalue;#elif 0 // This failsBasebase1:16;Basebase2:16;Baseext:16;uint16_tvalue;#elif 0 // This worksBasebase1:32;Basebase2:32;#elif 0 // This worksBasebase1:32;uint16_tvalue;uint16_tvalue2;#elif 1 // This failsBasebase1:16;Basebase2:16;uint16_tvalue;uint16_tvalue2;#endif};
We are running into an issue where it appears cppcheck is not calculating the size of an object correctly and is then calling out passedByValue
Here is the sample object with a bunch of different variations that all lead to an 8B value . Some work and others don't as denoted by the comments.
I'm running cppcheck 2.17.1 as follows:
And our platform file has only one change from the unit64-unsigned.xml platform file provided by cppcheck
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/13850