bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH 1/2] string, wchar: port rpl_free decl to Android
@ 2021-09-08 16:47 Paul Eggert
  2021-09-08 16:47 ` [PATCH 2/2] strerror_r-posix: port better " Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggert @ 2021-09-08 16:47 UTC (permalink / raw)
  To: bug-gnulib, landfillbaby69; +Cc: Paul Eggert

* lib/string.in.h, lib/wchar.in.h:
(free): When replacing it, declare the unreplaced version too.
Problem reported by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
---
 ChangeLog       | 8 ++++++++
 lib/string.in.h | 1 +
 lib/wchar.in.h  | 1 +
 3 files changed, 10 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index f73dc5a130..d2dd671c5b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-09-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	string, wchar: port rpl_free decl to Android
+	* lib/string.in.h, lib/wchar.in.h:
+	(free): When replacing it, declare the unreplaced version too.
+	Problem reported by Lucy Phipps in:
+	https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
+
 2021-09-07  Paul Eggert  <eggert@cs.ucla.edu>
 
 	string, wchar: avoid some namespace pollution
diff --git a/lib/string.in.h b/lib/string.in.h
index 6214b55784..8977153c88 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -86,6 +86,7 @@
 /* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE.  */
 #if (@REPLACE_FREE@ && !defined free \
      && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+_GL_EXTERN_C void free (void *);
 # define free rpl_free
 #endif
 _GL_EXTERN_C void free (void *);
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 027a145496..acb9d4ea64 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -149,6 +149,7 @@ typedef int rpl_mbstate_t;
 /* Declare 'free' if needed for _GL_ATTRIBUTE_DEALLOC_FREE.  */
 #if (@REPLACE_FREE@ && !defined free \
      && !(defined __cplusplus && defined GNULIB_NAMESPACE))
+_GL_EXTERN_C void free (void *);
 # define free rpl_free
 #endif
 _GL_EXTERN_C void free (void *);
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] strerror_r-posix: port better to Android
  2021-09-08 16:47 [PATCH 1/2] string, wchar: port rpl_free decl to Android Paul Eggert
@ 2021-09-08 16:47 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2021-09-08 16:47 UTC (permalink / raw)
  To: bug-gnulib, landfillbaby69; +Cc: Paul Eggert

* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Move requirement of
gl_USE_SYSTEM_EXTENSIONS from here ...
(gl_FUNC_STRERROR_R_WORKS): ... to here, which is the macro that
actually needs it.  This avoids a bug where 'configure' tests
whether strerror_r has the POSIX API before enabling GNU
extensions.  On Android, enabling GNU extensions switches from the
POSIX to the GNU API.  Problem reported by Lucy Phipps in:
https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
---
 ChangeLog        | 10 ++++++++++
 m4/strerror_r.m4 | 10 ++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d2dd671c5b..1db7e333bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-09-08  Paul Eggert  <eggert@cs.ucla.edu>
 
+	strerror_r-posix: port better to Android
+	* m4/strerror_r.m4 (gl_FUNC_STRERROR_R): Move requirement of
+	gl_USE_SYSTEM_EXTENSIONS from here ...
+	(gl_FUNC_STRERROR_R_WORKS): ... to here, which is the macro that
+	actually needs it.  This avoids a bug where 'configure' tests
+	whether strerror_r has the POSIX API before enabling GNU
+	extensions.  On Android, enabling GNU extensions switches from the
+	POSIX to the GNU API.  Problem reported by Lucy Phipps in:
+	https://lists.gnu.org/r/bug-gnulib/2021-09/msg00026.html
+
 	string, wchar: port rpl_free decl to Android
 	* lib/string.in.h, lib/wchar.in.h:
 	(free): When replacing it, declare the unreplaced version too.
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4
index 0689e46dc6..29b309221f 100644
--- a/m4/strerror_r.m4
+++ b/m4/strerror_r.m4
@@ -1,4 +1,4 @@
-# strerror_r.m4 serial 21
+# strerror_r.m4 serial 22
 dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -9,9 +9,6 @@ AC_DEFUN([gl_FUNC_STRERROR_R],
   AC_REQUIRE([gl_STRING_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS])
 
-  dnl Persuade Solaris <string.h> to declare strerror_r().
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
   dnl Some systems don't declare strerror_r() if _THREAD_SAFE and _REENTRANT
   dnl are not defined.
   AC_CHECK_DECLS_ONCE([strerror_r])
@@ -52,6 +49,11 @@ AC_DEFUN([gl_FUNC_STRERROR_R_WORKS],
 [
   AC_REQUIRE([gl_HEADER_ERRNO_H])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Persuade Android <string.h> to use the GNU strerror_r API,
+  dnl and Solaris <string.h> to declare strerror_r.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
   AC_REQUIRE([gl_FUNC_STRERROR_0])
 
   AC_CHECK_FUNCS_ONCE([strerror_r])
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-08 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 16:47 [PATCH 1/2] string, wchar: port rpl_free decl to Android Paul Eggert
2021-09-08 16:47 ` [PATCH 2/2] strerror_r-posix: port better " Paul Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).