[libcxx-commits] [clang] [libcxx] [clang] Warn about memset/memcpy to NonTriviallyCopyable types (PR #111434)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 22 12:12:29 PST 2024


zmodem wrote:

> Note that recently Clang introduced a mechanism for file-level suppression of warnings, for easier rollout of warnings:
https://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-suppression-mappings
> Would that serve the same purpose?

Well, that allows us to be gradual over a _set of files_.

However, it doesn't help adapting the _set of warnings_ gradually. In this case, we already have `-Wnontrivial-memaccess` enabled. We don't want to have to disable it due to it gaining new warnings.

I don't know if it's written down anywhere, but it's been Clang's practice to add new flags for new warnings. The system with groups and subgroups of warnings makes that work nicely.

> Would you be ok with a flag, say `-Wnontrivial-memcpy`ΒΈ(any suggestion on another name ?) implied by `-Wall` but that we could disable with `-Wno-nontrivial-memcpy` ?

The new flag should still be implied by `-Wnontrivial-memaccess` (which I assume is implied by `-Wall`).

I like  `-Wnontrivial-memcpy`. I suppose it also applies to `memove`, `memset`, etc. but maybe `-Wnontrivial-memcpy` is still the best name? (or `-Wnontrivial-mem-libcall`?)

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


More information about the libcxx-commits mailing list