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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 22 14:03:38 PDT 2026


philnik777 wrote:

> I believe it's more nuanced than just a matter of taste. For us, we have been shipping C++ code 100% warning free, so to continuously integrate newer libc++, I am already planning on patching downstream as an escape hatch. Not using a _LIBCPP macro significantly increases the blast radius of such downstream patch and makes any vendor that wish to do the same prone to miss any newly added ones.

That seems a bit short-sighted of an argument. We'll most likely add this in many more places, and surely you wouldn't want a new macro every time we add it somewhere? This is also a more general problem: Whenever any diagnostics gets improved you'd have to add a new flag to allow people to update. I think https://discourse.llvm.org/t/rfc-emitting-auditable-sarif-logs-from-clang/88624 is related here.

> To make matters worse, [EDG doesn't accept this attribute](https://godbolt.org/z/f9ha6YYc6), making this PR an unfortunate incompatibility for NVCC users. While I understand it's not a common setup, I don't think an escape hatch is too much to ask.

It's not just not common, it's unsupported from our end. Regarding this specifically though, you just have to enable C++11 and EDG happily accepts it, since it's (% underscores) perfectly conforming C++11: https://godbolt.org/z/s9xM574K5


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


More information about the libcxx-commits mailing list