On Solaris 11 OpenIndiana from 2025, "make check" in coreutils-9.10.289-a8598
fails with a compilation error in the gnulib-tests (both with gcc and clang):

  CC       test-byteswap.o
In file included from ../../gnulib-tests/test-byteswap.c:24:
../../gnulib-tests/test-byteswap.c: In function 'test_bswap_constant':
../../gnulib-tests/test-byteswap.c:33:11: error: implicit declaration of 
function 'bswap_64'; did you mean 'bswap_32'? [-Wimplicit-function-declaration]
   33 |   ASSERT (bswap_64 (UINT64_C (0x1234567890ABCDEF))
      |           ^~~~~~~~
../../gnulib-tests/macros.h:83:13: note: in definition of macro 'ASSERT'
   83 |       if (!(expr))                                                      
     \
      |             ^~~~
gmake[5]: *** [Makefile:10417: test-byteswap.o] Error 1

The cause is that byteswap.h does not define bswap_64(), because it
is conditional on '#ifdef UINT_LEAST64_MAX', and <stdbit.h> does not
define UINT_LEAST64_MAX. Only <stdint.h> does.

This Gnulib patch fixes it.


2026-04-16  Bruno Haible  <[email protected]>

        byteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).
        * lib/byteswap.in.h: Include <stdint.h>.
        * modules/byteswap (Depends-on): Add stdint-h.

diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index 043105ea03..02433d30da 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -29,7 +29,8 @@
 # define _GL_BYTESWAP_INLINE _GL_INLINE
 #endif
 
-#include <stdbit.h>
+#include <stdbit.h> /* for stdc_memreverse8u* */
+#include <stdint.h> /* for UINT_LEAST64_MAX */
 
 _GL_INLINE_HEADER_BEGIN
 
diff --git a/modules/byteswap b/modules/byteswap
index 85c7865ede..891fe6a295 100644
--- a/modules/byteswap
+++ b/modules/byteswap
@@ -10,6 +10,7 @@ Depends-on:
 gen-header
 extern-inline           [$GL_GENERATE_BYTESWAP_H]
 stdbit-h                [$GL_GENERATE_BYTESWAP_H]
+stdint-h                [$GL_GENERATE_BYTESWAP_H]
 stdc_memreverse8u       [$GL_GENERATE_BYTESWAP_H]
 
 configure.ac:




Reply via email to