pfultz2/cppcheck

Catch duplicate if conditions

pfultz2 opened this issue · 1 comments

bool f();

void foo(int x) {
    if(f())
        x++;
    if(f())
        x += 2;
}

void bar(int x, bool b) {
    if(b)
        x++;
    if(b)
        x += 2;
}

There should be a warning for these conditionals.

Related issues: