aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/engine.cc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2022-03-23 08:32:17 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2022-03-23 08:34:49 -0400
commit160b095fc9ded4eaa2bf4d49bd97319f4aabff0a (patch)
treef31b4162c0aadcfc262ec89f3b611d762bba1441 /gcc/analyzer/engine.cc
parent4894d69a1f37d54b6a612e58053db477ff5ba832 (diff)
downloadgcc-160b095fc9ded4eaa2bf4d49bd97319f4aabff0a.zip
gcc-160b095fc9ded4eaa2bf4d49bd97319f4aabff0a.tar.gz
gcc-160b095fc9ded4eaa2bf4d49bd97319f4aabff0a.tar.bz2
analyzer: fix ICE adding note to disabled diagnostic [PR104997]
gcc/analyzer/ChangeLog: PR analyzer/104997 * diagnostic-manager.cc (diagnostic_manager::add_diagnostic): Convert return type from "void" to "bool", reporting success vs failure to caller, for both overloads. * diagnostic-manager.h (diagnostic_manager::add_diagnostic): Likewise. * engine.cc (impl_region_model_context::warn): Propagate return value from diagnostic_manager::add_diagnostic. gcc/testsuite/ChangeLog: PR analyzer/104997 * gcc.dg/analyzer/write-to-string-literal-4-disabled.c: New test, adapted from write-to-string-literal-4.c. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/analyzer/engine.cc')
-rw-r--r--gcc/analyzer/engine.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index f911ed4..caa8796 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -129,12 +129,9 @@ impl_region_model_context::warn (pending_diagnostic *d)
return false;
}
if (m_eg)
- {
- m_eg->get_diagnostic_manager ().add_diagnostic
- (m_enode_for_diag, m_enode_for_diag->get_supernode (),
- m_stmt, m_stmt_finder, d);
- return true;
- }
+ return m_eg->get_diagnostic_manager ().add_diagnostic
+ (m_enode_for_diag, m_enode_for_diag->get_supernode (),
+ m_stmt, m_stmt_finder, d);
else
{
delete d;