From 4a2fff019a4d7904eb60cce7f85b644373e381c1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 29 Aug 2024 20:22:45 +0200 Subject: [PATCH] util/DisposablePointer: suppress -Wuninitialized I pretend to know what I'm doing :-) --- src/util/DisposablePointer.hxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/util/DisposablePointer.hxx b/src/util/DisposablePointer.hxx index 2ee30e410..c6481109c 100644 --- a/src/util/DisposablePointer.hxx +++ b/src/util/DisposablePointer.hxx @@ -6,6 +6,15 @@ #include +#if defined(__GNUC__) && __GNUC__ >= 13 +#pragma GCC diagnostic push +/* suppress -Wuninitialized; GCC is right, the "dispose" field is + sometimes not initialized (if ptr==nullptr), but it's only swapped + in the move operator/constructor, and that's okay, we're not going + to use it in that case anyway */ +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif + /** * A generic object which is owned by somebody who doesn't know how to * dispose of it; to do this, a function pointer for disposing it is @@ -62,6 +71,10 @@ public: } }; +#if defined(__GNUC__) && __GNUC__ >= 13 +#pragma GCC diagnostic pop +#endif + template class TypedDisposablePointer : public DisposablePointer { public: