diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-12-21 11:17:08 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-12-21 11:17:08 +0100 |
commit | b9dc16cbe2222bf1006a6266ba89da460165f3cb (patch) | |
tree | dc9ea403efb11e0111bff4f30284df4dfece98cb /gcc/tree-vect-loop-manip.cc | |
parent | 0e7f5039c52a020c3ed5f18a2b3ee1fb42b78f62 (diff) | |
download | gcc-b9dc16cbe2222bf1006a6266ba89da460165f3cb.zip gcc-b9dc16cbe2222bf1006a6266ba89da460165f3cb.tar.gz gcc-b9dc16cbe2222bf1006a6266ba89da460165f3cb.tar.bz2 |
c++: Enable -Walloc-size and -Wcalloc-transposed-args warnings for C++
The following patch enables the -Walloc-size and -Wcalloc-transposed-args
warnings for C++ as well.
Tracking just 6 arguments for SIZEOF_EXPR for the calloc purposes
is because I see alloc_size 1,2, 2,3 and 3,4 pairs used in the wild,
so we need at least 5 to cover that rather than 3, and don't want to waste
too much compile time/memory for that.
2023-12-21 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c.opt (Walloc-size): Enable also for C++ and ObjC++.
gcc/cp/
* cp-gimplify.cc (cp_genericize_r): If warn_alloc_size, call
warn_for_alloc_size for -Walloc-size diagnostics.
* semantics.cc (finish_call_expr): If warn_calloc_transposed_args,
call warn_for_calloc for -Wcalloc-transposed-args diagnostics.
gcc/testsuite/
* g++.dg/warn/Walloc-size-1.C: New test.
* g++.dg/warn/Wcalloc-transposed-args-1.C: New test.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions