From fb3eb7298defe0d8cf14356f8f7ee661714d83bf Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Tue, 22 Oct 2024 17:21:21 +0200 Subject: [PATCH] Use functor deleter for invoking fclose. This fixes warnings from GCC-14 about ignored attributes when using std::unique_ptr --- src/opustags.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/opustags.h b/src/opustags.h index 93c323b..720be29 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -124,8 +124,14 @@ using byte_string_view = std::basic_string_view; * * It implictly converts from an already opened FILE*. */ -struct file : std::unique_ptr { - file(FILE* f = nullptr) : std::unique_ptr(f, &fclose) {} +struct fclose_deleter { + void operator()(FILE *f) const noexcept { + fclose(f); + } +}; + +struct file : std::unique_ptr { + file(FILE* f = nullptr) : std::unique_ptr(f) {} }; /**