[Webkit-unassigned] [Bug 26630] New: Annotate WTF assertion methods to prevent false-positives from clang static analyzer

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 22 16:15:33 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=26630

           Summary: Annotate WTF assertion methods to prevent false-
                    positives from clang static analyzer
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh
               URL: http://clang-
                    analyzer.llvm.org/annotations.html#custom_assertions
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: ddkilzer at webkit.org
                CC: mrowe at apple.com


* SUMMARY
When using the clang static analyzer on C and Objective-C source code that uses
ASSERT() macros, the following false-positive issue is reported:

source.m:7:5: warning: Called function pointer is a null or undefined pointer
value
     ASSERT(ptr);
     ^
Assertions.h:165:9: note: instantiated from:
         CRASH(); \
         ^
Assertions.h:134:5: note: instantiated from:
     ((void(*)())0)(); /* More reliable, but doesn't say BBADBEEF */ \
     ^
1 diagnostic generated.

* RESOLUTION
The fix is to annotate the WTFReport*() methods in Assertions.h with an
attribute that tells the clang static analyzer that this method effectively
never returns.  That, in turn, prevents the false positive issue in the CRASH()
macro from being emitted.  This has the desired effect of squelching the false
positive.

* NOTES
See the URL for more details about this custom annotation and how it's used by
the clang static analyzer.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list