util/DisposablePointer: suppress -Wuninitialized

I pretend to know what I'm doing :-)
This commit is contained in:
Max Kellermann 2024-08-29 20:22:45 +02:00 committed by Max Kellermann
parent fae5d16d43
commit 4a2fff019a
1 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,15 @@
#include <utility>
#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<typename T>
class TypedDisposablePointer : public DisposablePointer {
public: