diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-02-28 10:06:57 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-03-02 16:45:04 -0500 |
commit | 13b7691238f189c7a233aedec49306a7cb2b0a15 (patch) | |
tree | 5dc52bca9a149f2ca48fd9d35c8159014e21c4dd /gcc/analyzer | |
parent | 6e4444078aec716aa8214c13d7d20292aa232b5b (diff) |
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.
Diffstat (limited to 'gcc/analyzer')
-rw-r--r-- | gcc/analyzer/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/analyzer/analyzer.opt | 4 | ||||
-rw-r--r-- | gcc/analyzer/diagnostic-manager.cc | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index e5d7bdbbf7e..fa0fbcd1959 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,5 +1,12 @@ 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. diff --git a/gcc/analyzer/analyzer.opt b/gcc/analyzer/analyzer.opt index 4d122f3593a..22cf4b0ad3b 100644 --- a/gcc/analyzer/analyzer.opt +++ b/gcc/analyzer/analyzer.opt @@ -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. diff --git a/gcc/analyzer/diagnostic-manager.cc b/gcc/analyzer/diagnostic-manager.cc index b8e59334374..7435092e2d7 100644 --- a/gcc/analyzer/diagnostic-manager.cc +++ b/gcc/analyzer/diagnostic-manager.cc @@ -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); |