From e4f60679caa293c047be69f57fc48b46c7452327 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Thu, 17 Aug 2023 15:06:32 -0400 Subject: [PATCH] Use a callable type for ScopedFILE in settings_writer.cc Newer glibc have an attribute((nonnull(1))) on fclose. Attributes aren't part of the language, so decltype(fclose) lose the attribute. It seems this causes std::unique_ptr to trip -Wignored-attributes in GCC. This is a bit aggressive of a warning, but work around this with a custom deleter, which makes the unique_ptr object smaller anyway. (Though the compiler can, I hope, dissolve all of this anyway.) Fixed: 642 Change-Id: I9a0206a8c5675f856e80c5266c90be42d66a5606 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62465 Auto-Submit: David Benjamin Reviewed-by: Bob Beck Commit-Queue: David Benjamin --- ssl/test/settings_writer.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ssl/test/settings_writer.cc b/ssl/test/settings_writer.cc index 8605222fe..78598a869 100644 --- a/ssl/test/settings_writer.cc +++ b/ssl/test/settings_writer.cc @@ -75,8 +75,11 @@ bool SettingsWriter::Commit() { } bssl::UniquePtr free_settings(settings); - using ScopedFILE = std::unique_ptr; - ScopedFILE file(fopen(path_.c_str(), "w"), fclose); + struct FileCloser { + void operator()(FILE *f) const { fclose(f); } + }; + using ScopedFILE = std::unique_ptr; + ScopedFILE file(fopen(path_.c_str(), "w")); if (!file) { return false; }