diff options
author | David Malcolm <dmalcolm@redhat.com> | 2020-02-27 14:19:33 -0500 |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2020-03-02 16:40:23 -0500 |
commit | 9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7 (patch) | |
tree | e3ee554f9d502225feb1db5f03b3ba60ad26c356 /gcc/analyzer/ChangeLog | |
parent | cd14f288ddf246d40f109aa7999b99a44739cd99 (diff) | |
download | gcc-9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7.zip gcc-9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7.tar.gz gcc-9f00b22f98ec0688fcd9816a03aa3f7eea58bcf7.tar.bz2 |
analyzer: detect malloc, free, calloc within "std" [PR93959]
PR analyzer/93959 reported that g++.dg/analyzer/malloc.C was failing
with no output on Solaris.
The issue is that <stdlib.h> there has "using std::free;", converting
all the "free" calls to std::free, which fails the name-matching via
is_named_call_p.
This patch implements an is_std_named_call_p variant of is_named_call_p
to check for the name within "std", and uses it in sm-malloc.c to check
for std::malloc, std::calloc, and std::free.
gcc/analyzer/ChangeLog:
PR analyzer/93959
* analyzer.cc (is_std_function_p): New function.
(is_std_named_call_p): New functions.
* analyzer.h (is_std_named_call_p): New decl.
* sm-malloc.cc (malloc_state_machine::on_stmt): Check for "std::"
variants when checking for malloc, calloc and free.
gcc/testsuite/ChangeLog:
PR analyzer/93959
* g++.dg/analyzer/cstdlib-2.C: New test.
* g++.dg/analyzer/cstdlib.C: New test.
Diffstat (limited to 'gcc/analyzer/ChangeLog')
-rw-r--r-- | gcc/analyzer/ChangeLog | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 5fbaec3..e5d7bdb 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,12 @@ +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. + * analyzer.h (is_std_named_call_p): New decl. + * sm-malloc.cc (malloc_state_machine::on_stmt): Check for "std::" + variants when checking for malloc, calloc and free. + 2020-02-26 David Malcolm <dmalcolm@redhat.com> PR analyzer/93950 |