Skip to content
Snippets Groups Projects
Commit 555fd59f authored by Sergey Kosukhin's avatar Sergey Kosukhin Committed by Yen-Chen Chen
Browse files

Detect the endianness with CMake (!111)

## 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>`](https://gitlab.dkrz.de/icon-libraries/libfortran-support/-/blob/316d3dc6edb6ef0f4f1b9adaf9f3cb27a7bb831a/src/util_hash.c#L49) does not define the `__DARWIN_BYTE_ORDER` and `__DARWIN_LITTLE_ENDIAN` macros when [`#define _POSIX_C_SOURCE 200112L`](https://gitlab.dkrz.de/icon-libraries/libfortran-support/-/blob/316d3dc6edb6ef0f4f1b9adaf9f3cb27a7bb831a/src/util_hash.c#L45). 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.

Approved-by: default avatarYen-Chen Chen <yen-chen.chen@tum.de>
Merged-by: default avatarYen-Chen Chen <yen-chen.chen@tum.de>
Changelog: bugfix
parent 316d3dc6
No related branches found
No related tags found
1 merge request!111Detect the endianness with CMake
Pipeline #97029 passed
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment