From 541f5d6e2d03aa3b41df9464fa012d1bdf993f60 Mon Sep 17 00:00:00 2001 From: Eddy Jansson Date: Tue, 22 Oct 2024 17:21:21 +0200 Subject: [PATCH] Use helper 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..02dcfb1 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -119,13 +119,19 @@ using byte_string_view = std::basic_string_view; * \{ */ +/** Local helper deleter function. */ +static void fclose_deleter(FILE* f) +{ + fclose(f); +} + /** * Smart auto-closing FILE* handle. * * It implictly converts from an already opened FILE*. */ -struct file : std::unique_ptr { - file(FILE* f = nullptr) : std::unique_ptr(f, &fclose) {} +struct file : std::unique_ptr { + file(FILE* f = nullptr) : std::unique_ptr(f, &fclose_deleter) {} }; /**