]> Savannah Git Hosting - gnulib.git/commitdiff
endian: port better to Android NDK r26
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 4 Jun 2024 18:50:07 +0000 (11:50 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 4 Jun 2024 18:50:30 +0000 (11:50 -0700)
* lib/endian.in.h (be16toh, be32toh, be64toh, htobe16, htobe32)
(htobe64, le16toh, le32toh, le64toh, htole16, htole32, htole64):
When @HAVE_ENDIAN_H@, define each NAME to rpl_NAME so that they
don’t interact incorrectly with system-defined implementations.
Problem reported by Po Lu for Android NDK r26 in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00040.html
and this patch is an updated version of Collin Funk’s patch in:
https://lists.gnu.org/r/bug-gnulib/2024-06/msg00041.html

ChangeLog
lib/endian.in.h

index 1200ec0ec85310a4021f682828e072b7622b82dd..8e808fd6a8044889fb17ad1b2f4afc3e05a044eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-06-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       endian: port better to Android NDK r26
+       * lib/endian.in.h (be16toh, be32toh, be64toh, htobe16, htobe32)
+       (htobe64, le16toh, le32toh, le64toh, htole16, htole32, htole64):
+       When @HAVE_ENDIAN_H@, define each NAME to rpl_NAME so that they
+       don’t interact incorrectly with system-defined implementations.
+       Problem reported by Po Lu for Android NDK r26 in:
+       https://lists.gnu.org/r/bug-gnulib/2024-06/msg00040.html
+       and this patch is an updated version of Collin Funk’s patch in:
+       https://lists.gnu.org/r/bug-gnulib/2024-06/msg00041.html
+
 2024-06-04  Collin Funk  <collin.funk1@gmail.com>
 
        boot-time, readutmp: Fix missing MinGW include (regr. 2024-05-24).
index bd65ae8aaba27eb07b2fac5d5cae86e030e8c717..156fe49fbdaa1ba558d4aac75c8a118e23a48f48 100644 (file)
@@ -69,8 +69,9 @@ _GL_INLINE_HEADER_BEGIN
 # define BYTE_ORDER LITTLE_ENDIAN
 #endif
 
-/* Make sure function-like macros get undefined.  */
 #if @HAVE_ENDIAN_H@
+
+/* Make sure we don't have any system definitions.  */
 # undef be16toh
 # undef be32toh
 # undef be64toh
@@ -83,6 +84,21 @@ _GL_INLINE_HEADER_BEGIN
 # undef htole16
 # undef htole32
 # undef htole64
+
+/* Define our own.  */
+# define be16toh rpl_endian_be16toh
+# define be32toh rpl_endian_be32toh
+# define be64toh rpl_endian_be64toh
+# define htobe16 rpl_endian_htobe16
+# define htobe32 rpl_endian_htobe32
+# define htobe64 rpl_endian_htobe64
+# define le16toh rpl_endian_le16toh
+# define le32toh rpl_endian_le32toh
+# define le64toh rpl_endian_le64toh
+# define htole16 rpl_endian_htole16
+# define htole32 rpl_endian_htole32
+# define htole64 rpl_endian_htole64
+
 #endif
 
 #ifdef __cplusplus