From: Anna Zaks Date: Sat, 16 Jun 2012 00:30:21 +0000 (+0000) Subject: Make the analyzer site a single point of reference for info X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=843f0e87e5ab9b5b5c36b60e99a350d15679683a;p=clang Make the analyzer site a single point of reference for info on controlling diagnostics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158581 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.html b/docs/UsersManual.html index a0e5ed8e8c..ae9ebfa394 100644 --- a/docs/UsersManual.html +++ b/docs/UsersManual.html @@ -708,36 +708,11 @@ treated as a system header.

While not strictly part of the compiler, the diagnostics from Clang's static analyzer can also be influenced -by the user via changes to the source code. This can be done in two ways: - -

diff --git a/www/analyzer/faq.html b/www/analyzer/faq.html index 3633e8ee26..5c132b57f2 100644 --- a/www/analyzer/faq.html +++ b/www/analyzer/faq.html @@ -28,6 +28,7 @@ pointer is never null. How can I tell the analyzer that a pointer can never be null?
  • The analyzer assumes that a loop body is never entered. How can I tell it that the loop body will be entered at least once?
  • How can I suppress a specific analyzer warning?
  • +
  • How can I selectively exclude code the analyzer examines?
  • @@ -87,9 +88,30 @@ int foo(int length) {

    Q: How can I suppress a specific analyzer warning?

    -

    There is currently no mechanism for suppressing the analyzer warning, -although this is currently being investigated. If you encounter an analyzer -bug/false positive, please report it.

    +

    There is currently no solid mechanism for suppressing an analyzer warning, +although this is currently being investigated. When you encounter an analyzer +bug/false positive, check if it's one of the issues discussed above or if the +analyzer annotations can +resolve the issue. Second, please report it to +help us improve user experience. As the last resort, consider using __clang_analyzer__ macro +described below.

    + +

    Q: How can I selectively exclude code the analyzer examines?

    + +

    When the static analyzer is using clang to parse source files, it implicitly +defines the preprocessor macro __clang_analyzer__. One can use this +macro to selectively exclude code the analyzer examines. Here is an example: + +

    +#ifndef __clang_analyzer__
    +// Code not to be analyzed
    +#endif
    +
    + +This usage is discouraged because it makes the code dead to the analyzer from +now on. Instead, we prefer that users file bugs against the analyzer when it flags +false positives. +