From 4504701fb80f2f506b4ca0703ca34e57522aec12 Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Fri, 29 Mar 2024 15:13:32 +0300 Subject: Switch to custom deleter type for unique_ptr This prevents the error: src/parser/exec-checker/src/exec_checker.cc:202:42: error: ignoring attributes on template argument 'int (*)(FILE*)' [-Werror=ignored-attributes] 202 | std::unique_ptr fp_auto(fp, fclose); | ^ When building with new toolchain Change-Id: I3b0b71ddb2c887d349e783e5ad3a6d1b1bbb561e --- src/parser/exec-checker/src/exec_checker.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parser/exec-checker/src/exec_checker.cc b/src/parser/exec-checker/src/exec_checker.cc index 40f7cafa..655995c2 100644 --- a/src/parser/exec-checker/src/exec_checker.cc +++ b/src/parser/exec-checker/src/exec_checker.cc @@ -199,7 +199,13 @@ bool ExecChecker::CheckMainSymbol() { return false; } - std::unique_ptr fp_auto(fp, fclose); + struct file_closer { + void operator() (FILE* f) const { + fclose(f); + } + }; + + std::unique_ptr fp_auto(fp); header h; size_t nbytes = fread(h.c, 1, sizeof(h), fp); if (nbytes < 2) { -- cgit v1.2.3