From: Bruno Haible Date: Sat, 26 Apr 2025 12:12:47 +0000 (+0200) Subject: stdopen: Silence -Wanalyzer-fd-leak warnings. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=144f232f695d5e6f87b9cf9ba772f630f97c7409;p=gnulib.git stdopen: Silence -Wanalyzer-fd-leak warnings. * lib/stdopen.c: Add a '#pragma GCC diagnostic ignored'. --- 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