summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2023-04-26 06:06:03 +0200
committerBruno Haible <bruno@clisp.org>2023-04-26 06:06:03 +0200
commit2c2f6738b579517f91bee29a22746012d90e9ad5 (patch)
tree0e57b1737920340d982dfce0a6326cc5993cb1a9 /modules
parent3ef794d11bcbea3b8ae57767772a3255b669b8ce (diff)
downloadgnulib-2c2f6738b579517f91bee29a22746012d90e9ad5.tar.gz
fclose: Make last change more maintainable.
* m4/fclose.m4 (gl_FUNC_FCLOSE): Define through AC_DEFUN_ONCE. Don't modify REPLACE_FOPEN. * modules/fclose (Depends-on): Add comment. (configure.ac): Don't modify REPLACE_FOPEN. Don't duplicate actions of module 'fopen'. * m4/fopen.m4 (gl_FUNC_FOPEN_ITSELF): Renamed from gl_FUNC_FOPEN. (gl_FUNC_FOPEN): New macro. * modules/fopen (Files): Add m4/fclose.m4, m4/fflush.m4. * m4/close.m4 (gl_FUNC_CLOSE): Define through AC_DEFUN_ONCE.
Diffstat (limited to 'modules')
-rw-r--r--modules/fclose10
-rw-r--r--modules/fopen2
2 files changed, 6 insertions, 6 deletions
diff --git a/modules/fclose b/modules/fclose
index 9a949e48b8..0ef34bdfd9 100644
--- a/modules/fclose
+++ b/modules/fclose
@@ -9,18 +9,16 @@ Depends-on:
stdio
close [test $REPLACE_FCLOSE = 1]
fflush [test $REPLACE_FCLOSE = 1]
-fopen [test $REPLACE_FCLOSE = 1]
freading [test $REPLACE_FCLOSE = 1]
lseek [test $REPLACE_FCLOSE = 1]
msvc-inval [test $REPLACE_FCLOSE = 1]
+# The code of fclose does not need to call fopen. But when gcc's '-fanalyzer'
+# option is in use and stdio.h does '#define fclose rpl_fclose', stdio.h also
+# needs to do '#define fopen rpl_fopen', otherwise a warning may result.
+fopen [test $REPLACE_FCLOSE = 1]
configure.ac:
gl_FUNC_FCLOSE
-if test $REPLACE_FCLOSE = 1; then
- REPLACE_FOPEN=1
- AC_LIBOBJ([fopen])
- gl_PREREQ_FOPEN
-fi
gl_CONDITIONAL([GL_COND_OBJ_FCLOSE], [test $REPLACE_FCLOSE = 1])
gl_STDIO_MODULE_INDICATOR([fclose])
diff --git a/modules/fopen b/modules/fopen
index da216c9cec..3d538393f1 100644
--- a/modules/fopen
+++ b/modules/fopen
@@ -4,6 +4,8 @@ fopen() function: open a stream to a file.
Files:
lib/fopen.c
m4/fopen.m4
+m4/fclose.m4
+m4/fflush.m4
Depends-on:
stdio