[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix _AC_LANG_IO_PROGRAM(C) to work with glibc 2.38 headers
From: |
Gleb Fotengauer-Malinovskiy |
Subject: |
[PATCH] Fix _AC_LANG_IO_PROGRAM(C) to work with glibc 2.38 headers |
Date: |
Tue, 15 Aug 2023 16:00:00 +0000 |
Following the glibc commit glibc-2.38~268 ("libio: Add __nonnull
for FILE * arguments of fclose and freopen"), the utilization of the gcc
-fanalyzer flag in combination with the -Werror flag leads to an error
within the _AC_LANG_IO_PROGRAM(C) function:
conftest.c:14:23: error: use of possibly-NULL 'f' where non-null expected
[CWE-690] [-Werror=analyzer-possible-null-argument]
* lib/autoconf/c.m4 (_AC_LANG_IO_PROGRAM): Exit upon encountering
fopen() error.
See also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570 and
https://gcc.gnu.org/g:c9a19621a07e246385ae075b61283140b23c3b5a .
Tiny-change: yes
---
lib/autoconf/c.m4 | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index b8350c33..77ff1af8 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -114,6 +114,8 @@ $2
m4_define([_AC_LANG_IO_PROGRAM(C)],
[AC_LANG_PROGRAM([@%:@include <stdio.h>],
[FILE *f = fopen ("conftest.out", "w");
+ if (!f)
+ return 1;
return ferror (f) || fclose (f) != 0;
])])
--
glebfm
- [PATCH] Fix _AC_LANG_IO_PROGRAM(C) to work with glibc 2.38 headers,
Gleb Fotengauer-Malinovskiy <=