From dea37f26ab87feb223dcccd2592cb74ae9171047 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 9 Jun 2012 20:10:45 +0000 Subject: [PATCH] Add CSS style for FAQ questions, and restate FAQ questions as actual questions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158282 91177308-0d34-0410-b5e6-96231b3b80d8 --- www/analyzer/content.css | 5 +++++ www/analyzer/faq.html | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/www/analyzer/content.css b/www/analyzer/content.css index b22cca9ff5..6a1cfe7198 100644 --- a/www/analyzer/content.css +++ b/www/analyzer/content.css @@ -15,6 +15,11 @@ h1 { padding-top:0px; margin-top:0px;} h2 { color:#333333; padding-top:0.5em; } h3 { padding-top: 0.5em; margin-bottom: -0.25em; color:#2d58b7 } h4 { color:#2d58b7 } +h4.faq { margin-top:4em; + color:black; + border-width:1px; border-style:solid; + border-color:#cccccc; + background-color:#eeeeee; padding:10px } li { padding-bottom: 0.5em } ul { padding-left:1.5em; } diff --git a/www/analyzer/faq.html b/www/analyzer/faq.html index 1859e78926..94e4d27923 100644 --- a/www/analyzer/faq.html +++ b/www/analyzer/faq.html @@ -7,7 +7,7 @@ @@ -19,25 +19,35 @@

FAQ and How to Deal with Common False Positives

-

Q: The analyzer reports a bug on an error path. I do not want the bug being reported here since my custom error handler will safely end the execution before the bug is reached.

+

Q: How do I tell the analyzer that I do not want the bug being +reported here since my custom error handler will safely end the execution before +the bug is reached?

example custom assert

You can tell the analyzer that this path is unreachable by teaching it about your custom assertion handlers.

-

Q: The analyzer reports "Dereference of null pointer", but I know that the pointer is never null.

+

Q: The analyzer reports a null dereference, but I know that the +pointer is never null. How can I tell the analyzer that a pointer can never be +null?

example null pointer -

The reason the analyzer often thinks that a pointer can be null is because the preceding code checked compared it against null. So if you are absolutely sure that it cannot be null, remove the preceding check and, preferably, add an assert as well. For example, in the code segment above, it will be sufficient to remove the if (!b) check.

+

The reason the analyzer often thinks that a pointer can be null is because the preceding code checked compared it against null. So if you are absolutely sure that it cannot be null, remove the preceding check and, preferably, add an assertion as well. For example, in the code segment above, it will be sufficient to remove the if (!b) check.

-

Q: The analyzer assumes that the loop body is never entered, which can never happen in this code.

+

Q: 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?

example use assert -

You can teach the analyzer facts about your code as well as document it by using asserts. In the contrived example above, the analyzer reports an error on the path which assumes that the loop is never entered. However, the owner of the code might know that the loop is always entered because the input parameter length is always greater than 0. The false positive can be suppressed by asserting this knowledge, adding assert(length > 0) in the beginning of the function.

+

You can teach the analyzer facts about your code as well as document it by +using assertions. In the contrived example above, the analyzer reports an error +on the path which assumes that the loop is never entered. However, the owner of +the code might know that the loop is always entered because the input parameter +length is always greater than 0. The false positive can be +suppressed by asserting this knowledge, adding assert(length > 0) in +the beginning of the function.

-

Q: How can I suppress the analyzer warning?

+

Q: How can I suppress a specific analyzer warning?

example null pointer -- 2.40.0