On 2025-09-13 11:50, Bruno Haible wrote:
This patch unfortunately breaks the coreutils build on macOS and
Solaris 11.

Thanks, I installed the attached. Works for me on Solaris 11.4. I don't have easy access to macOS 15.
From 226b0092dcbc4fd0c775057ddac0d31a444dad82 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Sat, 13 Sep 2025 13:01:00 -0700
Subject: [PATCH] endian: port to Solaris 11.4 and macOS 15

Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2025-09/msg00174.html
* lib/byteswap.in.h (_GL_BYTESWAP_INLINE):
Define before including stdint.h.
* lib/endian.in.h (bswap_16, bswap_32, bswap_64):
Declare as _GL_BYTESWAP_INLINE rather than as extern.
Conditionalize these decls with _GL_BYTESWAP_INLINE rather than
with _GL_BYTESWAP_H.
---
 ChangeLog         | 12 ++++++++++++
 lib/byteswap.in.h |  9 ++++++---
 lib/endian.in.h   |  8 ++++----
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b0758ac62a..f53d4204fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-09-13  Paul Eggert  <[email protected]>
+
+	endian: port to Solaris 11.4 and macOS 15
+	Problem reported by Bruno Haible in:
+	https://lists.gnu.org/r/bug-gnulib/2025-09/msg00174.html
+	* lib/byteswap.in.h (_GL_BYTESWAP_INLINE):
+	Define before including stdint.h.
+	* lib/endian.in.h (bswap_16, bswap_32, bswap_64):
+	Declare as _GL_BYTESWAP_INLINE rather than as extern.
+	Conditionalize these decls with _GL_BYTESWAP_INLINE rather than
+	with _GL_BYTESWAP_H.
+
 2025-09-13  Bruno Haible  <[email protected]>
 
 	gettext-h: Move fallback definition of GNULIB_TEXT_DOMAIN.
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index 1227f01d14..6b4fbabf28 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -23,13 +23,16 @@
  #error "Please include config.h first."
 #endif
 
-#include <stdint.h>
-
-_GL_INLINE_HEADER_BEGIN
+/* Define this now, rather than after including stdint.h, in case
+   stdint.h recursively includes us.  This is for Gnulib endian.h.  */
 #ifndef _GL_BYTESWAP_INLINE
 # define _GL_BYTESWAP_INLINE _GL_INLINE
 #endif
 
+#include <stdint.h>
+
+_GL_INLINE_HEADER_BEGIN
+
 #ifdef __cplusplus
 extern "C" {
 #endif
diff --git a/lib/endian.in.h b/lib/endian.in.h
index c07aa612f0..03f541967f 100644
--- a/lib/endian.in.h
+++ b/lib/endian.in.h
@@ -112,10 +112,10 @@ extern "C" {
 /* These declarations are needed if Gnulib byteswap.h -> stdint.h ->
    sys/types.h -> endian.h -> Gnulib byteswap.h, the last of which is blocked
    by its include guard so the functions are not yet declared.  */
-#ifdef _GL_BYTESWAP_H
-extern uint_least16_t bswap_16 (uint_least16_t);
-extern uint_least32_t bswap_32 (uint_least32_t);
-extern uint_least64_t bswap_64 (uint_least64_t);
+#ifdef _GL_BYTESWAP_INLINE
+_GL_BYTESWAP_INLINE uint_least16_t bswap_16 (uint_least16_t);
+_GL_BYTESWAP_INLINE uint_least32_t bswap_32 (uint_least32_t);
+_GL_BYTESWAP_INLINE uint_least64_t bswap_64 (uint_least64_t);
 #endif
 
 /* Big endian to host.  */
-- 
2.48.1

Reply via email to