[Bug c++/112377] Implement -Walloc-size in c++
egallager at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Nov 4 17:23:29 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112377
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to David Binderman from comment #0)
> Following on from discussion in bug report 112347,
> in file gcc/c-family/c.opt, is the new text
>
> Walloc-size
> C ObjC Var(warn_alloc_size) Warning LangEnabledBy(C ObjC, Wextra)
> Warn when allocating insufficient storage for the target type of the
> assigned pointer.
>
> IMHO, it should say:
>
> Walloc-size
> C ObjC Var(warn_alloc_size) Warning LangEnabledBy(C ObjC C++, Wextra)
> Warn when allocating insufficient storage for the target type of the
> assigned pointer.
>
> I think that should be enough to implement the new warning for C++.
If adding it to C++, then IMO it ought to be enabled for ObjC++, too, since the
current implementation is for both C and ObjC.
More information about the Gcc-bugs
mailing list