[clang] [clang] Implement -Walloc-size diagnostic option (PR #150028)

Vladimir Vuksanovic via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 27 08:57:32 PDT 2025


vvuksanovic wrote:

I think I will add an exception for zero size allocations. That is likely done on purpose and that change should eliminate a lot of the noise.

For the `pykdtree` case, that code is a bit questionable as it relies on not using a part of a structure. I think that emitting a warning there makes sense.

I am open to suggestions for ways to suppress the warning. Maybe we can only check implicit casts, but that might miss some actual problems. If there is a lot of noise, gating this diagnostic behind `-Wextra` like gcc does is an option.

https://github.com/llvm/llvm-project/pull/150028


More information about the cfe-commits mailing list