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

ChangeLog
doc/glibc-functions/putw.texi
lib/stdio.in.h
m4/stdio_h.m4
modules/stdio

index e73c76550fe81856f6fef7b7b305f3e37e4c53a4..88d5faa5922871deed50d87e3e49194fcb1055b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-01-03  Bruno Haible  <bruno@clisp.org>
+
+       stdio: Fix error in C++ mode on Android, due to putw.
+       * lib/stdio.in.h (putw): Don't declare in the C++ namespace if putw is
+       not declared.
+       * m4/stdio_h.m4 (gl_STDIO_H): Test whether putw is declared.
+       (gl_STDIO_H_DEFAULTS): Initialize HAVE_DECL_PUTW.
+       * modules/stdio (Makefile.am): Substitute HAVE_DECL_PUTW.
+       * doc/glibc-functions/putw.texi: Update regarding Android.
+
 2023-01-03  Bruno Haible  <bruno@clisp.org>
 
        stdio: Fix error in C++ mode on Android, due to getw.
index 8591c439000283fdbe3069cb33946941bdceabaa..18383e321f2d1955a8d2da93d2a9848cb20a0b58 100644 (file)
@@ -23,4 +23,7 @@ Portability problems fixed by Gnulib:
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+This function is not declared on some platforms:
+Android 9.0.
 @end itemize
index 462762fe4526a6e10d4052aadb0eb2e37beeaf60..8b5ef4bd2dd5c58222cb5ee5237a2c06b6bcd3b2 100644 (file)
@@ -1194,9 +1194,13 @@ _GL_CXXALIASWARN (puts);
 #  endif
 _GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream));
 # else
+#  if @HAVE_DECL_PUTW@
 _GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream));
+#  endif
 # endif
+# if __GLIBC__ >= 2
 _GL_CXXALIASWARN (putw);
+# endif
 #endif
 
 #if @GNULIB_REMOVE@
index 421f594cfe2163703e23d66098f1e62cf62b8aa5..07569961f8b104156b3436be288cf810b712fac9 100644 (file)
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 60
+# stdio_h.m4 serial 61
 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,
@@ -87,6 +87,11 @@ AC_DEFUN_ONCE([gl_STDIO_H],
   if test $ac_cv_have_decl_getw = no; then
     HAVE_DECL_GETW=0
   fi
+
+  AC_CHECK_DECLS_ONCE([putw])
+  if test $ac_cv_have_decl_putw = no; then
+    HAVE_DECL_PUTW=0
+  fi
 ])
 
 # gl_STDIO_MODULE_INDICATOR([modulename])
@@ -185,6 +190,7 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   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_PUTW=1;              AC_SUBST([HAVE_DECL_PUTW])
   HAVE_DECL_SNPRINTF=1;          AC_SUBST([HAVE_DECL_SNPRINTF])
   HAVE_DECL_VSNPRINTF=1;         AC_SUBST([HAVE_DECL_VSNPRINTF])
   HAVE_DPRINTF=1;                AC_SUBST([HAVE_DPRINTF])
index 6504a01372a58ead50b1520212bfe11ee46707b4..b8662ef0a9381512638eaded84eaa61886a39a30 100644 (file)
@@ -132,6 +132,7 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -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_PUTW''@|$(HAVE_DECL_PUTW)|g' \
              -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \
              -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \
              -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \