50 lines
1.9 KiB
Diff
50 lines
1.9 KiB
Diff
|
@@ -, +, @@
|
||
|
libmissing/m4/stdio_h.m4 | 4 ++--
|
||
|
libmissing/m4/warn-on-use.m4 | 4 ++--
|
||
|
libmissing/stdio.in.h | 6 ++++--
|
||
|
3 files changed, 8 insertions(+), 6 deletions(-)
|
||
|
--- a/libmissing/m4/stdio_h.m4
|
||
|
+++ a/libmissing/m4/stdio_h.m4
|
||
|
@@ -34,9 +34,9 @@ AC_DEFUN([gl_STDIO_H],
|
||
|
|
||
|
dnl Check for declarations of anything we want to poison if the
|
||
|
dnl corresponding gnulib module is not in use, and which is not
|
||
|
- dnl guaranteed by C89.
|
||
|
+ dnl guaranteed by both C89 and C11.
|
||
|
gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
|
||
|
- ]], [dprintf fpurge fseeko ftello getdelim getline popen renameat
|
||
|
+ ]], [dprintf fpurge fseeko ftello getdelim getline gets popen renameat
|
||
|
snprintf vdprintf vsnprintf])
|
||
|
])
|
||
|
|
||
|
--- a/libmissing/m4/warn-on-use.m4
|
||
|
+++ a/libmissing/m4/warn-on-use.m4
|
||
|
@@ -18,8 +18,8 @@ dnl with or without modifications, as long as this notice is preserved.
|
||
|
# some systems declare functions in the wrong header, then INCLUDES
|
||
|
# should do likewise.
|
||
|
#
|
||
|
-# If you assume C89, then it is generally safe to assume declarations
|
||
|
-# for functions declared in that standard (such as gets) without
|
||
|
+# It is generally safe to assume declarations for functions declared
|
||
|
+# in the intersection of C89 and C11 (such as printf) without
|
||
|
# needing gl_WARN_ON_USE_PREPARE.
|
||
|
AC_DEFUN([gl_WARN_ON_USE_PREPARE],
|
||
|
[
|
||
|
--- a/libmissing/stdio.in.h
|
||
|
+++ a/libmissing/stdio.in.h
|
||
|
@@ -114,10 +114,12 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
|
||
|
#endif
|
||
|
|
||
|
/* It is very rare that the developer ever has full control of stdin,
|
||
|
- so any use of gets warrants an unconditional warning. Assume it is
|
||
|
- always declared, since it is required by C89. */
|
||
|
+ so any use of gets warrants an unconditional warning; besides, C11
|
||
|
+ removed it. */
|
||
|
#undef gets
|
||
|
+#if HAVE_RAW_DECL_GETS
|
||
|
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
|
||
|
+#endif
|
||
|
|
||
|
#if @GNULIB_FOPEN@
|
||
|
# if @REPLACE_FOPEN@
|