[LLVMbugs] [Bug 19785] New: -Wempty-body false negative on NULL check

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun May 18 08:34:11 PDT 2014


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

            Bug ID: 19785
           Summary: -Wempty-body false negative on NULL check
           Product: clang
           Version: 3.4
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: publicposting at lapcatsoftware.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

-Wempty-body false negatives for 3 and 4 below.

$ cat > empty.c
#include <stddef.h>

int main( int argc, const char **argv )
{
    if ( !argv );
        return 1;

    if ( argv );
        return 2;

    if ( argv == NULL );
        return 3;

    if ( argv != NULL );
        return 4;

    if ( NULL == argv );
        return 5;

    if ( NULL != argv );
        return 6;

    return 0;
}
$ clang -Wempty-body empty.c 
empty.c:5:14: warning: if statement has empty body [-Wempty-body]
        if ( !argv );
                    ^
empty.c:5:14: note: put the semicolon on a separate line to silence this
warning
empty.c:8:13: warning: if statement has empty body [-Wempty-body]
        if ( argv );
                   ^
empty.c:8:13: note: put the semicolon on a separate line to silence this
warning
empty.c:17:21: warning: if statement has empty body [-Wempty-body]
        if ( NULL == argv );
                           ^
empty.c:17:21: note: put the semicolon on a separate line to silence this
warning
empty.c:20:21: warning: if statement has empty body [-Wempty-body]
        if ( NULL != argv );
                           ^
empty.c:20:21: note: put the semicolon on a separate line to silence this
warning
4 warnings generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140518/0ce90c65/attachment.html>


More information about the llvm-bugs mailing list