Detect the endianness with CMake
What is the bug
The endianness detection in src/util_hash.c
produces a false result on macOS with GCC 13 or later. For whatever reason, #include <sys/param.h>
does not define the __DARWIN_BYTE_ORDER
and __DARWIN_LITTLE_ENDIAN
macros when #define _POSIX_C_SOURCE 200112L
. And that leads to the wrong values of the HASH_LITTLE_ENDIAN
and HASH_BIG_ENDIAN
macros. See also https://gitlab.dkrz.de/icon/icon-mpim/-/merge_requests/684#note_300951.
How do you fix it
The endianness detection is delegated to CMake.
How urgent is the bugfix
-
I need it as soon as possible -
I can wait for a couple of days -
None of my current codes is directly affected
Mandatory steps before review
-
Gitlab CI passes (Hint: use make format
for linting) -
Bugfix is covered by additional unit tests -
Mark the merge request as ready by removing Draft:
Mandatory steps before merge
-
Test coverage does not decrease -
Reviewed by a maintainer -
Incorporate review suggestions -
Prior to merging, please remove any boilerplate from the MR description, retaining only the What is the bug and How do you fix it section to maintain -
Remember to edit the commit message and select the proper changelog category (feature/bugfix/other)
You are not supposed to merge this request by yourself, the maintainers of fortan-support take care of this action!
Edited by Yen-Chen Chen