[LLVMbugs] [Bug 9193] New: clang should warn if 'else if' clause is same as any previous 'if' clause

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Feb 10 12:46:59 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9193

           Summary: clang should warn if 'else if' clause is same as any
                    previous 'if' clause
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sean at rogue-research.com
                CC: llvmbugs at cs.uiuc.edu


Consider the following C snippit:

    if (x == 5)
    {
        ...
    }
    else if (x == 5)
    {
        ...
    }

I've made a typo in the 'else if' and accidentally tested condition.

It would be nice it clang could warn when it sees this.

With raw ints it's easy to see the mistake, but when they are constants, and
two constants accidentally have the same value, it's harder to find.

It would be happy with this in either the compiler or static analyzer.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list