[clang] [libcxx] [C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (PR #89446)

via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 24 06:03:45 PDT 2024


cor3ntin wrote:

For the record, I am fairly opposed to a warning on normal use of a standard function.

I'm not very concerned about users using different target flags across TUs because this is already a massive foot gun and I do not buy that we are making things materially worse.

Instead, by having opinionated on-by-default warnings we encourage users to not care or proactively distrust our warnings. Users will use that functions in headers as a lot of people like to put most of their implementation in headers.

Don't get me wrong, I think diagnosing actual ODR-violation is a worthwhile goal, and as @AaronBallman mentioned
there are ways to do that (modules, asan, build system warning on inconsistent flags), but from within a single TU
we don't have a way to detect actual ODR issues, so we would end up forcing our opinions on users, which I'm not sure is marginally better than not implementing the feature at all.

I don't think this feature warrants deviating from our policy that on-by default warnings should be actionable and have a low false-positive rate, nor the complexity to actually produce the warning.

If we get users reporting issue with that feature, then we can always emit a deprecation warning.



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


More information about the cfe-commits mailing list