From 144f232f695d5e6f87b9cf9ba772f630f97c7409 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 26 Apr 2025 14:12:47 +0200 Subject: [PATCH] stdopen: Silence -Wanalyzer-fd-leak warnings. * lib/stdopen.c: Add a '#pragma GCC diagnostic ignored'. --- ChangeLog | 5 +++++ lib/stdopen.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index ef3e097338..e887fd2088 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2025-04-26 Bruno Haible + + stdopen: Silence -Wanalyzer-fd-leak warnings. + * lib/stdopen.c: Add a '#pragma GCC diagnostic ignored'. + 2025-04-26 Bruno Haible ssfmalloc: Fix -Wmissing-variable-declarations warnings. diff --git a/lib/stdopen.c b/lib/stdopen.c index b684281525..9b5227e84d 100644 --- a/lib/stdopen.c +++ b/lib/stdopen.c @@ -26,6 +26,12 @@ #include #include +/* It is normal that stdopen() opens file descriptors without closing them. + Tell GCC not to warn about it. */ +#if _GL_GNUC_PREREQ (13, 1) +# pragma GCC diagnostic ignored "-Wanalyzer-fd-leak" +#endif + /* Try to ensure that all of the standard file numbers (0, 1, 2) are in use. Without this, each application would have to guard every call to open, dup, fopen, etc. with tests to ensure they -- 2.39.5