aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer/sm-malloc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/analyzer/sm-malloc.cc')
-rw-r--r--gcc/analyzer/sm-malloc.cc49
1 files changed, 26 insertions, 23 deletions
diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc
index 526680a..9415a07 100644
--- a/gcc/analyzer/sm-malloc.cc
+++ b/gcc/analyzer/sm-malloc.cc
@@ -145,8 +145,8 @@ public:
auto_diagnostic_group d;
diagnostic_metadata m;
m.add_cwe (415); /* CWE-415: Double Free. */
- return warning_at (rich_loc, m, OPT_Wanalyzer_double_free,
- "double-%<free%> of %qE", m_arg);
+ return warning_meta (rich_loc, m, OPT_Wanalyzer_double_free,
+ "double-%<free%> of %qE", m_arg);
}
label_text describe_state_change (const evdesc::state_change &change)
@@ -235,8 +235,9 @@ public:
/* CWE-690: Unchecked Return Value to NULL Pointer Dereference. */
diagnostic_metadata m;
m.add_cwe (690);
- return warning_at (rich_loc, m, OPT_Wanalyzer_possible_null_dereference,
- "dereference of possibly-NULL %qE", m_arg);
+ return warning_meta (rich_loc, m,
+ OPT_Wanalyzer_possible_null_dereference,
+ "dereference of possibly-NULL %qE", m_arg);
}
label_text describe_final_event (const evdesc::final_event &ev) FINAL OVERRIDE
@@ -297,9 +298,9 @@ public:
diagnostic_metadata m;
m.add_cwe (690);
bool warned
- = warning_at (rich_loc, m, OPT_Wanalyzer_possible_null_argument,
- "use of possibly-NULL %qE where non-null expected",
- m_arg);
+ = warning_meta (rich_loc, m, OPT_Wanalyzer_possible_null_argument,
+ "use of possibly-NULL %qE where non-null expected",
+ m_arg);
if (warned)
inform_nonnull_attribute (m_fndecl, m_arg_idx);
return warned;
@@ -338,8 +339,9 @@ public:
/* CWE-690: Unchecked Return Value to NULL Pointer Dereference. */
diagnostic_metadata m;
m.add_cwe (690);
- return warning_at (rich_loc, m, OPT_Wanalyzer_null_dereference,
- "dereference of NULL %qE", m_arg);
+ return warning_meta (rich_loc, m,
+ OPT_Wanalyzer_null_dereference,
+ "dereference of NULL %qE", m_arg);
}
label_text describe_return_of_state (const evdesc::return_of_state &info)
@@ -386,8 +388,9 @@ public:
auto_diagnostic_group d;
diagnostic_metadata m;
m.add_cwe (690);
- bool warned = warning_at (rich_loc, m, OPT_Wanalyzer_null_argument,
- "use of NULL %qE where non-null expected", m_arg);
+ bool warned = warning_meta (rich_loc, m, OPT_Wanalyzer_null_argument,
+ "use of NULL %qE where non-null expected",
+ m_arg);
if (warned)
inform_nonnull_attribute (m_fndecl, m_arg_idx);
return warned;
@@ -419,8 +422,8 @@ public:
/* CWE-416: Use After Free. */
diagnostic_metadata m;
m.add_cwe (416);
- return warning_at (rich_loc, m, OPT_Wanalyzer_use_after_free,
- "use after %<free%> of %qE", m_arg);
+ return warning_meta (rich_loc, m, OPT_Wanalyzer_use_after_free,
+ "use after %<free%> of %qE", m_arg);
}
label_text describe_state_change (const evdesc::state_change &change)
@@ -459,8 +462,8 @@ public:
{
diagnostic_metadata m;
m.add_cwe (401);
- return warning_at (rich_loc, m, OPT_Wanalyzer_malloc_leak,
- "leak of %qE", m_arg);
+ return warning_meta (rich_loc, m, OPT_Wanalyzer_malloc_leak,
+ "leak of %qE", m_arg);
}
label_text describe_state_change (const evdesc::state_change &change)
@@ -514,16 +517,16 @@ public:
default:
gcc_unreachable ();
case KIND_UNKNOWN:
- return warning_at (rich_loc, m, OPT_Wanalyzer_free_of_non_heap,
- "%<free%> of %qE which points to memory"
- " not on the heap",
- m_arg);
+ return warning_meta (rich_loc, m, OPT_Wanalyzer_free_of_non_heap,
+ "%<free%> of %qE which points to memory"
+ " not on the heap",
+ m_arg);
break;
case KIND_ALLOCA:
- return warning_at (rich_loc, m, OPT_Wanalyzer_free_of_non_heap,
- "%<free%> of memory allocated on the stack by"
- " %qs (%qE) will corrupt the heap",
- "alloca", m_arg);
+ return warning_meta (rich_loc, m, OPT_Wanalyzer_free_of_non_heap,
+ "%<free%> of memory allocated on the stack by"
+ " %qs (%qE) will corrupt the heap",
+ "alloca", m_arg);
break;
}
}