This code generates what is likelly a false positive:
#include<string>#define TYPE_1 "a"#define TYPE_2 "b"#define TYPE_3 "c"voidRestore(conststd::string&channel){if(channel==TYPE_1){}elseif(channel==TYPE_2||channel==TYPE_3){// common code for TYPE_2 and TYPE_3if(channel==TYPE_2)// reporting "warning : Opposite inner 'if' condition leads to a dead code block."{// specific code for TYPE_2}elseif(channel==TYPE_3){// specific code for TYPE_3}}}
Last edit: Jean Porcherot 2024-10-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code generates what is likelly a false positive:
Last edit: Jean Porcherot 2024-10-09
Thanks for reporting, ticket is here; https://trac.cppcheck.net/ticket/13202