Commit 13b76912 by David Malcolm

analyzer: don't print the duplicate count by default

The note about duplicates attached to analyzer diagnostics feels like an
implementation detail; it's likely just noise from the perspective of an
end-user.

This patch disables it by default, introducing a flag to re-enable it.

gcc/analyzer/ChangeLog:
	* analyzer.opt (fanalyzer-show-duplicate-count): New option.
	* diagnostic-manager.cc
	(diagnostic_manager::emit_saved_diagnostic): Use the above to
	guard the printing of the duplicate count.

gcc/ChangeLog:
	* doc/invoke.texi (-fanalyzer-show-duplicate-count): New.

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Add
	-fanalyzer-show-duplicate-count.
parent 6e444407
2020-03-02 David Malcolm <dmalcolm@redhat.com>
* doc/invoke.texi (-fanalyzer-show-duplicate-count): New.
2020-03-02 David Malcolm <dmalcolm@redhat.com>
* doc/invoke.texi (Static Analyzer Options): Add
-Wanalyzer-stale-setjmp-buffer to the list of options enabled
by -fanalyzer.
......
2020-03-02 David Malcolm <dmalcolm@redhat.com>
* analyzer.opt (fanalyzer-show-duplicate-count): New option.
* diagnostic-manager.cc
(diagnostic_manager::emit_saved_diagnostic): Use the above to
guard the printing of the duplicate count.
2020-03-02 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93959
* analyzer.cc (is_std_function_p): New function.
(is_std_named_call_p): New functions.
......
......@@ -114,6 +114,10 @@ fanalyzer-fine-grained
Common Var(flag_analyzer_fine_grained) Init(0)
Avoid combining multiple statements into one exploded edge.
fanalyzer-show-duplicate-count
Common Var(flag_analyzer_show_duplicate_count) Init(0)
Issue a note when diagnostics are deduplicated.
fanalyzer-state-purge
Common Var(flag_analyzer_state_purge) Init(1)
Purge unneeded state during analysis.
......
......@@ -541,7 +541,7 @@ diagnostic_manager::emit_saved_diagnostic (const exploded_graph &eg,
auto_cfun sentinel (sd.m_snode->m_fun);
if (sd.m_d->emit (&rich_loc))
{
if (num_dupes > 0)
if (flag_analyzer_show_duplicate_count && num_dupes > 0)
inform_n (stmt->location, num_dupes,
"%i duplicate", "%i duplicates",
num_dupes);
......
......@@ -8477,6 +8477,14 @@ By default, an edge in this graph can contain the effects of a run
of multiple statements within a basic block. With
@option{-fanalyzer-fine-grained}, each statement gets its own edge.
@item -fanalyzer-show-duplicate-count
@opindex fanalyzer-show-duplicate-count
@opindex fno-analyzer-show-duplicate-count
This option is intended for analyzer developers: if multiple diagnostics
have been detected as being duplicates of each other, it emits a note when
reporting the best diagnostic, giving the number of additional diagnostics
that were suppressed by the deduplication logic.
@item -fno-analyzer-state-merge
@opindex fanalyzer-state-merge
@opindex fno-analyzer-state-merge
2020-03-02 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Add
-fanalyzer-show-duplicate-count.
2020-03-02 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93959
* g++.dg/analyzer/cstdlib-2.C: New test.
* g++.dg/analyzer/cstdlib.C: New test.
......
/* { dg-additional-options "-fanalyzer-show-duplicate-count" } */
#include <stdlib.h>
typedef struct _krb5_data {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment