[libcxx-commits] [libcxx] [libc++] Diagnose unused variables of container types (PR #203084)

Yuxuan Chen via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 18 23:34:32 PDT 2026


yuxuanchen1997 wrote:

> There are lots of diagnostics which print where some attribute was applied, and macros directly make these diagnostics worse, since you have a list of macro expansions in that case.

Can you be more specific which warnings do that? It would be helpful to attach a compiler explorer link to demonstrate such an unwanted diagnostics. In my code base, macros wrapped attributes are very common so it's definitely within my duties to seek improvement on those. 

> Notably, there is also significant precedence of not having a macro, like [[nodiscard]] (with > 3k instances).

`[[nodiscard]]` is a standard attribute and I don't think it's a good one to compare to. This PR is relying on a vendor extension. 

> What would you like to see in that description?

Whether you write it or not, GitHub PR UI would always use some screen real estate to show the description box and that's often the first thing a reviewer would read. It should be rather uncontroversial that any description is better than `No description provided.` For this particular PR, it would be helpful to state motivations, show case an example diagnostic message, and provide a list of container types (or iterator wrappers therein) for reviewer reference. 

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


More information about the libcxx-commits mailing list