]> Savannah Git Hosting - gnulib.git/commitdiff
stdio: Fix error in C++ mode on Android, due to getw.
authorBruno Haible <bruno@clisp.org>
Tue, 3 Jan 2023 16:11:19 +0000 (17:11 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 3 Jan 2023 18:09:18 +0000 (19:09 +0100)
* lib/stdio.in.h (getw): Don't declare in the C++ namespace if getw is
not declared.
* m4/stdio_h.m4 (gl_STDIO_H): Test whether getw is declared.
(gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_GETW.
* modules/stdio (Makefile.am): Substitute HAVE_DECL_GETW.

ChangeLog
lib/stdio.in.h
m4/stdio_h.m4
modules/stdio

index c95e8f558654f89ebb82f3b1690039229f4a55b4..e73c76550fe81856f6fef7b7b305f3e37e4c53a4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-01-03  Bruno Haible  <bruno@clisp.org>
+
+       stdio: Fix error in C++ mode on Android, due to getw.
+       * lib/stdio.in.h (getw): Don't declare in the C++ namespace if getw is
+       not declared.
+       * m4/stdio_h.m4 (gl_STDIO_H): Test whether getw is declared.
+       (gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_GETW.
+       * modules/stdio (Makefile.am): Substitute HAVE_DECL_GETW.
+
 2023-01-02  Bruno Haible  <bruno@clisp.org>
 
        sigsegv: Fix compilation error on Android 4.3.
index 59cbea3d47defd1f2c9e37c55afe4f13becc2599..462762fe4526a6e10d4052aadb0eb2e37beeaf60 100644 (file)
@@ -951,9 +951,13 @@ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #  endif
 _GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream));
 # else
+#  if @HAVE_DECL_GETW@
 _GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream));
+#  endif
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (getw);
+# endif
 #endif
 
 #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
index 94271e11e789dbdcaf9e297bc3eb5cd5b9238c49..421f594cfe2163703e23d66098f1e62cf62b8aa5 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 59
+# stdio_h.m4 serial 60
 dnl Copyright (C) 2007-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -82,6 +82,11 @@ AC_DEFUN_ONCE([gl_STDIO_H],
   if test $ac_cv_have_decl_fcloseall = no; then
     HAVE_DECL_FCLOSEALL=0
   fi
+
+  AC_CHECK_DECLS_ONCE([getw])
+  if test $ac_cv_have_decl_getw = no; then
+    HAVE_DECL_GETW=0
+  fi
 ])
 
 # gl_STDIO_MODULE_INDICATOR([modulename])
@@ -178,6 +183,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   HAVE_DECL_FTELLO=1;            AC_SUBST([HAVE_DECL_FTELLO])
   HAVE_DECL_GETDELIM=1;          AC_SUBST([HAVE_DECL_GETDELIM])
   HAVE_DECL_GETLINE=1;           AC_SUBST([HAVE_DECL_GETLINE])
+  HAVE_DECL_GETW=1;              AC_SUBST([HAVE_DECL_GETW])
   HAVE_DECL_OBSTACK_PRINTF=1;    AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
index ff3a8d55af7556b516ef5bc44f2db4b508d5cdc7..6504a01372a58ead50b1520212bfe11ee46707b4 100644 (file)
@@ -130,6 +130,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \
              -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \
              -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \
+             -e 's|@''HAVE_DECL_GETW''@|$(HAVE_DECL_GETW)|g' \
              -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \
              -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
              -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \