[lld] [lld][NFC] Silence -Wuninitialized GCC warnings. (PR #75183)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 09:27:35 PST 2023


dwblaikie wrote:

> > > I believe clang does a better job with sometimes-ininitialized warnings, perhaps we should just disable GCC's overly conservative warning, rather than adding unnecessary initializers? (that would hinder Clang's better warning and sanitizer detections)
> > 
> > 
> > I agree. I have seen several instances that GCC `-Wuninitialized` is annoying than useful.
> 
> In this case, it seems like the issue only exists in older GCC versions though, but I'm not sure if we'd like to do such a change depending on GCC version either. So perhaps it would indeed be best to skip such warnings altogether on GCC.

We could disable the warning only on the GCC versions where it has a false positive - either by checking the version, or by writing a small snippet that tests the false positive case, and disabling if that snippet produces a warning. (I think we use this kind of code-based feature detection for some warning enablement/disablement - or have in the past - not sure exactly where it lives)

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


More information about the llvm-commits mailing list