]> Savannah Git Hosting - gnulib.git/commitdiff
stdopen: Silence -Wanalyzer-fd-leak warnings.
authorBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2025 12:12:47 +0000 (14:12 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 26 Apr 2025 12:12:47 +0000 (14:12 +0200)
* lib/stdopen.c: Add a '#pragma GCC diagnostic ignored'.

ChangeLog
lib/stdopen.c

index ef3e097338ac07adff6b86ff954e35bc35a1f074..e887fd20883683d69460f5ab1b2b31521cb8c7bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-04-26  Bruno Haible  <bruno@clisp.org>
+
+       stdopen: Silence -Wanalyzer-fd-leak warnings.
+       * lib/stdopen.c: Add a '#pragma GCC diagnostic ignored'.
+
 2025-04-26  Bruno Haible  <bruno@clisp.org>
 
        ssfmalloc: Fix -Wmissing-variable-declarations warnings.
index b6842815250d4b90c0a7ba8ff7a2be65a8a4dbb7..9b5227e84d28c1005ebfeb9439a28ad5dcb46396 100644 (file)
 #include <unistd.h>
 #include <errno.h>
 
+/* 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