]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
endian: port to Solaris 11.4 and macOS 15
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Sep 2025 20:01:00 +0000 (13:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 13 Sep 2025 20:01:00 +0000 (13:01 -0700)
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
lib/byteswap.in.h
lib/endian.in.h

index b0758ac62aed1d2c645f748ee2850d6e6f439e5a..f53d4204fe2f6e4911967e497c188430c613e4d0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-09-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <bruno@clisp.org>
 
        gettext-h: Move fallback definition of GNULIB_TEXT_DOMAIN.
index 1227f01d144c6a0fa7310da164b6024067c62636..6b4fbabf283204cd6ae0cfd0828d0b7d8dffabf5 100644 (file)
  #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
index c07aa612f0fc838cbbb788dabc721cb60994e02a..03f541967fbed3f3d6c086b98a395470a0332e96 100644 (file)
@@ -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.  */