I had a few false positives - at least the messages would need to be updated (PossiblyAlwaysFalse, conditionTrueFalseWithoutOverflow, ...).
Test case:
#include<stdint.h>// Test case for cppcheck// Run with// cppcheck --enable=style,portability,warning,performance,unusedFunction test.c// Results from cppcheck 2.16.0 - all false positive because overflow is expecteduint8_tpage_count=0;uint8_tpage_no=0;voidinc_address(void){// test.c:13:30: note: Assignment 'page_count=page_count+16', assigned valueisgreaterthan15page_count=(page_count+16);// test.c:15:20: style: Condition 'page_count==0' is always false [knownConditionTrueFalse]if(page_count==0){page_no++;set_page_address(page_no);}}intmain(){uint8_ti=0;// test.c:24:9: style: Condition '++i' is always true [knownConditionTrueFalse]while(++i){inc_address();}}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
I had a few false positives - at least the messages would need to be updated (PossiblyAlwaysFalse, conditionTrueFalseWithoutOverflow, ...).
Test case:
Probably an instance of https://trac.cppcheck.net/ticket/10616