]> Savannah Git Hosting - gnulib.git/commitdiff
endian: Update doc and strengthen tests.
authorBruno Haible <bruno@clisp.org>
Sat, 18 May 2024 10:25:41 +0000 (12:25 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 18 May 2024 10:25:41 +0000 (12:25 +0200)
* doc/glibc-headers/endian.texi: Reference LSB and future POSIX
specifications. Update platforms list.
* tests/test-endian.c: Verify that BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN
can be used in #if.

ChangeLog
doc/glibc-headers/endian.texi
tests/test-endian.c

index 217e0dd05939aa15e95355e40183048ec2ce0253..322aaf362d5e6d699b782eaaf43b4a6fe558e2c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-05-18  Bruno Haible  <bruno@clisp.org>
+
+       endian: Update doc and strengthen tests.
+       * doc/glibc-headers/endian.texi: Reference LSB and future POSIX
+       specifications. Update platforms list.
+       * tests/test-endian.c: Verify that BYTE_ORDER, LITTLE_ENDIAN, BIG_ENDIAN
+       can be used in #if.
+
 2024-05-18  Collin Funk  <collin.funk1@gmail.com>
 
        endian: Add tests.
index 5c7cb7242909456100341816a925b852c4daeeab..ebaeb4fe7f1c3f7525bcb48b3fe57d25a50fafbc 100644 (file)
@@ -1,7 +1,11 @@
 @node endian.h
 @section @file{endian.h}
 
-Describe's the platform's endianness (byte ordering of words stored in memory).
+LSB specification:@* @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/libc-ddefs.html}
+
+Future POSIX specification:@* @url{https://www.austingroupbugs.net/view.php?id=162}
+
+Describes the platform's endianness (byte ordering of words stored in memory).
 Defines the macros @code{BYTE_ORDER}, @code{LITTLE_ENDIAN}, @code{BIG_ENDIAN},
 @code{PDP_ENDIAN}.
 
@@ -11,7 +15,7 @@ Portability problems fixed by Gnulib:
 @itemize
 @item
 This header file is missing on some platforms:
-macOS 11.1, FreeBSD 13.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, Solaris 11.4, mingw, MSVC 14.
+macOS 11.1, FreeBSD 13.0, NetBSD 7.1, OpenBSD 3.8, Minix 3.1.8, AIX 7.3.1, HP-UX 11.31, Solaris 11.4, mingw, MSVC 14.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index 919faa56f5c76a0e67062ee795e853b23089504f..739b18964e0f472e1343c3ffa3204ff3a848fea1 100644 (file)
@@ -30,7 +30,17 @@ uint32_t t2;
 uint64_t t3;
 #endif
 
+/* "These macros shall be suitable for use in #if preprocessing directives."  */
+#if BYTE_ORDER == LITTLE_ENDIAN
+int a = 17;
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+int a = 19;
+#endif
+
+/* "The macros BIG_ENDIAN and LITTLE_ENDIAN shall have distinct values."  */
 static_assert (LITTLE_ENDIAN != BIG_ENDIAN);
+
 static_assert (BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == BIG_ENDIAN);
 
 #include <stdint.h>